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