author | Wuzzy <almikes@aol.com> |
Wed, 13 Apr 2016 00:39:45 +0200 | |
changeset 11718 | f699978eae19 |
parent 11717 | f35139700d22 |
child 11719 | 9fea4e2dceaa |
permissions | -rw-r--r-- |
11015 | 1 |
--------------------------------------------------------- |
2 |
--- LE CONSTRUCTION MODE 0.7 (badly adapted from Hedge Editor 0.5) |
|
3 |
--------------------------------------------------------- |
|
4 |
-- a hedgewars gameplay mode by mikade |
|
5 |
-- special thanks to all who helped test and offered suggestions |
|
6 |
-- additional thanks to sheepluva/nemo for adding some extra hooks |
|
7 |
||
8 |
-- (to do) |
|
9 |
-- investigate loc not working on addcaptions |
|
10 |
-- check for parsecommands before porting to dev |
|
11 |
-- test onUpDown more extensively as it may need revision (check for amRubber etc) |
|
12 |
-- test localization of weapons and utils and stuff |
|
13 |
||
14 |
-- try posistion grenades in Harmer so it blows hogs away from the struc |
|
15 |
-- and don't explode too close to the struc |
|
16 |
||
17 |
-- additional/previous balance ideas |
|
18 |
-- based on your money? |
|
19 |
-- based on the number of strucs/gens you own? |
|
20 |
-- based on your existing arsenal? |
|
21 |
-- limit number of crates spawned per round perhaps (done) |
|
22 |
-- limit number of generators? |
|
23 |
||
24 |
------------------------------------------------------------------------------ |
|
25 |
--version history |
|
26 |
------------------------------------------------------------------------------ |
|
27 |
--v0.1 |
|
28 |
-- concept test |
|
29 |
||
30 |
--v0.2 |
|
31 |
-- improved documentation (in script and in game) |
|
32 |
-- improved localisation (or is it? at any rate, crate placement should now say e.g. Bazooka and not amBazooka) |
|
33 |
-- added variable weapon costs (based on the values from Vatten's Consumerism script) |
|
34 |
||
35 |
-- added reflector shield (still needs work and balancing) |
|
36 |
-- added weapon-filter (probably ok) |
|
37 |
||
38 |
-- enabled super weapons like ballgun, rcplane, watermelon, hellish to test balance |
|
39 |
-- reduce max money to 1000 |
|
40 |
||
41 |
--v0.3 |
|
42 |
-- some /s removed |
|
43 |
||
44 |
--v0.4 |
|
45 |
-- added support for per hog ammo (hopefully) |
|
46 |
||
47 |
--v0.5 (dev) |
|
48 |
-- added somewhat horribly implemented support for different structure sprites |
|
49 |
-- added override pictures for ammo menu |
|
50 |
-- added override message on wep select to aid understanding |
|
51 |
-- split menu into/between weps/parts: struc, crates, gears |
|
52 |
-- add a limit on crates per turn |
|
53 |
-- add a limit on extra time per turn |
|
54 |
-- add a test level |
|
55 |
-- restored rubber placement |
|
56 |
-- cleaned up some of the code a bit and removed about 280 lines of code I didn't need, lol |
|
57 |
||
58 |
--v0.6 (dev) |
|
59 |
-- added magic dance |
|
60 |
||
61 |
--v.07 (pushed to repo) |
|
62 |
-- added a cfg file |
|
63 |
-- removed another 903 lines of code we weren't using (lol) |
|
64 |
||
65 |
-------------------------------- |
|
66 |
-- STRUCTURES LIST / IDEAS |
|
67 |
-------------------------------- |
|
68 |
||
69 |
--Healing Station: heals hogs to 150 life |
|
70 |
--Teleportation Node: allows teleporting to any other teleporter nodes |
|
71 |
--Bio-filter: explodes enemy hogs |
|
72 |
--Respawner: if you have one of these, any slain hogs are resurrected here :D |
|
73 |
--Generator: generates energy (used to buy stuff, and possibly later other strucs might have upkeep costs) |
|
74 |
--Support Station: allows purchasing of weapons, utilities, and med-crates |
|
75 |
--Construction Station: allows purchasing of girders, rubber, mines, sticky mines, barrels |
|
76 |
--Reflector Shield: reflect projectiles |
|
77 |
--Weapon Filter: kill all equipement of enemy hogs passing through this area. |
|
78 |
||
79 |
||
80 |
--to make the grill more attractive make it vaporize flying saucers |
|
81 |
--and also rope, and maybe incoming gears |
|
82 |
||
83 |
-- make healing thing also cure poison |
|
84 |
-- maybe make poison more virulent and dangerous |
|
85 |
||
86 |
--(not implemented / abandoned ideas) |
|
87 |
-- Core: allows construction of other structures. |
|
88 |
-- Automated Turret (think red drones from space invasion) |
|
89 |
-- Canon (gives access to 3 fireballs per turn while near) |
|
90 |
-- something that allows control of wind/water |
|
91 |
-- Gravity Field generator : triggers world gravity change |
|
92 |
||
93 |
-- structures consume power over time and |
|
94 |
-- maybe you can turn structures OFF/ON, manually to save power. |
|
95 |
||
96 |
-- hacking |
|
97 |
-- allow hacking of structures, either being able to use enemy structures, |
|
98 |
-- or turning a team's structures against them. |
|
99 |
||
100 |
-- pylons |
|
101 |
-- allow hogs to put down a pylon-like gear which then allows the core |
|
102 |
-- to place other structures/objects within the pylon's sphere of influence |
|
103 |
-- this would allow aggressive structure advancement |
|
104 |
||
105 |
-- resouce mining? |
|
106 |
-- you could designate something like mines, that you could get close to, |
|
107 |
-- "pick up", and then "drop" back at a central location to simulate |
|
108 |
-- resource mining. bit complicated/meh, normal power generators probably easier |
|
109 |
||
110 |
-- it would be cool to have a red mask we could apply over girders |
|
111 |
-- that would indicate they were Indestructible |
|
112 |
||
113 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
|
114 |
HedgewarsScriptLoad("/Scripts/Tracker.lua") |
|
115 |
||
116 |
---------------------------------------------- |
|
117 |
-- STRUC CRAP |
|
118 |
---------------------------------------------- |
|
119 |
||
120 |
strucID = {} |
|
121 |
strucGear = {} |
|
122 |
strucClan = {} |
|
123 |
strucType = {} |
|
124 |
strucCost = {} |
|
125 |
strucHealth = {} |
|
126 |
||
127 |
strucCirc = {} |
|
128 |
strucCircCol = {} |
|
129 |
strucCircRadius = {} |
|
130 |
strucCircType = {} |
|
131 |
strucAltDisplay = {} |
|
132 |
||
133 |
placedExpense = 0 |
|
134 |
||
135 |
tempID = nil |
|
136 |
||
137 |
sUID = 0 |
|
138 |
||
139 |
colorRed = 0xff0000ff |
|
140 |
colorGreen = 0x00ff00ff |
|
141 |
||
142 |
clanBoundsSX = {} |
|
143 |
clanBoundsSY = {} |
|
144 |
clanBoundsEX = {} |
|
145 |
clanBoundsEY = {} |
|
146 |
||
147 |
clanPower = {} |
|
148 |
clanID = {} |
|
149 |
clanLStrucIndex = {} |
|
150 |
||
151 |
clanLWepIndex = {} -- for ease of use let's track this stuff |
|
152 |
clanLUtilIndex = {} |
|
153 |
clanLGearIndex = {} |
|
154 |
clanUsedExtraTime = {} |
|
155 |
clanCratesSpawned = {} |
|
156 |
||
157 |
effectTimer = 0 |
|
158 |
||
159 |
wallsVisible = false |
|
160 |
wX = {} |
|
161 |
wY = {} |
|
162 |
wWidth = {} |
|
163 |
wHeight = {} |
|
164 |
wCol = {} |
|
165 |
margin = 20 |
|
166 |
||
167 |
vTag = {} |
|
168 |
lastWep = nil |
|
169 |
||
11717
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
170 |
checkForSpecialWeaponsIn = -1 |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
171 |
|
11015 | 172 |
function HideTags() |
173 |
||
174 |
for i = 0, 2 do |
|
175 |
SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00) |
|
176 |
end |
|
177 |
||
178 |
end |
|
179 |
||
180 |
function DrawTag(i) |
|
181 |
||
182 |
zoomL = 1.3 |
|
183 |
||
184 |
xOffset = 40 |
|
185 |
||
186 |
if i == 0 then |
|
187 |
yOffset = 40 |
|
188 |
tCol = 0xffba00ff |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
189 |
tValue = 30 |
11015 | 190 |
elseif i == 1 then |
191 |
zoomL = 1.1 |
|
192 |
xOffset = 45 |
|
193 |
yOffset = 70 |
|
194 |
tCol = 0x00ff00ff |
|
195 |
tValue = clanPower[GetHogClan(CurrentHedgehog)] |
|
196 |
elseif i == 2 then |
|
197 |
zoomL = 1.1 |
|
198 |
xOffset = 60 + 35 |
|
199 |
yOffset = 70 |
|
200 |
tCol = 0xa800ffff |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
201 |
tValue = 10 |
11015 | 202 |
end |
203 |
||
204 |
DeleteVisualGear(vTag[i]) |
|
205 |
vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false) |
|
206 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i]) |
|
207 |
SetVisualGearValues ( |
|
208 |
vTag[i], --id |
|
209 |
-div(ScreenWidth,2) + xOffset, --xoffset |
|
210 |
ScreenHeight - yOffset, --yoffset |
|
211 |
0, --dx |
|
212 |
0, --dy |
|
213 |
zoomL, --zoom |
|
214 |
1, --~= 0 means align to screen |
|
215 |
g7, --frameticks |
|
216 |
tValue, --value |
|
217 |
240000, --timer |
|
218 |
tCol --GetClanColor( GetHogClan(CurrentHedgehog) ) |
|
219 |
) |
|
220 |
||
221 |
end |
|
222 |
||
223 |
function onScreenResize() |
|
224 |
||
225 |
-- redraw Tags so that their screen locations are updated |
|
226 |
if (CurrentHedgehog ~= nil) then |
|
227 |
DrawTag(0) |
|
228 |
DrawTag(1) |
|
229 |
DrawTag(2) |
|
230 |
end |
|
231 |
||
232 |
end |
|
233 |
||
234 |
function XYisInRect(px, py, psx, psy, pex, pey) |
|
235 |
||
236 |
if (px > psx) and (px < pex) and (py > psy) and (py < pey) then |
|
237 |
return(true) |
|
238 |
else |
|
239 |
return(false) |
|
240 |
end |
|
241 |
||
242 |
end |
|
243 |
||
244 |
function AddWall(zXMin,zYMin, zWidth, zHeight, zCol) |
|
245 |
||
246 |
table.insert(wX, zXMin) |
|
247 |
table.insert(wY, zYMin) |
|
248 |
table.insert(wWidth, zWidth) |
|
249 |
table.insert(wHeight, zHeight) |
|
250 |
table.insert(wCol, zCol) |
|
251 |
||
252 |
end |
|
253 |
||
254 |
function BorderSpark(zXMin,zYMin, zWidth, zHeight, bCol) |
|
255 |
||
256 |
eX = zXMin + GetRandom(zWidth+10) |
|
257 |
eY = zYMin + GetRandom(zHeight+10) |
|
258 |
tempE = AddVisualGear(eX, eY, vgtDust, 0, false) |
|
259 |
if tempE ~= 0 then |
|
260 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
|
261 |
SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, 1, g9, bCol ) |
|
262 |
end |
|
263 |
||
264 |
end |
|
265 |
||
266 |
function HandleBorderEffects() |
|
267 |
||
268 |
effectTimer = effectTimer + 1 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
269 |
if effectTimer > 15 then |
11015 | 270 |
effectTimer = 1 |
271 |
for i = 1, #wX do |
|
272 |
BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], wCol[i]) |
|
273 |
end |
|
274 |
end |
|
275 |
||
276 |
end |
|
277 |
||
278 |
---- |
|
279 |
-- old reflecting stuff from like 3 years ago lol |
|
280 |
--- |
|
281 |
||
282 |
function gearCanBeDeflected(gear) |
|
283 |
||
284 |
if (GetGearType(gear) == gtShell) or |
|
285 |
(GetGearType(gear) == gtGrenade) or |
|
286 |
(GetGearType(gear) == gtAirBomb) or |
|
287 |
(GetGearType(gear) == gtClusterBomb) or |
|
288 |
(GetGearType(gear) == gtCluster) or |
|
289 |
(GetGearType(gear) == gtGasBomb) or |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
290 |
(GetGearType(gear) == gtMine) or |
11015 | 291 |
(GetGearType(gear) == gtMortar) or |
292 |
(GetGearType(gear) == gtHellishBomb) or |
|
293 |
(GetGearType(gear) == gtWatermelon) or |
|
294 |
(GetGearType(gear) == gtMelonPiece) or |
|
295 |
(GetGearType(gear) == gtEgg) or |
|
296 |
(GetGearType(gear) == gtDrill) or |
|
297 |
(GetGearType(gear) == gtBall) or |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
298 |
(GetGearType(gear) == gtExplosives) or |
11015 | 299 |
(GetGearType(gear) == gtFlame) or |
300 |
(GetGearType(gear) == gtPortal) or |
|
301 |
(GetGearType(gear) == gtDynamite) or |
|
302 |
(GetGearType(gear) == gtSMine) or |
|
303 |
(GetGearType(gear) == gtKnife) or |
|
304 |
(GetGearType(gear) == gtJetpack) or -- test this and birdy plz |
|
305 |
(GetGearType(gear) == gtBirdy) or -- test this and birdy plz |
|
306 |
(GetGearType(gear) == gtSnowball) or |
|
307 |
(GetGearType(gear) == gtMolotov) |
|
308 |
then |
|
309 |
return(true) |
|
310 |
else |
|
311 |
return(false) |
|
312 |
end |
|
313 |
||
314 |
end |
|
315 |
||
316 |
function getThreatDamage(gear) |
|
317 |
||
318 |
--- damage amounts for weapons |
|
319 |
if (GetGearType(gear) == gtGrenade) or |
|
320 |
(GetGearType(gear) == gtClusterBomb) or |
|
321 |
(GetGearType(gear) == gtGasBomb) or |
|
322 |
(GetGearType(gear) == gtKnife) or |
|
323 |
(GetGearType(gear) == gtEgg) or |
|
324 |
(GetGearType(gear) == gtMolotov) or |
|
325 |
(GetGearType(gear) == gtHellishBomb) or |
|
326 |
(GetGearType(gear) == gtWatermelon) or |
|
327 |
(GetGearType(gear) == gtSMine) |
|
328 |
then |
|
329 |
dmg = 30 |
|
330 |
||
331 |
elseif (GetGearType(gear) == gtMelonPiece) then |
|
332 |
dmg = 40 |
|
333 |
||
334 |
elseif (GetGearType(gear) == gtAirBomb) or |
|
335 |
(GetGearType(gear) == gtDrill) or |
|
336 |
(GetGearType(gear) == gtMine) or |
|
337 |
(GetGearType(gear) == gtCluster) then |
|
338 |
dmg = 20 |
|
339 |
||
340 |
elseif (GetGearType(gear) == gtFlame) or |
|
341 |
(GetGearType(gear) == gtPortal) or |
|
342 |
(GetGearType(gear) == gtDynamite) |
|
343 |
then |
|
344 |
dmg = 0 |
|
345 |
||
346 |
elseif (GetGearType(gear) == gtBall) then |
|
347 |
dmg = 1 |
|
348 |
||
349 |
else --normal shell, snowball etc |
|
350 |
dmg = 65 |
|
351 |
end |
|
352 |
||
353 |
return(dmg) |
|
354 |
||
355 |
end |
|
356 |
||
357 |
function setGearReflectionValues(gear) |
|
358 |
||
359 |
dmg = getThreatDamage(gear) |
|
360 |
setGearValue(gear,"damage",dmg) |
|
361 |
setGearValue(gear,"deflects",0) |
|
362 |
||
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
363 |
if (CurrentHedgehog ~= nil) then |
11015 | 364 |
setGearValue(gear,"owner",GetHogClan(CurrentHedgehog)) -- NEW NEEDS CHANGE? |
365 |
else |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
366 |
setGearValue(gear,"owner",10) |
11015 | 367 |
end |
368 |
||
369 |
end |
|
370 |
||
371 |
function AddStruc(pX,pY, pType, pClan) |
|
372 |
||
373 |
sUID = sUID + 1 |
|
374 |
||
375 |
tempG = AddGear(0, 0, gtTarget, 0, 0, 0, 0) |
|
376 |
SetGearPosition(tempG, pX, pY) |
|
377 |
setGearValue(tempG, "sUID", sUID) |
|
378 |
||
379 |
tempCirc = AddVisualGear(0,0,vgtCircle,0,true) |
|
380 |
||
381 |
SetVisualGearValues(tempCirc, 0, 0, 100, 255, 1, 100, 0, 500, 1, 0xFFFFFF00) |
|
382 |
||
383 |
table.insert(strucID, sUID) |
|
384 |
table.insert(strucType, pType) |
|
385 |
table.insert(strucGear,tempG) |
|
386 |
table.insert(strucClan,pClan) |
|
387 |
table.insert(strucCost,2) |
|
388 |
||
389 |
frameID = 0 |
|
390 |
visualSprite = sprTarget |
|
391 |
madness = AddVisualGear(GetX(tempG), GetY(tempG), vgtStraightShot, 1, true,1) |
|
392 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(madness) --g9 |
|
393 |
||
394 |
||
395 |
if pType == loc("Reflector Shield") then |
|
396 |
table.insert(strucHealth,255) |
|
397 |
||
398 |
else |
|
399 |
table.insert(strucHealth,1) |
|
400 |
end |
|
401 |
||
402 |
table.insert(strucCirc,tempCirc) |
|
403 |
||
404 |
table.insert(strucCircType, 1) |
|
405 |
if pType == loc("Bio-Filter") then |
|
406 |
table.insert(strucCircCol,colorRed) |
|
407 |
table.insert(strucCircRadius,1000) |
|
408 |
frameID = 7 |
|
409 |
elseif pType == loc("Healing Station") then |
|
410 |
table.insert(strucCircCol,0xFF00FF00) |
|
411 |
table.insert(strucCircRadius,500) |
|
412 |
frameID = 3 |
|
413 |
elseif pType == loc("Respawner") then |
|
414 |
table.insert(strucCircCol,0xFF00FF00) |
|
415 |
table.insert(strucCircRadius,75) |
|
416 |
runOnHogs(EnableHogResurrectionForThisClan) |
|
417 |
frameID = 1 |
|
418 |
elseif pType == loc("Teleportation Node") then |
|
419 |
table.insert(strucCircCol,0x0000FFFF) |
|
420 |
table.insert(strucCircRadius,350) |
|
421 |
frameID = 6 |
|
422 |
elseif pType == loc("Core") then |
|
423 |
table.insert(strucCircCol,0xFFFFFFFF) |
|
424 |
table.insert(strucCircRadius,350) |
|
425 |
elseif pType == loc("Generator") then |
|
426 |
table.insert(strucCircCol,0xFFFF00FF) |
|
427 |
table.insert(strucCircRadius,75) |
|
428 |
setGearValue(tempG, "power", 0) |
|
429 |
frameID = 2 |
|
430 |
elseif pType == loc("Support Station") then |
|
431 |
table.insert(strucCircCol,0xFFFF00FF) |
|
432 |
table.insert(strucCircRadius,500) |
|
433 |
frameID = 4 |
|
434 |
elseif pType == loc("Construction Station") then |
|
435 |
table.insert(strucCircCol,0xFFFFFFFF) |
|
436 |
table.insert(strucCircRadius,500) |
|
437 |
frameID = 8 |
|
438 |
elseif pType == loc("Reflector Shield") then |
|
439 |
table.insert(strucCircCol,0xffae00ff) |
|
440 |
table.insert(strucCircRadius,750) |
|
441 |
frameID = 9 |
|
442 |
elseif pType == loc("Weapon Filter") then |
|
443 |
table.insert(strucCircCol,0xa800ffff) |
|
444 |
table.insert(strucCircRadius,750) |
|
445 |
frameID = 5 |
|
446 |
end |
|
447 |
||
448 |
||
449 |
SetVisualGearValues(madness, g1, g2, 0, 0, g5, frameID, g7, visualSprite, g9, g10 ) |
|
450 |
SetState(tempG, bor(GetState(tempG),gstInvisible) ) |
|
451 |
table.insert(strucAltDisplay, madness) |
|
452 |
||
453 |
end |
|
454 |
||
455 |
-- this is basically onStructureDelete |
|
456 |
-- we may need to expand it for non-gear structures later |
|
457 |
function CheckGearForStructureLink(gear) |
|
458 |
||
459 |
respawnerDestroyed = false |
|
460 |
||
461 |
for i = 1, #strucID do |
|
462 |
if strucID[i] == getGearValue(gear,"sUID") then |
|
463 |
||
464 |
if strucType[i] == loc("Respawner") then |
|
465 |
respawnerDestroyed = true |
|
466 |
end |
|
467 |
||
468 |
table.remove(strucID,i) |
|
469 |
table.remove(strucGear,i) |
|
470 |
table.remove(strucClan,i) |
|
471 |
table.remove(strucType,i) |
|
472 |
table.remove(strucCost,i) |
|
473 |
table.remove(strucHealth,i) |
|
474 |
||
475 |
DeleteVisualGear(strucCirc[i]) |
|
476 |
table.remove(strucCirc,i) |
|
477 |
||
478 |
table.remove(strucCircCol,i) |
|
479 |
table.remove(strucCircRadius,i) |
|
480 |
table.remove(strucCircType,i) |
|
481 |
||
482 |
if strucAltDisplay[i] ~= 1 then |
|
483 |
DeleteVisualGear(strucAltDisplay[i]) |
|
484 |
end |
|
485 |
table.remove(strucAltDisplay,i) |
|
486 |
||
487 |
end |
|
488 |
end |
|
489 |
||
490 |
if respawnerDestroyed == true then |
|
491 |
runOnHogs(RecalibrateRespawn) |
|
492 |
end |
|
493 |
||
494 |
end |
|
495 |
||
496 |
-- called when we add a new respawner |
|
497 |
function EnableHogResurrectionForThisClan(gear) |
|
498 |
if GetHogClan(gear) == GetHogClan(CurrentHedgehog) then |
|
499 |
SetEffect(gear, heResurrectable, 1) |
|
500 |
end |
|
501 |
end |
|
502 |
||
503 |
-- this is called when a respawner blows up |
|
504 |
function RecalibrateRespawn(gear) |
|
505 |
||
506 |
respawnerList = {} |
|
507 |
for i = 1, #strucID do |
|
508 |
if (strucType[i] == loc("Respawner")) and (strucClan[i] == GetHogClan(gear)) then |
|
509 |
table.insert(respawnerList, i) |
|
510 |
end |
|
511 |
end |
|
512 |
||
513 |
if #respawnerList >= 1 then |
|
514 |
SetEffect(gear, heResurrectable, 1) |
|
515 |
else |
|
516 |
SetEffect(gear, heResurrectable, 0) |
|
517 |
end |
|
518 |
||
519 |
end |
|
520 |
||
521 |
--resposition dead hogs at a respawner if they own one |
|
522 |
function FindRespawner(gear) |
|
523 |
||
524 |
respawnerList = {} |
|
525 |
for i = 1, #strucID do |
|
526 |
if (strucType[i] == loc("Respawner")) and (strucClan[i] == GetHogClan(gear)) then |
|
527 |
table.insert(respawnerList, i) |
|
528 |
end |
|
529 |
end |
|
530 |
||
531 |
if #respawnerList >= 1 then |
|
532 |
i = GetRandom(#respawnerList)+1 |
|
533 |
SetGearPosition(gear,GetX(strucGear[respawnerList[i]]),GetY(strucGear[respawnerList[i]])-25) |
|
534 |
AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
|
535 |
else -- (this should never happen, but just in case) |
|
536 |
SetEffect(gear, heResurrectable, 0) |
|
537 |
DeleteGear(gear) |
|
538 |
end |
|
539 |
||
540 |
end |
|
541 |
||
542 |
function onGearResurrect(gear) |
|
543 |
AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
|
544 |
FindRespawner(gear) |
|
545 |
end |
|
546 |
||
547 |
||
548 |
function CheckTeleport(gear, tX, tY) |
|
549 |
||
550 |
teleportOriginSuccessful = false |
|
551 |
teleportDestinationSuccessful = false |
|
552 |
||
553 |
for i = 1, #strucID do |
|
554 |
||
555 |
if (strucType[i] == loc("Teleportation Node")) and (strucClan[i] == GetHogClan(CurrentHedgehog)) then |
|
556 |
||
557 |
dist = GetDistFromGearToXY(CurrentHedgehog,GetX(strucGear[i]), GetY(strucGear[i])) |
|
558 |
if strucCircType[i] == 0 then |
|
559 |
NR = strucCircRadius[i] |
|
560 |
else |
|
561 |
NR = (48/100*strucCircRadius[i])/2 |
|
562 |
end |
|
563 |
if dist <= NR*NR then |
|
564 |
teleportOriginSuccessful = true |
|
565 |
end |
|
566 |
||
567 |
dist = GetDistFromXYtoXY(tX,tY,GetX(strucGear[i]), GetY(strucGear[i])) |
|
568 |
if strucCircType[i] == 0 then |
|
569 |
NR = strucCircRadius[i] |
|
570 |
else |
|
571 |
NR = (48/100*strucCircRadius[i])/2 |
|
572 |
end |
|
573 |
if dist <= NR*NR then |
|
574 |
teleportDestinationSuccessful = true |
|
575 |
end |
|
576 |
||
577 |
end |
|
578 |
||
579 |
||
580 |
end |
|
581 |
||
582 |
if ((teleportDestinationSuccessful == false) or (teleportOriginSuccessful == false)) then |
|
583 |
AddCaption(loc("Teleport Unsuccessful. Please teleport within a clan teleporter's sphere of influence.")) |
|
584 |
SetGearTarget(gear, GetX(CurrentHedgehog), GetY(CurrentHedgehog)) |
|
585 |
end |
|
586 |
||
587 |
end |
|
588 |
||
589 |
--Check for proximity of gears to structures, and make structures behave accordingly |
|
590 |
function CheckProximity(gear) |
|
591 |
||
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
592 |
dist = GetDistFromGearToXY(gear, GetX(strucGear[tempID]), GetY(strucGear[tempID])) |
11015 | 593 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
594 |
-- calculate my real radius if I am an aura |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
595 |
if strucCircType[tempID] == 0 then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
596 |
NR = strucCircRadius[tempID] |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
597 |
else |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
598 |
NR = (48/100*strucCircRadius[tempID])/2 |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
599 |
end |
11015 | 600 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
601 |
-- we're in business |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
602 |
if dist <= NR*NR then |
11015 | 603 |
|
604 |
||
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
605 |
-- heal clan hogs |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
606 |
if strucType[tempID] == loc("Healing Station") then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
607 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
608 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
609 |
if GetHogClan(gear) == strucClan[tempID] then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
610 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
611 |
hogLife = GetHealth(gear) + 1 |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
612 |
if hogLife > 150 then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
613 |
hogLife = 150 |
11015 | 614 |
end |
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
615 |
SetHealth(gear, hogLife) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
616 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
617 |
-- change this to the med kit sprite health ++++s later |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
618 |
tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
619 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
620 |
SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, colorGreen ) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
621 |
|
11015 | 622 |
end |
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
623 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
624 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
625 |
-- explode enemy clan hogs |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
626 |
elseif strucType[tempID] == loc("Bio-Filter") then |
11015 | 627 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
628 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
629 |
if (GetHogClan(gear) ~= strucClan[tempID]) and (GetHealth(gear) > 0) then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
630 |
AddGear(GetX(gear), GetY(gear), gtGrenade, 0, 0, 0, 1) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
631 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
632 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
633 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
634 |
-- were those weapons in your pocket, or were you just happy to see me? |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
635 |
elseif strucType[tempID] == loc("Weapon Filter") then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
636 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
637 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
638 |
if (GetHogClan(gear) ~= strucClan[tempID]) then |
11015 | 639 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
640 |
for wpnIndex = 1, #atkArray do |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
641 |
AddAmmo(gear, atkArray[wpnIndex][1], 0) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
642 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
643 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
644 |
for wpnIndex = 1, #utilArray do |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
645 |
AddAmmo(gear, utilArray[wpnIndex][1], 0) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
646 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
647 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
648 |
AddAmmo(gear, amAirAttack, 100) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
649 |
AddAmmo(gear, amSwitch, 100) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
650 |
AddAmmo(gear, amSkip, 100) |
11015 | 651 |
|
652 |
end |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
653 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
654 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
655 |
-- BOUNCE! POGO! POGO! POGO! POGO! |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
656 |
elseif strucType[tempID] == loc("Reflector Shield") then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
657 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
658 |
-- add check for whose projectile it is |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
659 |
if gearCanBeDeflected(gear) == true then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
660 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
661 |
gOwner = getGearValue(gear,"owner") |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
662 |
gDeflects = getGearValue(gear,"deflects") |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
663 |
gDmg = getGearValue(gear,"damage") |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
664 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
665 |
if gDeflects >= 3 then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
666 |
DeleteGear(gear) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
667 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
668 |
PlaySound(sndVaporize) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
669 |
elseif gOwner ~= strucClan[tempID] then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
670 |
--whether to vaporize gears or bounce them |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
671 |
if gDmg ~= 0 then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
672 |
dx, dy = GetGearVelocity(gear) |
11015 | 673 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
674 |
if (dx == 0) and (dy == 0) then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
675 |
-- static mine, explosive, etc encountered |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
676 |
-- do nothing |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
677 |
else |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
678 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
679 |
--let's bounce something! |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
680 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
681 |
dx = dx*(-1) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
682 |
dy = dy*(-1) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
683 |
SetGearVelocity(gear,dx,dy) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
684 |
setGearValue(gear,"deflects",(gDeflects+1)) |
11015 | 685 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
686 |
AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
687 |
PlaySound(sndExplosion) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
688 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
689 |
strucHealth[tempID] = strucHealth[tempID] - gDmg |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
690 |
strucCircCol[tempID] = strucCircCol[tempID] - gDmg |
11015 | 691 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
692 |
if strucHealth[tempID] <= 0 then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
693 |
AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtExplosion, 0, false) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
694 |
DeleteGear(strucGear[tempID]) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
695 |
PlaySound(sndExplosion) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
696 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
697 |
|
11015 | 698 |
end |
699 |
||
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
700 |
else |
11015 | 701 |
DeleteGear(gear) |
702 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) |
|
703 |
PlaySound(sndVaporize) |
|
704 |
end |
|
705 |
end |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
706 |
end |
11015 | 707 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
708 |
--mark as within range of a teleporter node |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
709 |
elseif strucType[tempID] == loc("Teleportation Node") then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
710 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
711 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
712 |
if GetHogClan(gear) == strucClan[tempID] then |
11015 | 713 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
714 |
for i = 1, #sProx do |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
715 |
if sProx[i][1] == loc("Teleportation Mode") then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
716 |
sProx[i][2] = true |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
717 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
718 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
719 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
720 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
721 |
end |
11015 | 722 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
723 |
-- mark as within range of construction station |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
724 |
-- and thus allow menu access to placement modes |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
725 |
-- for girders, mines, sticky mines and barrels |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
726 |
elseif strucType[tempID] == loc("Construction Station") then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
727 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
728 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
729 |
if GetHogClan(gear) == strucClan[tempID] then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
730 |
tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
731 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
732 |
for i = 1, #sProx do |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
733 |
if ((sProx[i][1] == loc("Girder Placement Mode")) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
734 |
or (sProx[i][1] == loc("Rubber Placement Mode")) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
735 |
or (sProx[i][1] == loc("Mine Placement Mode")) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
736 |
or (sProx[i][1] == loc("Sticky Mine Placement Mode")) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
737 |
or (sProx[i][1] == loc("Barrel Placement Mode"))) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
738 |
then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
739 |
sProx[i][2] = true |
11015 | 740 |
end |
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
741 |
end |
11015 | 742 |
|
743 |
||
744 |
end |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
745 |
end |
11015 | 746 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
747 |
-- mark as within stupport station range |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
748 |
-- and thus allow menu access to placement modes |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
749 |
-- for weapon, utility, and med crates |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
750 |
elseif strucType[tempID] == loc("Support Station") then |
11015 | 751 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
752 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
753 |
if GetHogClan(gear) == strucClan[tempID] then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
754 |
tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) |
11015 | 755 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
756 |
for i = 1, #sProx do |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
757 |
if ((sProx[i][1] == loc("Health Crate Placement Mode")) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
758 |
or (sProx[i][1] == loc("Weapon Crate Placement Mode")) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
759 |
or (sProx[i][1] == loc("Utility Crate Placement Mode"))) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
760 |
then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
761 |
sProx[i][2] = true |
11015 | 762 |
end |
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
763 |
end |
11015 | 764 |
|
765 |
||
766 |
end |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
767 |
end |
11015 | 768 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
769 |
-- doesn't do shit |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
770 |
elseif strucType[tempID] == loc("Core") then |
11015 | 771 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
772 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
773 |
if GetHogClan(gear) == strucClan[tempID] then |
11015 | 774 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
775 |
tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
776 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
777 |
SetVisualGearValues(tempE, g1+20, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(strucClan[tempID]) ) |
11015 | 778 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
779 |
tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
780 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
781 |
SetVisualGearValues(tempE, g1-20, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(strucClan[tempID]) ) |
11015 | 782 |
|
783 |
end |
|
784 |
end |
|
785 |
||
786 |
end |
|
787 |
||
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
788 |
end |
11015 | 789 |
|
790 |
end |
|
791 |
||
792 |
-- used to check if we need to run through all hogs or just currenthedgehog |
|
793 |
function isAStructureThatAppliesToMultipleGears(pID) |
|
794 |
if strucType[pID] == loc("Healing Station") or |
|
795 |
strucType[pID] == loc("Reflector Shield") or |
|
796 |
strucType[pID] == loc("Weapon Filter") or |
|
797 |
strucType[pID] == loc("Bio-Filter") |
|
798 |
then |
|
799 |
return(true) |
|
800 |
else |
|
801 |
return(false) |
|
802 |
end |
|
803 |
end |
|
804 |
||
805 |
function HandleStructures() |
|
806 |
||
807 |
for i = 1, #sProx do |
|
808 |
sProx[i][2] = false |
|
809 |
||
810 |
if sProx[i][1] == loc("Structure Placement Mode") then |
|
811 |
sProx[i][2] = true |
|
812 |
end |
|
813 |
||
814 |
end |
|
815 |
||
816 |
for i = 1, #strucID do |
|
817 |
||
818 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(strucCirc[i]) |
|
819 |
SetVisualGearValues(strucCirc[i], GetX(strucGear[i]), GetY(strucGear[i]), g3, g4, g5, g6, g7, strucCircRadius[i], g9, strucCircCol[i]) |
|
820 |
||
821 |
tempID = i |
|
822 |
||
823 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(strucAltDisplay[i]) --8000 |
|
824 |
SetVisualGearValues(strucAltDisplay[i], GetX(strucGear[i]), GetY(strucGear[i]), 0, 0, g5, g6, 800000, sprTarget, g9, g10 ) |
|
825 |
||
826 |
||
827 |
||
828 |
-- Check For proximity of stuff to our structures |
|
829 |
if isAStructureThatAppliesToMultipleGears(i) then |
|
830 |
runOnGears(CheckProximity) |
|
831 |
else -- only check prox on CurrentHedgehog |
|
832 |
CheckProximity(CurrentHedgehog) |
|
833 |
end |
|
834 |
||
835 |
if strucType[i] == loc("Core") then |
|
836 |
tempE = AddVisualGear(GetX(strucGear[i]), GetY(strucGear[i]), vgtSmoke, 0, true) |
|
837 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
|
838 |
SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(strucClan[i]) ) |
|
839 |
elseif strucType[i] == loc("Reflector Shield") then |
|
840 |
||
841 |
elseif strucType[i] == loc("Generator") then |
|
842 |
||
843 |
for z = 0, ClansCount-1 do |
|
844 |
if z == strucClan[i] then |
|
845 |
increaseGearValue(strucGear[i],"power") |
|
846 |
if getGearValue(strucGear[i],"power") == 10 then |
|
847 |
setGearValue(strucGear[i],"power",0) |
|
848 |
clanPower[z] = clanPower[z] + 1 |
|
849 |
if clanPower[z] > 1000 then |
|
850 |
clanPower[z] = 1000 |
|
851 |
end |
|
852 |
end |
|
853 |
||
854 |
end |
|
855 |
end |
|
856 |
||
857 |
end |
|
858 |
||
859 |
end |
|
860 |
||
861 |
||
862 |
||
863 |
-- this is kinda messy and gross (even more than usual), fix it up at some point |
|
864 |
-- it just assumes that if you have access to girders, it works for rubbers |
|
865 |
-- as that is what the struc implemenation means due to construction station |
|
866 |
anyUIProx = false |
|
867 |
for i = 1, #sProx do |
|
868 |
||
869 |
if sProx[i][1] == loc("Girder Placement Mode") then |
|
870 |
if sProx[i][2] == true then |
|
871 |
AddAmmo(CurrentHedgehog, amGirder, 100) |
|
872 |
AddAmmo(CurrentHedgehog, amRubber, 100) |
|
873 |
AddAmmo(CurrentHedgehog, amDrillStrike, 100) |
|
874 |
else |
|
875 |
AddAmmo(CurrentHedgehog, amGirder, 0) |
|
876 |
AddAmmo(CurrentHedgehog, amRubber, 0) |
|
877 |
AddAmmo(CurrentHedgehog, amDrillStrike, 0) -- new |
|
878 |
end |
|
879 |
elseif sProx[i][1] == loc("Teleportation Mode") then |
|
880 |
if sProx[i][2] == true then |
|
881 |
AddAmmo(CurrentHedgehog, amTeleport, 100) |
|
882 |
else |
|
883 |
AddAmmo(CurrentHedgehog, amTeleport, 0) |
|
884 |
end |
|
885 |
elseif sProx[i][1] == loc("Weapon Crate Placement Mode") then |
|
886 |
-- this is new stuff |
|
887 |
if sProx[i][2] == true then |
|
888 |
AddAmmo(CurrentHedgehog, amNapalm, 100) |
|
889 |
else |
|
890 |
AddAmmo(CurrentHedgehog, amNapalm, 0) |
|
891 |
end |
|
892 |
end |
|
893 |
||
894 |
if (sProx[i][2] == true) then |
|
895 |
anyUIProx = true |
|
896 |
end |
|
897 |
||
898 |
end |
|
899 |
||
900 |
end |
|
901 |
||
902 |
||
903 |
function checkForSpecialWeapons() |
|
904 |
||
905 |
||
906 |
||
907 |
if (GetCurAmmoType() == amAirAttack) then |
|
908 |
AddCaption(loc("Structure Placement Tool"),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpAmmoinfo) |
|
909 |
elseif (GetCurAmmoType() == amDrillStrike) then |
|
910 |
AddCaption(loc("Object Placement Tool"),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpAmmoinfo) |
|
911 |
elseif (GetCurAmmoType() == amNapalm) then |
|
912 |
AddCaption(loc("Crate Placement Tool"),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpAmmoinfo) |
|
913 |
end |
|
914 |
||
915 |
lastWep = GetCurAmmoType() |
|
916 |
||
917 |
end |
|
918 |
||
919 |
---------------------------------------------------------- |
|
920 |
-- EXCERPTS OF ADAPTED HEDGE_EDITOR CODE FOLLOWS |
|
921 |
---------------------------------------------------------- |
|
922 |
-- experimental crap |
|
923 |
||
924 |
local landType = 0 |
|
925 |
----------------------------------------- |
|
926 |
-- tracking vars for save slash load purposes |
|
927 |
----------------------------------------- |
|
928 |
||
929 |
local hhs = {} |
|
930 |
||
931 |
--------------------------------- |
|
932 |
-- crates are made of this stuff |
|
933 |
--------------------------------- |
|
934 |
placeholder = 20 |
|
935 |
atkArray = |
|
936 |
{ |
|
937 |
{amBazooka, "amBazooka", 0, loc("Bazooka"), 2*placeholder}, |
|
938 |
--{amBee, "amBee", 0, loc("Homing Bee"), 4*placeholder}, |
|
939 |
{amMortar, "amMortar", 0, loc("Mortar"), 1*placeholder}, |
|
940 |
{amDrill, "amDrill", 0, loc("Drill Rocket"), 3*placeholder}, |
|
941 |
{amSnowball, "amSnowball", 0, loc("Mudball"), 3*placeholder}, |
|
942 |
||
943 |
{amGrenade, "amGrenade", 0, loc("Grenade"), 2*placeholder}, |
|
944 |
{amClusterBomb, "amClusterBomb", 0, loc("Cluster Bomb"), 3*placeholder}, |
|
945 |
{amMolotov, "amMolotov", 0, loc("Molotov Cocktail"), 3*placeholder}, |
|
946 |
{amWatermelon, "amWatermelon", 0, loc("Watermelon Bomb"), 25*placeholder}, |
|
11709
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
diff
changeset
|
947 |
{amHellishBomb, "amHellishBomb", 0, loc("Hellish hand-grenade"), 25*placeholder}, |
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
diff
changeset
|
948 |
{amGasBomb, "amGasBomb", 0, loc("Old Limburger"), 3*placeholder}, |
11015 | 949 |
|
950 |
{amShotgun, "amShotgun", 0, loc("Shotgun"), 2*placeholder}, |
|
951 |
{amDEagle, "amDEagle", 0, loc("Desert Eagle"), 2*placeholder}, |
|
952 |
{amFlamethrower,"amFlamethrower", 0, loc("Flamethrower"), 4*placeholder}, |
|
953 |
{amSniperRifle, "amSniperRifle", 0, loc("Sniper Rifle"), 3*placeholder}, |
|
11709
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
diff
changeset
|
954 |
--{amSineGun, "amSineGun", 0, loc("Sine Gun"), 6*placeholder}, |
11015 | 955 |
{amIceGun, "amIceGun", 0, loc("Freezer"), 15*placeholder}, |
11709
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
diff
changeset
|
956 |
{amLandGun, "amLandGun", 0, loc("Land Spray"), 5*placeholder}, |
11015 | 957 |
|
958 |
{amFirePunch, "amFirePunch", 0, loc("Shoryuken"), 3*placeholder}, |
|
959 |
{amWhip, "amWhip", 0, loc("Whip"), 1*placeholder}, |
|
960 |
{amBaseballBat, "amBaseballBat", 0, loc("Baseball Bat"), 7*placeholder}, |
|
961 |
--{amKamikaze, "amKamikaze", 0, loc("Kamikaze"), 1*placeholder}, |
|
962 |
{amSeduction, "amSeduction", 0, loc("Seduction"), 1*placeholder}, |
|
963 |
{amHammer, "amHammer", 0, loc("Hammer"), 1*placeholder}, |
|
964 |
||
965 |
{amMine, "amMine", 0, loc("Mine"), 1*placeholder}, |
|
966 |
{amDynamite, "amDynamite", 0, loc("Dynamite"), 9*placeholder}, |
|
967 |
{amCake, "amCake", 0, loc("Cake"), 25*placeholder}, |
|
968 |
{amBallgun, "amBallgun", 0, loc("Ballgun"), 40*placeholder}, |
|
969 |
--{amRCPlane, "amRCPlane", 0, loc("RC Plane"), 25*placeholder}, |
|
970 |
{amSMine, "amSMine", 0, loc("Sticky Mine"), 5*placeholder}, |
|
971 |
||
972 |
--{amAirAttack, "amAirAttack", 0, loc("Air Attack"), 10*placeholder}, |
|
973 |
--{amMineStrike, "amMineStrike", 0, loc("Mine Strike"), 15*placeholder}, |
|
974 |
--{amDrillStrike, "amDrillStrike", 0, loc("Drill Strike"), 15*placeholder}, |
|
975 |
--{amNapalm, "amNapalm", 0, loc("Napalm"), 15*placeholder}, |
|
976 |
--{amPiano, "amPiano", 0, loc("Piano Strike"), 40*placeholder}, |
|
977 |
||
978 |
{amKnife, "amKnife", 0, loc("Cleaver"), 2*placeholder}, |
|
979 |
||
980 |
{amBirdy, "amBirdy", 0, loc("Birdy"), 7*placeholder} |
|
981 |
||
982 |
} |
|
983 |
||
984 |
utilArray = |
|
985 |
{ |
|
11709
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
diff
changeset
|
986 |
{amBlowTorch, "amBlowTorch", 0, loc("Blow Torch"), 4*placeholder}, |
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
diff
changeset
|
987 |
{amPickHammer, "amPickHammer", 0, loc("Pick Hammer"), 2*placeholder}, |
11015 | 988 |
--{amGirder, "amGirder", 0, loc("Girder"), 4*placeholder}, |
11709
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
diff
changeset
|
989 |
--{amRubber, "amRubber", 0, loc("Rubber"), 5*placeholder}, |
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
diff
changeset
|
990 |
{amPortalGun, "amPortalGun", 0, loc("Portable Portal Device"), 15*placeholder}, |
11015 | 991 |
|
992 |
{amRope, "amRope", 0, loc("Rope"), 7*placeholder}, |
|
993 |
{amParachute, "amParachute", 0, loc("Parachute"), 2*placeholder}, |
|
994 |
--{amTeleport, "amTeleport", 0, loc("Teleport"), 6*placeholder}, |
|
995 |
{amJetpack, "amJetpack", 0, loc("Flying Saucer"), 8*placeholder}, |
|
996 |
||
997 |
{amInvulnerable, "amInvulnerable", 0, loc("Invulnerable"), 5*placeholder}, |
|
998 |
{amLaserSight, "amLaserSight", 0, loc("Laser Sight"), 2*placeholder}, |
|
999 |
{amVampiric, "amVampiric", 0, loc("Vampirism"), 6*placeholder}, |
|
1000 |
||
1001 |
{amLowGravity, "amLowGravity", 0, loc("Low Gravity"), 4*placeholder}, |
|
1002 |
{amExtraDamage, "amExtraDamage", 0, loc("Extra Damage"), 6*placeholder}, |
|
1003 |
{amExtraTime, "amExtraTime", 0, loc("Extra Time"), 8*placeholder} |
|
1004 |
||
1005 |
--{amResurrector, "amResurrector", 0, loc("Resurrector"), 8*placeholder}, |
|
11709
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
diff
changeset
|
1006 |
--{amTardis, "amTardis", 0, loc("Time Box"), 2*placeholder}, |
11015 | 1007 |
|
1008 |
--{amSwitch, "amSwitch", 0, loc("Switch Hog"), 4*placeholder} |
|
1009 |
} |
|
1010 |
||
1011 |
---------------------------- |
|
1012 |
-- hog and map editting junk |
|
1013 |
---------------------------- |
|
1014 |
||
1015 |
local reducedSpriteIDArray = { |
|
1016 |
sprBigDigit, sprKowtow, sprBee, sprExplosion50, sprGirder |
|
1017 |
} |
|
1018 |
||
1019 |
local reducedSpriteTextArray = { |
|
1020 |
"sprBigDigit", "sprKowtow", "sprBee", "sprExplosion50", "sprGirder" |
|
1021 |
} |
|
1022 |
||
1023 |
---------------------------- |
|
1024 |
-- placement shite |
|
1025 |
---------------------------- |
|
1026 |
||
1027 |
local cGear = nil -- detects placement of girders and objects (using airattack) |
|
1028 |
local curWep = amNothing |
|
1029 |
||
1030 |
-- primary placement categories |
|
1031 |
local cIndex = 1 -- category index |
|
1032 |
local cat = { |
|
1033 |
"Girder Placement Mode", |
|
1034 |
"Rubber Placement Mode", |
|
1035 |
"Mine Placement Mode", |
|
1036 |
"Sticky Mine Placement Mode", |
|
1037 |
"Barrel Placement Mode", |
|
1038 |
"Health Crate Placement Mode", |
|
1039 |
"Weapon Crate Placement Mode", |
|
1040 |
"Utility Crate Placement Mode", |
|
1041 |
"Structure Placement Mode" |
|
1042 |
} |
|
1043 |
||
1044 |
||
1045 |
sProx = { |
|
1046 |
{loc("Girder Placement Mode"),false}, |
|
1047 |
{loc("Rubber Placement Mode"),false}, |
|
1048 |
{loc("Mine Placement Mode"),false}, |
|
1049 |
{loc("Sticky Mine Placement Mode"),false}, |
|
1050 |
{loc("Barrel Placement Mode"),false}, |
|
1051 |
{loc("Health Crate Placement Mode"),false}, |
|
1052 |
{loc("Weapon Crate Placement Mode"),false}, |
|
1053 |
{loc("Utility Crate Placement Mode"),false}, |
|
1054 |
{loc("Structure Placement Mode"),false}, |
|
1055 |
{loc("Teleportation Mode"),false} |
|
1056 |
} |
|
1057 |
||
1058 |
||
1059 |
local pMode = {} -- pMode contains custom subsets of the main categories |
|
1060 |
local pIndex = 1 |
|
1061 |
||
1062 |
local genTimer = 0 |
|
1063 |
||
1064 |
local CGR = 1 -- current girder rotation, we actually need this as HW remembers what rotation you last used |
|
1065 |
||
1066 |
local placedX = {} |
|
1067 |
local placedY = {} |
|
1068 |
local placedSpec = {} |
|
1069 |
local placedSuperSpec = {} |
|
1070 |
local placedType = {} |
|
1071 |
local placedCount = 0 |
|
1072 |
||
1073 |
local sCirc -- circle that appears around selected gears |
|
1074 |
local sGear = nil |
|
1075 |
local closestDist |
|
1076 |
local closestGear = nil |
|
1077 |
||
1078 |
local tCirc = {} -- array of circles that appear around tagged gears |
|
1079 |
||
1080 |
------------------------ |
|
1081 |
-- SOME GENERAL METHODS |
|
1082 |
------------------------ |
|
1083 |
||
1084 |
function GetDistFromGearToXY(gear, g2X, g2Y) |
|
1085 |
||
1086 |
g1X, g1Y = GetGearPosition(gear) |
|
1087 |
q = g1X - g2X |
|
1088 |
w = g1Y - g2Y |
|
1089 |
||
1090 |
return ( (q*q) + (w*w) ) |
|
1091 |
||
1092 |
end |
|
1093 |
||
1094 |
function GetDistFromXYtoXY(a, b, c, d) |
|
1095 |
q = a - c |
|
1096 |
w = b - d |
|
1097 |
return ( (q*q) + (w*w) ) |
|
1098 |
end |
|
1099 |
||
1100 |
function SelectGear(gear) |
|
1101 |
||
1102 |
d = GetDistFromGearToXY(gear, placedX[placedCount], placedY[placedCount]) |
|
1103 |
||
1104 |
if d < closestDist then |
|
1105 |
closestDist = d |
|
1106 |
closestGear = gear |
|
1107 |
end |
|
1108 |
||
1109 |
end |
|
1110 |
||
1111 |
-- essentially called when user clicks the mouse |
|
1112 |
-- with girders or an airattack |
|
1113 |
function PlaceObject(x,y) |
|
1114 |
||
1115 |
placedX[placedCount] = x |
|
1116 |
placedY[placedCount] = y |
|
1117 |
placedType[placedCount] = cat[cIndex] |
|
1118 |
placedSpec[placedCount] = pMode[pIndex] |
|
1119 |
||
1120 |
if (clanUsedExtraTime[GetHogClan(CurrentHedgehog)] == true) and (cat[cIndex] == "Utility Crate Placement Mode") and (utilArray[pIndex][1] == amExtraTime) then |
|
11711
bfbf6dc83176
Construction Mode: Actually, the extra time limit is about buying
Wuzzy <almikes@aol.com>
parents:
11710
diff
changeset
|
1121 |
AddCaption(loc("You may only buy 1 Extra Time per turn."),0xffba00ff,capgrpVolume) |
11015 | 1122 |
PlaySound(sndDenied) |
1123 |
elseif (clanCratesSpawned[GetHogClan(CurrentHedgehog)] > 4) and ( (cat[cIndex] == "Health Crate Placement Mode") or (cat[cIndex] == "Utility Crate Placement Mode") or (cat[cIndex] == "Weapon Crate Placement Mode") ) then |
|
1124 |
AddCaption(loc("You may only spawn 5 crates per turn."),0xffba00ff,capgrpVolume) |
|
1125 |
PlaySound(sndDenied) |
|
1126 |
elseif (XYisInRect(x,y, clanBoundsSX[GetHogClan(CurrentHedgehog)],clanBoundsSY[GetHogClan(CurrentHedgehog)],clanBoundsEX[GetHogClan(CurrentHedgehog)],clanBoundsEY[GetHogClan(CurrentHedgehog)]) == true) |
|
1127 |
and (clanPower[GetHogClan(CurrentHedgehog)] >= placedExpense) |
|
1128 |
then |
|
1129 |
||
1130 |
||
1131 |
||
1132 |
if cat[cIndex] == "Girder Placement Mode" then |
|
1133 |
PlaceGirder(x, y, CGR) |
|
1134 |
placedSpec[placedCount] = CGR |
|
1135 |
elseif cat[cIndex] == "Rubber Placement Mode" then |
|
1136 |
PlaceSprite(x,y, sprAmRubber, CGR, nil, nil, nil, nil, lfBouncy) |
|
1137 |
placedSpec[placedCount] = CGR |
|
1138 |
elseif cat[cIndex] == "Target Placement Mode" then |
|
1139 |
gear = AddGear(x, y, gtTarget, 0, 0, 0, 0) |
|
1140 |
elseif cat[cIndex] == "Cleaver Placement Mode" then |
|
1141 |
gear = AddGear(x, y, gtKnife, 0, 0, 0, 0) |
|
1142 |
elseif cat[cIndex] == "Health Crate Placement Mode" then |
|
1143 |
gear = SpawnHealthCrate(x,y) |
|
1144 |
SetHealth(gear, pMode[pIndex]) |
|
1145 |
setGearValue(gear,"caseType","med") |
|
1146 |
clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1 |
|
1147 |
elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
|
1148 |
gear = SpawnAmmoCrate(x, y, atkArray[pIndex][1]) |
|
1149 |
placedSpec[placedCount] = atkArray[pIndex][2] |
|
1150 |
setGearValue(gear,"caseType","ammo") |
|
1151 |
setGearValue(gear,"contents",atkArray[pIndex][2]) |
|
1152 |
clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1 |
|
1153 |
elseif cat[cIndex] == "Utility Crate Placement Mode" then |
|
1154 |
gear = SpawnUtilityCrate(x, y, utilArray[pIndex][1]) |
|
1155 |
placedSpec[placedCount] = utilArray[pIndex][2] |
|
1156 |
setGearValue(gear,"caseType","util") |
|
1157 |
setGearValue(gear,"contents",utilArray[pIndex][2]) |
|
1158 |
if utilArray[pIndex][1] == amExtraTime then |
|
1159 |
clanUsedExtraTime[GetHogClan(CurrentHedgehog)] = true |
|
1160 |
end |
|
1161 |
clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1 |
|
1162 |
elseif cat[cIndex] == "Barrel Placement Mode" then |
|
1163 |
gear = AddGear(x, y, gtExplosives, 0, 0, 0, 0) |
|
1164 |
SetHealth(gear, pMode[pIndex]) |
|
1165 |
elseif cat[cIndex] == "Mine Placement Mode" then |
|
1166 |
gear = AddGear(x, y, gtMine, 0, 0, 0, 0) |
|
1167 |
SetTimer(gear, pMode[pIndex]) |
|
1168 |
elseif cat[cIndex] == "Sticky Mine Placement Mode" then |
|
1169 |
gear = AddGear(x, y, gtSMine, 0, 0, 0, 0) |
|
1170 |
elseif cat[cIndex] == "Advanced Repositioning Mode" then |
|
1171 |
||
1172 |
if pMode[pIndex] == "Selection Mode" then |
|
1173 |
closestDist = 999999999 |
|
1174 |
closestGear = nil -- just in case |
|
1175 |
sGear = nil |
|
1176 |
runOnGears(SelectGear) |
|
1177 |
sGear = closestGear |
|
1178 |
closestGear = nil |
|
1179 |
elseif pMode[pIndex] == "Placement Mode" then |
|
1180 |
if sGear ~= nil then |
|
1181 |
SetGearPosition(sGear, x, y) |
|
1182 |
end |
|
1183 |
end |
|
1184 |
||
1185 |
elseif cat[cIndex] == "Tagging Mode" then |
|
1186 |
||
1187 |
closestDist = 999999999 |
|
1188 |
closestGear = nil |
|
1189 |
sGear = nil |
|
1190 |
runOnGears(SelectGear) |
|
1191 |
||
1192 |
||
1193 |
if closestGear ~= nil then |
|
1194 |
||
1195 |
if getGearValue(closestGear,"tag") == nil then |
|
1196 |
||
1197 |
--if there is no tag, add a victory/failure tag and circle |
|
1198 |
setGearValue(closestGear, "tCirc",AddVisualGear(0,0,vgtCircle,0,true)) |
|
1199 |
||
1200 |
if pMode[pIndex] == "Tag Victory Mode" then |
|
1201 |
setGearValue(closestGear, "tag","victory") |
|
1202 |
SetVisualGearValues(getGearValue(closestGear,"tCirc"), 0, 0, 100, 255, 1, 10, 0, 40, 3, 0xff0000ff) |
|
1203 |
elseif pMode[pIndex] == "Tag Failure Mode" then |
|
1204 |
setGearValue(closestGear, "tag","failure") |
|
1205 |
SetVisualGearValues(getGearValue(closestGear,"tCirc"), 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x0000ffff) |
|
1206 |
end |
|
1207 |
||
1208 |
||
1209 |
else |
|
1210 |
-- remove tag and delete circ |
|
1211 |
setGearValue(closestGear, "tag", nil) |
|
1212 |
DeleteVisualGear(getGearValue(closestGear,"tCirc")) |
|
1213 |
setGearValue(closestGear, "tCirc", nil) |
|
1214 |
end |
|
1215 |
||
1216 |
end |
|
1217 |
||
1218 |
||
1219 |
elseif cat[cIndex] == "Sprite Testing Mode" then |
|
1220 |
||
1221 |
frameID = 1 |
|
1222 |
visualSprite = reducedSpriteIDArray[pIndex] |
|
1223 |
tempE = AddVisualGear(x, y, vgtStraightShot, 0, true) |
|
1224 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
|
1225 |
SetVisualGearValues(tempE, g1, g2, 0, 0, g5, frameID, g7, visualSprite, g9, g10 ) |
|
1226 |
--sprHorizonLong crashes game, so does skyL, as does flake |
|
1227 |
||
1228 |
-- reduced list of cool sprites |
|
1229 |
-- sprBigDigit, sprKnife, sprFrozenHog, sprKowtow, sprBee, sprExplosion50, sprPiano, sprChunk, sprHHTelepMask, sprSeduction, sprSwitch, sprGirder, |
|
1230 |
--sprAMAmmos, sprAMSlotKeys, sprTurnsLeft, sprExplosivesRoll + maybe some others like the health case, arrows, etc |
|
1231 |
||
1232 |
elseif cat[cIndex] == "Sprite Placement Mode" then |
|
1233 |
||
1234 |
PlaceSprite(x,y, reducedSpriteIDArray[pIndex], 1, nil, nil, nil, nil, landType) |
|
1235 |
placedSpec[placedCount] = reducedSpriteTextArray[pIndex] |
|
1236 |
placedSuperSpec[placedCount] = landType |
|
1237 |
||
1238 |
if landType == lfIce then |
|
1239 |
placedSuperSpec[placedCount] = "lfIce" |
|
1240 |
elseif landType == lfIndestructible then |
|
1241 |
placedSuperSpec[placedCount] = "lfIndestructible" |
|
1242 |
elseif landType == lfBouncy then |
|
1243 |
placedSuperSpec[placedCount] = "lfBouncy" |
|
1244 |
else |
|
1245 |
placedSuperSpec[placedCount] = "lfNormal" |
|
1246 |
end |
|
1247 |
||
1248 |
elseif cat[cIndex] == "Structure Placement Mode" then |
|
1249 |
||
1250 |
AddStruc(x,y, pMode[pIndex],GetHogClan(CurrentHedgehog)) |
|
1251 |
||
1252 |
end |
|
1253 |
||
1254 |
clanPower[GetHogClan(CurrentHedgehog)] = clanPower[GetHogClan(CurrentHedgehog)] - placedExpense |
|
1255 |
placedCount = placedCount + 1 |
|
1256 |
||
1257 |
else |
|
1258 |
if (clanPower[GetHogClan(CurrentHedgehog)] >= placedExpense) then |
|
1259 |
AddCaption(loc("Invalid Placement"),0xffba00ff,capgrpVolume) |
|
1260 |
else |
|
1261 |
AddCaption(loc("Insufficient Power"),0xffba00ff,capgrpVolume) |
|
1262 |
end |
|
1263 |
PlaySound(sndDenied) |
|
1264 |
end |
|
1265 |
||
1266 |
||
1267 |
end |
|
1268 |
||
1269 |
-- called when user changes primary selection |
|
1270 |
-- either via up/down keys |
|
1271 |
-- or selecting girder/airattack |
|
1272 |
function RedefineSubset() |
|
1273 |
||
1274 |
pIndex = 1 |
|
1275 |
pMode = {} |
|
1276 |
placedExpense = 1 |
|
1277 |
||
1278 |
if cat[cIndex] == "Girder Placement Mode" then |
|
1279 |
pIndex = CGR |
|
11712
0a33c3172e6d
Mark some forgotten Construction Mode strings for translation
Wuzzy <almikes@aol.com>
parents:
11711
diff
changeset
|
1280 |
pMode = {loc("Girder")} |
11015 | 1281 |
elseif cat[cIndex] == "Rubber Placement Mode" then |
1282 |
pIndex = CGR |
|
11712
0a33c3172e6d
Mark some forgotten Construction Mode strings for translation
Wuzzy <almikes@aol.com>
parents:
11711
diff
changeset
|
1283 |
pMode = {loc("Rubber")} |
11015 | 1284 |
placedExpense = 3 |
1285 |
elseif cat[cIndex] == "Target Placement Mode" then |
|
11712
0a33c3172e6d
Mark some forgotten Construction Mode strings for translation
Wuzzy <almikes@aol.com>
parents:
11711
diff
changeset
|
1286 |
pMode = {loc("Target")} |
11015 | 1287 |
elseif cat[cIndex] == "Cleaver Placement Mode" then |
11712
0a33c3172e6d
Mark some forgotten Construction Mode strings for translation
Wuzzy <almikes@aol.com>
parents:
11711
diff
changeset
|
1288 |
pMode = {loc("Cleaver")} |
11015 | 1289 |
elseif cat[cIndex] == "Barrel Placement Mode" then |
11713
106112bbacfa
Tweak barrel and mine defaults in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11712
diff
changeset
|
1290 |
pMode = {60} |
11015 | 1291 |
placedExpense = 10 |
1292 |
elseif cat[cIndex] == "Health Crate Placement Mode" then |
|
1293 |
pMode = {25} |
|
1294 |
placedExpense = 5 |
|
1295 |
elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
|
1296 |
for i = 1, #atkArray do |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
1297 |
pMode[i] = atkArray[i][4] |
11015 | 1298 |
end |
11708
d5d798172875
Fix crate costs in Construction Mode being all the same (fixes #15)
Wuzzy <almikes@aol.com>
parents:
11301
diff
changeset
|
1299 |
placedExpense = atkArray[pIndex][5] |
11015 | 1300 |
elseif cat[cIndex] == "Utility Crate Placement Mode" then |
1301 |
for i = 1, #utilArray do |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
1302 |
pMode[i] = utilArray[i][4] |
11015 | 1303 |
end |
11708
d5d798172875
Fix crate costs in Construction Mode being all the same (fixes #15)
Wuzzy <almikes@aol.com>
parents:
11301
diff
changeset
|
1304 |
placedExpense = utilArray[pIndex][5] |
11015 | 1305 |
elseif cat[cIndex] == "Mine Placement Mode" then |
11713
106112bbacfa
Tweak barrel and mine defaults in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11712
diff
changeset
|
1306 |
pMode = {0,1000,2000,3000,4000,5000} |
11015 | 1307 |
placedExpense = 15 |
1308 |
elseif cat[cIndex] == "Sticky Mine Placement Mode" then |
|
11712
0a33c3172e6d
Mark some forgotten Construction Mode strings for translation
Wuzzy <almikes@aol.com>
parents:
11711
diff
changeset
|
1309 |
pMode = {loc("Sticky Mine")} |
11015 | 1310 |
placedExpense = 20 |
1311 |
elseif cat[cIndex] == "Advanced Repositioning Mode" then |
|
1312 |
pMode = {"Selection Mode","Placement Mode"} |
|
1313 |
elseif cat[cIndex] == "Tagging Mode" then |
|
1314 |
pMode = {"Tag Victory Mode","Tag Failure Mode"} |
|
1315 |
elseif cat[cIndex] == "Sprite Testing Mode" or cat[cIndex] == "Sprite Placement Mode" then |
|
1316 |
for i = 1, #reducedSpriteTextArray do |
|
1317 |
pMode[i] = reducedSpriteTextArray[i] |
|
1318 |
end |
|
1319 |
placedExpense = 100 |
|
1320 |
elseif cat[cIndex] == "Structure Placement Mode" then |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
1321 |
pMode = {loc("Healing Station"), loc("Bio-Filter"), loc("Weapon Filter"), loc("Reflector Shield"), loc("Respawner"),loc("Teleportation Node"),loc("Generator"),loc("Construction Station"),loc("Support Station")} |
11015 | 1322 |
end |
1323 |
||
1324 |
||
1325 |
||
1326 |
||
1327 |
end |
|
1328 |
||
1329 |
-- called in onGameTick() |
|
1330 |
function HandleHedgeEditor() |
|
1331 |
||
1332 |
if CurrentHedgehog ~= nil then |
|
1333 |
||
1334 |
if wallsVisible == true then |
|
1335 |
HandleBorderEffects() |
|
1336 |
end |
|
1337 |
||
1338 |
if (CurrentHedgehog ~= nil) and (TurnTimeLeft ~= TurnTime) then |
|
1339 |
if (lastWep ~= GetCurAmmoType()) then |
|
1340 |
checkForSpecialWeapons() |
|
11717
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1341 |
elseif checkForSpecialWeaponsIn == 0 then |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1342 |
checkForSpecialWeapons() |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1343 |
checkForSpecialWeaponsIn = -1 |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1344 |
else |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1345 |
checkForSpecialWeaponsIn = checkForSpecialWeaponsIn - 1 |
11015 | 1346 |
end |
1347 |
end |
|
1348 |
||
1349 |
genTimer = genTimer + 1 |
|
1350 |
||
1351 |
if genTimer >= 100 then |
|
1352 |
||
1353 |
genTimer = 0 |
|
1354 |
||
1355 |
DrawTag(1) |
|
1356 |
||
1357 |
HandleStructures() |
|
1358 |
||
1359 |
curWep = GetCurAmmoType() |
|
1360 |
||
1361 |
-- change to girder mode on weapon swap |
|
1362 |
if (cIndex ~= 1) and (curWep == amGirder) then |
|
1363 |
cIndex = 1 |
|
1364 |
RedefineSubset() |
|
1365 |
elseif (cIndex ~=2) and (curWep == amRubber) then |
|
1366 |
cIndex = 2 |
|
1367 |
RedefineSubset() |
|
1368 |
-- change to generic mode if girder no longer selected |
|
1369 |
elseif (cIndex == 1) and (curWep ~= amGirder) then |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
1370 |
cIndex = 3 |
11015 | 1371 |
RedefineSubset() |
1372 |
elseif (cIndex == 2) and (curWep ~= amRubber) then |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
1373 |
cIndex = 3 |
11015 | 1374 |
RedefineSubset() |
1375 |
||
1376 |
end |
|
1377 |
||
1378 |
-- update display selection criteria |
|
1379 |
if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) or (curWep == amRubber) then |
|
1380 |
||
1381 |
---------------hooolllllyyyy fucking shit this |
|
1382 |
-- code is a broken mess now |
|
1383 |
-- it was redesigned and compromised three times |
|
1384 |
-- so now it is a mess trying to do what it was |
|
1385 |
-- never designed to do |
|
1386 |
-- needs to be rewritten badly sadface |
|
1387 |
-- this bit here catches the new 3 types of weapons |
|
1388 |
if ((sProx[cIndex][1] == loc("Structure Placement Mode") and (curWep ~= amAirAttack))) then |
|
1389 |
updatePlacementDisplay(1) |
|
1390 |
elseif (sProx[cIndex][1] == loc("Health Crate Placement Mode")) or |
|
1391 |
(sProx[cIndex][1] == loc("Weapon Crate Placement Mode")) or |
|
1392 |
(sProx[cIndex][1] == loc("Utility Crate Placement Mode")) then |
|
1393 |
if curWep ~= amNapalm then |
|
1394 |
updatePlacementDisplay(1) |
|
1395 |
end |
|
1396 |
||
1397 |
elseif (sProx[cIndex][1] == loc("Mine Placement Mode")) or |
|
1398 |
(sProx[cIndex][1] == loc("Sticky Mine Placement Mode")) or |
|
1399 |
(sProx[cIndex][1] == loc("Barrel Placement Mode")) then |
|
1400 |
if curWep ~= amDrillStrike then |
|
1401 |
updatePlacementDisplay(1) |
|
1402 |
end |
|
1403 |
||
1404 |
end |
|
1405 |
||
1406 |
--this is called when it happens that we have placement |
|
1407 |
--mode selected and we are looking at something |
|
1408 |
--we shouldn't be allowed to look at, as would be the case |
|
1409 |
--when you WERE allowed to look at it, but then maybe |
|
1410 |
--a bomb blows up the structure that was granting you |
|
1411 |
--that ability |
|
1412 |
if (sProx[cIndex][2] ~= true) then |
|
1413 |
updatePlacementDisplay(1) |
|
1414 |
else |
|
1415 |
updateCost() |
|
1416 |
end |
|
1417 |
||
1418 |
||
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
11015
diff
changeset
|
1419 |
AddCaption(loc(cat[cIndex]),0xffba00ff,capgrpMessage) |
11714
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1420 |
showModeMessage() |
11015 | 1421 |
wallsVisible = true |
1422 |
else |
|
1423 |
wallsVisible = false |
|
1424 |
end |
|
1425 |
||
1426 |
end |
|
1427 |
||
1428 |
end |
|
1429 |
||
1430 |
--update selected gear display |
|
1431 |
if (cat[cIndex] == "Advanced Repositioning Mode") and (sGear ~= nil) then |
|
1432 |
SetVisualGearValues(sCirc, GetX(sGear), GetY(sGear), 100, 255, 1, 10, 0, 300, 3, 0xff00ffff) |
|
1433 |
elseif (cat[cIndex] == "Tagging Mode") then |
|
1434 |
if (sGear ~= nil) or (closestGear ~= nil) then |
|
1435 |
SetVisualGearValues(sCirc, GetX(sGear), GetY(sGear), 0, 1, 1, 10, 0, 1, 1, 0x00000000) |
|
1436 |
closestGear = nil |
|
1437 |
sGear = nil |
|
1438 |
end |
|
1439 |
end |
|
1440 |
||
1441 |
-- some kind of target detected, tell me your story |
|
1442 |
if cGear ~= nil then |
|
1443 |
||
1444 |
x,y = GetGearTarget(cGear) |
|
1445 |
||
1446 |
if GetGearType(cGear) == gtAirAttack then |
|
1447 |
DeleteGear(cGear) |
|
1448 |
PlaceObject(x, y) |
|
1449 |
elseif GetGearType(cGear) == gtTeleport then |
|
1450 |
||
1451 |
CheckTeleport(cGear, x, y) |
|
1452 |
cGear = nil |
|
1453 |
elseif GetGearType(cGear) == gtGirder then |
|
1454 |
||
1455 |
CGR = GetState(cGear) |
|
1456 |
||
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
1457 |
PlaceObject(x, y) |
11015 | 1458 |
end |
1459 |
||
1460 |
end |
|
1461 |
||
1462 |
end |
|
1463 |
||
1464 |
--------------------------------------------------------------- |
|
1465 |
-- Cycle through selection subsets (by changing pIndex, pMode) |
|
1466 |
-- i.e health of barrels, medikits, |
|
1467 |
-- timer of mines |
|
1468 |
-- contents of crates |
|
1469 |
-- gears to reposition etc. |
|
1470 |
--------------------------------------------------------------- |
|
1471 |
||
1472 |
function updateCost() |
|
1473 |
||
1474 |
if pMode[pIndex] == loc("Healing Station") then |
|
1475 |
placedExpense = 50 |
|
1476 |
elseif pMode[pIndex] == loc("Weapon Filter") then |
|
1477 |
placedExpense = 50 |
|
1478 |
elseif pMode[pIndex] == loc("Bio-Filter") then |
|
1479 |
placedExpense = 100 |
|
1480 |
elseif pMode[pIndex] == loc("Respawner") then |
|
1481 |
placedExpense = 300 |
|
1482 |
elseif pMode[pIndex] == loc("Teleportation Node") then |
|
1483 |
placedExpense = 30 |
|
1484 |
elseif pMode[pIndex] == loc("Support Station") then |
|
1485 |
placedExpense = 50 |
|
1486 |
elseif pMode[pIndex] == loc("Construction Station") then |
|
1487 |
placedExpense = 50 |
|
1488 |
elseif pMode[pIndex] == loc("Generator") then |
|
1489 |
placedExpense = 300 |
|
1490 |
elseif pMode[pIndex] == loc("Reflector Shield") then |
|
1491 |
placedExpense = 200 |
|
1492 |
elseif pMode[pIndex] == loc("Core") then |
|
1493 |
placedExpense = 1 |
|
11708
d5d798172875
Fix crate costs in Construction Mode being all the same (fixes #15)
Wuzzy <almikes@aol.com>
parents:
11301
diff
changeset
|
1494 |
elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
11015 | 1495 |
placedExpense = atkArray[pIndex][5] |
11708
d5d798172875
Fix crate costs in Construction Mode being all the same (fixes #15)
Wuzzy <almikes@aol.com>
parents:
11301
diff
changeset
|
1496 |
elseif cat[cIndex] == "Utility Crate Placement Mode" then |
11015 | 1497 |
placedExpense = utilArray[pIndex][5] |
1498 |
end |
|
1499 |
||
1500 |
AddCaption(loc("Cost") .. ": " .. placedExpense,0xffba00ff,capgrpAmmostate) |
|
1501 |
||
1502 |
end |
|
1503 |
||
11717
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1504 |
function onTimer(key) |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1505 |
|
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1506 |
checkForSpecialWeaponsIn = 1 |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1507 |
|
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1508 |
end |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1509 |
|
11015 | 1510 |
function onLeft() |
1511 |
||
1512 |
pIndex = pIndex - 1 |
|
1513 |
if pIndex == 0 then |
|
1514 |
pIndex = #pMode |
|
1515 |
end |
|
1516 |
||
1517 |
if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) then |
|
11714
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1518 |
showModeMessage() |
11015 | 1519 |
updateCost() |
1520 |
end |
|
1521 |
||
1522 |
||
1523 |
end |
|
1524 |
||
11714
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1525 |
function showModeMessage() |
11716
c7cdd98bb1ec
Construction Mode: Fix mine timer message being shown at start
Wuzzy <almikes@aol.com>
parents:
11715
diff
changeset
|
1526 |
if CurrentHedgehog == nil then return end |
11714
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1527 |
local val = pMode[pIndex] |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1528 |
local str |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1529 |
if cat[cIndex] == "Mine Placement Mode" then |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1530 |
-- timer in seconds |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1531 |
str = string.format(loc("%d sec"), div(val, 1000)) |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1532 |
else |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1533 |
str = tostring(val) |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1534 |
end |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1535 |
AddCaption(str,0xffba00ff,capgrpMessage2) |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1536 |
end |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1537 |
|
11015 | 1538 |
function onRight() |
1539 |
||
1540 |
pIndex = pIndex + 1 |
|
1541 |
if pIndex > #pMode then |
|
1542 |
pIndex = 1 |
|
1543 |
end |
|
1544 |
||
1545 |
if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) then |
|
11714
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1546 |
showModeMessage() |
11015 | 1547 |
updateCost() |
1548 |
end |
|
1549 |
||
1550 |
end |
|
1551 |
||
1552 |
||
1553 |
function updatePlacementDisplay(pDir) |
|
1554 |
||
1555 |
foundMatch = false |
|
1556 |
while(foundMatch == false) do |
|
1557 |
cIndex = cIndex + pDir |
|
1558 |
||
1559 |
if (cIndex == 1) or (cIndex == 2) then --1 --we no longer hit girder by normal means |
|
1560 |
cIndex = #cat |
|
1561 |
elseif cIndex > #cat then |
|
1562 |
cIndex = 3 -- 2 ----we no longer hit girder by normal means |
|
1563 |
end |
|
1564 |
||
1565 |
if sProx[cIndex][2] == true then |
|
1566 |
if (GetCurAmmoType() == amNapalm) then |
|
1567 |
if (sProx[cIndex][1] == loc("Health Crate Placement Mode")) or |
|
1568 |
(sProx[cIndex][1] == loc("Weapon Crate Placement Mode")) or |
|
1569 |
(sProx[cIndex][1] == loc("Utility Crate Placement Mode")) |
|
1570 |
then |
|
1571 |
foundMatch = true |
|
1572 |
end |
|
1573 |
elseif (GetCurAmmoType() == amDrillStrike) then |
|
1574 |
if (sProx[cIndex][1] == loc("Mine Placement Mode")) or |
|
1575 |
(sProx[cIndex][1] == loc("Sticky Mine Placement Mode")) or |
|
1576 |
(sProx[cIndex][1] == loc("Barrel Placement Mode")) |
|
1577 |
then |
|
1578 |
foundMatch = true |
|
1579 |
end |
|
1580 |
elseif (GetCurAmmoType() == amAirAttack) then |
|
1581 |
if sProx[cIndex][1] == loc("Structure Placement Mode") then |
|
1582 |
foundMatch = true |
|
1583 |
end |
|
1584 |
end |
|
1585 |
end |
|
1586 |
||
1587 |
||
1588 |
if foundMatch == true then |
|
1589 |
RedefineSubset() |
|
1590 |
updateCost() |
|
1591 |
end |
|
1592 |
||
1593 |
end |
|
1594 |
||
1595 |
end |
|
1596 |
||
1597 |
--------------------------------------------------------- |
|
1598 |
-- Cycle through primary categories (by changing cIndex) |
|
1599 |
-- i.e mine, sticky mine, barrels |
|
1600 |
-- health/weapon/utility crate, placement of gears |
|
1601 |
--------------------------------------------------------- |
|
1602 |
function onUp() |
|
1603 |
||
11715
511d0f2aa9bf
Construction Mode: Disable up/down in building mode
Wuzzy <almikes@aol.com>
parents:
11714
diff
changeset
|
1604 |
if ( (curWep == amNapalm) or (curWep == amDrillStrike) ) then |
11015 | 1605 |
updatePlacementDisplay(-1) |
1606 |
end |
|
1607 |
||
1608 |
end |
|
1609 |
||
1610 |
function onDown() |
|
1611 |
||
11715
511d0f2aa9bf
Construction Mode: Disable up/down in building mode
Wuzzy <almikes@aol.com>
parents:
11714
diff
changeset
|
1612 |
if ( (curWep == amNapalm) or (curWep == amDrillStrike) ) then |
11015 | 1613 |
updatePlacementDisplay(1) |
1614 |
end |
|
1615 |
||
1616 |
end |
|
1617 |
||
1618 |
---------------------------- |
|
1619 |
-- standard event handlers |
|
1620 |
---------------------------- |
|
1621 |
||
1622 |
function onGameInit() |
|
1623 |
||
1624 |
Explosives = 0 |
|
1625 |
MinesNum = 0 |
|
1626 |
||
1627 |
EnableGameFlags(gfInfAttack) |
|
1628 |
||
1629 |
||
1630 |
RedefineSubset() |
|
1631 |
||
1632 |
end |
|
1633 |
||
1634 |
function initialSetup(gear) |
|
1635 |
||
1636 |
FindPlace(gear, false, clanBoundsSX[GetHogClan(gear)], clanBoundsEX[GetHogClan(gear)],true) |
|
1637 |
||
1638 |
-- for now, everyone should have this stuff |
|
1639 |
AddAmmo(gear, amAirAttack, 100) |
|
1640 |
AddAmmo(gear, amSwitch, 100) |
|
1641 |
AddAmmo(gear, amSkip, 100) |
|
1642 |
||
1643 |
end |
|
1644 |
||
1645 |
function onGameStart() |
|
1646 |
||
1647 |
trackTeams() |
|
1648 |
||
1649 |
ShowMission ( |
|
1650 |
loc("CONSTRUCTION MODE"), |
|
1651 |
loc("a Hedgewars mini-game"), |
|
1652 |
" " .. "|" .. |
|
1653 |
loc("Build a fortress and destroy your enemy.") .. "|" .. |
|
1654 |
loc("There are a variety of structures available to aid you.") .. "|" .. |
|
1655 |
loc("Use the air-attack weapons and the arrow keys to select structures.") .. "|" .. |
|
1656 |
" " .. "|" .. |
|
1657 |
loc("Healing Station") .. ": " .. loc("Grants nearby hogs life-regeneration.") .. "|" .. |
|
1658 |
loc("Bio-Filter") .. ": " .. loc("Aggressively removes enemy hedgehogs.") .. "|" .. |
|
1659 |
loc("Weapon Filter") .. ": " .. loc("Dematerializes weapons and equipment carried by enemy hedgehogs.") .. "|" .. |
|
1660 |
loc("Reflector Shield") .. ": " .. loc("Reflects enemy projectiles.") .. "|" .. |
|
1661 |
||
1662 |
loc("Generator") .. ": " .. loc("Generates power.") .. "|" .. |
|
1663 |
loc("Respawner") .. ": " .. loc("Resurrects dead hedgehogs.") .. "|" .. |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
11015
diff
changeset
|
1664 |
loc("Teleportation Node") .. ": " .. loc("Allows free teleportation between other nodes.") .. "|" .. |
11015 | 1665 |
loc("Construction Station") .. ": " .. loc("Allows placement of girders, rubber-bands, mines, sticky mines and barrels.") .. "|" .. |
1666 |
loc("Support Station") .. ": " .. loc("Allows the placement of weapons, utiliites, and health crates.") .. "|" .. |
|
1667 |
||
1668 |
||
1669 |
" " .. "|" .. |
|
1670 |
"", 4, 5000 |
|
1671 |
) |
|
1672 |
||
1673 |
||
1674 |
sCirc = AddVisualGear(0,0,vgtCircle,0,true) |
|
1675 |
SetVisualGearValues(sCirc, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x00000000) |
|
1676 |
||
1677 |
for i = 0, ClansCount-1 do |
|
1678 |
clanPower[i] = 500 |
|
1679 |
clanLWepIndex[i] = 1 -- for ease of use let's track this stuff |
|
1680 |
clanLUtilIndex[i] = 1 |
|
1681 |
clanLGearIndex[i] = 1 |
|
1682 |
clanUsedExtraTime[i] = false |
|
1683 |
clanCratesSpawned[i] = 0 |
|
1684 |
||
1685 |
||
1686 |
end |
|
1687 |
||
1688 |
tMapWidth = RightX - LeftX |
|
1689 |
tMapHeight = WaterLine - TopY |
|
1690 |
clanInterval = div(tMapWidth,ClansCount) |
|
1691 |
||
1692 |
for i = 1, ClansCount do |
|
1693 |
||
1694 |
clanBoundsSX[i-1] = LeftX+(clanInterval*i)-clanInterval+20 |
|
1695 |
clanBoundsSY[i-1] = TopY |
|
1696 |
clanBoundsEX[i-1] = LeftX+(clanInterval*i)-20 |
|
1697 |
clanBoundsEY[i-1] = WaterLine |
|
1698 |
||
1699 |
--top and bottom |
|
1700 |
AddWall(LeftX+(clanInterval*i)-clanInterval,TopY,clanInterval,margin,GetClanColor(i-1)) |
|
1701 |
AddWall(LeftX+(clanInterval*i)-clanInterval,WaterLine-25,clanInterval,margin,GetClanColor(i-1)) |
|
1702 |
||
1703 |
--add a wall to the left and right |
|
1704 |
AddWall(LeftX+(clanInterval*i)-clanInterval+20,TopY,margin,WaterLine,GetClanColor(i-1)) |
|
1705 |
AddWall(LeftX+(clanInterval*i)-20,TopY,margin,WaterLine,GetClanColor(i-1)) |
|
1706 |
||
1707 |
end |
|
1708 |
||
1709 |
runOnHogs(initialSetup) |
|
1710 |
||
1711 |
end |
|
1712 |
||
1713 |
||
1714 |
function onNewTurn() |
|
1715 |
||
1716 |
clanPower[GetHogClan(CurrentHedgehog)] = clanPower[GetHogClan(CurrentHedgehog)] + 50 |
|
1717 |
clanUsedExtraTime[GetHogClan(CurrentHedgehog)] = false |
|
1718 |
clanCratesSpawned[GetHogClan(CurrentHedgehog)] = 0 |
|
1719 |
||
1720 |
end |
|
1721 |
||
1722 |
function onGameTick() |
|
1723 |
HandleHedgeEditor() |
|
1724 |
end |
|
1725 |
||
1726 |
function isATrackedGear(gear) |
|
1727 |
if (GetGearType(gear) == gtHedgehog) or |
|
1728 |
(GetGearType(gear) == gtTarget) or |
|
1729 |
(GetGearType(gear) == gtCase) |
|
1730 |
then |
|
1731 |
return(true) |
|
1732 |
else |
|
1733 |
return(false) |
|
1734 |
end |
|
1735 |
end |
|
1736 |
||
1737 |
-- track hedgehogs and placement gears |
|
1738 |
function onGearAdd(gear) |
|
1739 |
||
1740 |
if GetGearType(gear) == gtHedgehog then |
|
1741 |
elseif (GetGearType(gear) == gtAirAttack) or (GetGearType(gear) == gtTeleport) or (GetGearType(gear) == gtGirder) then |
|
1742 |
cGear = gear |
|
1743 |
||
1744 |
end |
|
1745 |
||
1746 |
if isATrackedGear(gear) then |
|
1747 |
trackGear(gear) |
|
1748 |
elseif gearCanBeDeflected(gear) then |
|
1749 |
trackGear(gear) |
|
1750 |
setGearReflectionValues(gear) |
|
1751 |
end |
|
1752 |
||
1753 |
end |
|
1754 |
||
1755 |
function onGearDelete(gear) |
|
1756 |
||
1757 |
if GetGearType(gear) == gtTarget then |
|
1758 |
CheckGearForStructureLink(gear) |
|
1759 |
end |
|
1760 |
||
1761 |
if (GetGearType(gear) == gtAirAttack) or (GetGearType(gear) == gtTeleport) or (GetGearType(gear) == gtGirder) then |
|
1762 |
cGear = nil |
|
1763 |
end |
|
1764 |
||
1765 |
if (isATrackedGear(gear) or gearCanBeDeflected(gear)) then |
|
1766 |
||
1767 |
if getGearValue(gear, "tCirc") ~= nil then |
|
1768 |
DeleteVisualGear(getGearValue(gear, "tCirc")) |
|
1769 |
end |
|
1770 |
||
1771 |
trackDeletion(gear) |
|
1772 |
||
1773 |
end |
|
1774 |
||
1775 |
end |