author | Wuzzy <almikes@aol.com> |
Wed, 13 Apr 2016 00:17:07 +0200 | |
changeset 11716 | c7cdd98bb1ec |
parent 11715 | 511d0f2aa9bf |
child 11717 | f35139700d22 |
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}, |
|
11709
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
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:
11708
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}, |
|
11709
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
diff
changeset
|
1021 |
--{amSineGun, "amSineGun", 0, loc("Sine Gun"), 6*placeholder}, |
11015 | 1022 |
{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
|
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 |
{ |
|
11709
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
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:
11708
diff
changeset
|
1054 |
{amPickHammer, "amPickHammer", 0, loc("Pick Hammer"), 2*placeholder}, |
11015 | 1055 |
--{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
|
1056 |
--{amRubber, "amRubber", 0, loc("Rubber"), 5*placeholder}, |
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
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}, |
|
11709
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
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 |
|
11711
bfbf6dc83176
Construction Mode: Actually, the extra time limit is about buying
Wuzzy <almikes@aol.com>
parents:
11710
diff
changeset
|
1202 |
AddCaption(loc("You may only buy 1 Extra Time per turn."),0xffba00ff,capgrpVolume) |
11015 | 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 |
|
11712
0a33c3172e6d
Mark some forgotten Construction Mode strings for translation
Wuzzy <almikes@aol.com>
parents:
11711
diff
changeset
|
1367 |
pMode = {loc("Girder")} |
11015 | 1368 |
-- pCount = 1 |
1369 |
elseif cat[cIndex] == "Rubber Placement Mode" then |
|
1370 |
pIndex = CGR |
|
11712
0a33c3172e6d
Mark some forgotten Construction Mode strings for translation
Wuzzy <almikes@aol.com>
parents:
11711
diff
changeset
|
1371 |
pMode = {loc("Rubber")} |
11015 | 1372 |
placedExpense = 3 |
1373 |
-- pCount = 1??? |
|
1374 |
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
|
1375 |
pMode = {loc("Target")} |
11015 | 1376 |
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
|
1377 |
pMode = {loc("Cleaver")} |
11015 | 1378 |
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
|
1379 |
pMode = {60} |
11015 | 1380 |
placedExpense = 10 |
1381 |
elseif cat[cIndex] == "Health Crate Placement Mode" then |
|
1382 |
pMode = {25} |
|
1383 |
placedExpense = 5 |
|
1384 |
elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
|
1385 |
for i = 1, #atkArray do |
|
1386 |
pMode[i] = atkArray[i][4] -- was [2] |
|
1387 |
end |
|
11708
d5d798172875
Fix crate costs in Construction Mode being all the same (fixes #15)
Wuzzy <almikes@aol.com>
parents:
11301
diff
changeset
|
1388 |
placedExpense = atkArray[pIndex][5] |
11015 | 1389 |
elseif cat[cIndex] == "Utility Crate Placement Mode" then |
1390 |
for i = 1, #utilArray do |
|
1391 |
pMode[i] = utilArray[i][4] -- was [2] |
|
1392 |
end |
|
11708
d5d798172875
Fix crate costs in Construction Mode being all the same (fixes #15)
Wuzzy <almikes@aol.com>
parents:
11301
diff
changeset
|
1393 |
placedExpense = utilArray[pIndex][5] |
11015 | 1394 |
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
|
1395 |
pMode = {0,1000,2000,3000,4000,5000} |
11015 | 1396 |
placedExpense = 15 |
1397 |
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
|
1398 |
pMode = {loc("Sticky Mine")} |
11015 | 1399 |
--elseif cat[cIndex] == "Gear Repositioning Mode" then |
1400 |
-- for i = 1, #hhs do |
|
1401 |
-- pMode[i] = GetHogName(hhs[i]) |
|
1402 |
-- end |
|
1403 |
placedExpense = 20 |
|
1404 |
elseif cat[cIndex] == "Advanced Repositioning Mode" then |
|
1405 |
pMode = {"Selection Mode","Placement Mode"} |
|
1406 |
elseif cat[cIndex] == "Tagging Mode" then |
|
1407 |
pMode = {"Tag Victory Mode","Tag Failure Mode"} |
|
1408 |
elseif cat[cIndex] == "Sprite Testing Mode" or cat[cIndex] == "Sprite Placement Mode" then |
|
1409 |
--for i = 1, #spriteTextArray do |
|
1410 |
-- pMode[i] = spriteTextArray[i] |
|
1411 |
--end |
|
1412 |
for i = 1, #reducedSpriteTextArray do |
|
1413 |
pMode[i] = reducedSpriteTextArray[i] |
|
1414 |
end |
|
1415 |
placedExpense = 100 |
|
1416 |
elseif cat[cIndex] == "Structure Placement Mode" then |
|
1417 |
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")} |
|
1418 |
--placedExpense = 100 |
|
1419 |
end |
|
1420 |
||
1421 |
||
1422 |
||
1423 |
||
1424 |
end |
|
1425 |
||
1426 |
-- called in onGameTick() |
|
1427 |
function HandleHedgeEditor() |
|
1428 |
||
1429 |
if CurrentHedgehog ~= nil then |
|
1430 |
||
1431 |
if wallsVisible == true then |
|
1432 |
HandleBorderEffects() |
|
1433 |
end |
|
1434 |
||
1435 |
if (CurrentHedgehog ~= nil) and (TurnTimeLeft ~= TurnTime) then |
|
1436 |
if (lastWep ~= GetCurAmmoType()) then |
|
1437 |
checkForSpecialWeapons() |
|
1438 |
end |
|
1439 |
end |
|
1440 |
||
1441 |
genTimer = genTimer + 1 |
|
1442 |
||
1443 |
if genTimer >= 100 then |
|
1444 |
||
1445 |
genTimer = 0 |
|
1446 |
||
1447 |
DrawTag(1) |
|
1448 |
||
1449 |
HandleStructures() |
|
1450 |
||
1451 |
curWep = GetCurAmmoType() |
|
1452 |
||
1453 |
-- change to girder mode on weapon swap |
|
1454 |
if (cIndex ~= 1) and (curWep == amGirder) then |
|
1455 |
cIndex = 1 |
|
1456 |
RedefineSubset() |
|
1457 |
elseif (cIndex ~=2) and (curWep == amRubber) then |
|
1458 |
cIndex = 2 |
|
1459 |
RedefineSubset() |
|
1460 |
-- change to generic mode if girder no longer selected |
|
1461 |
elseif (cIndex == 1) and (curWep ~= amGirder) then |
|
1462 |
cIndex = 3 -- was 2 |
|
1463 |
RedefineSubset() |
|
1464 |
elseif (cIndex == 2) and (curWep ~= amRubber) then |
|
1465 |
cIndex = 3 --new |
|
1466 |
RedefineSubset() |
|
1467 |
||
1468 |
end |
|
1469 |
||
1470 |
-- update display selection criteria |
|
1471 |
if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) or (curWep == amRubber) then |
|
1472 |
||
1473 |
---------------hooolllllyyyy fucking shit this |
|
1474 |
-- code is a broken mess now |
|
1475 |
-- it was redesigned and compromised three times |
|
1476 |
-- so now it is a mess trying to do what it was |
|
1477 |
-- never designed to do |
|
1478 |
-- needs to be rewritten badly sadface |
|
1479 |
-- this bit here catches the new 3 types of weapons |
|
1480 |
if ((sProx[cIndex][1] == loc("Structure Placement Mode") and (curWep ~= amAirAttack))) then |
|
1481 |
updatePlacementDisplay(1) |
|
1482 |
elseif (sProx[cIndex][1] == loc("Health Crate Placement Mode")) or |
|
1483 |
(sProx[cIndex][1] == loc("Weapon Crate Placement Mode")) or |
|
1484 |
(sProx[cIndex][1] == loc("Utility Crate Placement Mode")) then |
|
1485 |
if curWep ~= amNapalm then |
|
1486 |
updatePlacementDisplay(1) |
|
1487 |
end |
|
1488 |
||
1489 |
elseif (sProx[cIndex][1] == loc("Mine Placement Mode")) or |
|
1490 |
(sProx[cIndex][1] == loc("Sticky Mine Placement Mode")) or |
|
1491 |
(sProx[cIndex][1] == loc("Barrel Placement Mode")) then |
|
1492 |
if curWep ~= amDrillStrike then |
|
1493 |
updatePlacementDisplay(1) |
|
1494 |
end |
|
1495 |
||
1496 |
end |
|
1497 |
||
1498 |
--this is called when it happens that we have placement |
|
1499 |
--mode selected and we are looking at something |
|
1500 |
--we shouldn't be allowed to look at, as would be the case |
|
1501 |
--when you WERE allowed to look at it, but then maybe |
|
1502 |
--a bomb blows up the structure that was granting you |
|
1503 |
--that ability |
|
1504 |
if (sProx[cIndex][2] ~= true) then |
|
1505 |
updatePlacementDisplay(1) |
|
1506 |
else |
|
1507 |
updateCost() |
|
1508 |
end |
|
1509 |
||
1510 |
||
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
11015
diff
changeset
|
1511 |
AddCaption(loc(cat[cIndex]),0xffba00ff,capgrpMessage) |
11714
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1512 |
showModeMessage() |
11015 | 1513 |
wallsVisible = true |
1514 |
else |
|
1515 |
wallsVisible = false |
|
1516 |
end |
|
1517 |
||
1518 |
end |
|
1519 |
||
1520 |
end |
|
1521 |
||
1522 |
--update selected gear display |
|
1523 |
if (cat[cIndex] == "Advanced Repositioning Mode") and (sGear ~= nil) then |
|
1524 |
SetVisualGearValues(sCirc, GetX(sGear), GetY(sGear), 100, 255, 1, 10, 0, 300, 3, 0xff00ffff) |
|
1525 |
elseif (cat[cIndex] == "Tagging Mode") then |
|
1526 |
if (sGear ~= nil) or (closestGear ~= nil) then |
|
1527 |
SetVisualGearValues(sCirc, GetX(sGear), GetY(sGear), 0, 1, 1, 10, 0, 1, 1, 0x00000000) |
|
1528 |
closestGear = nil |
|
1529 |
sGear = nil |
|
1530 |
end |
|
1531 |
end |
|
1532 |
||
1533 |
-- some kind of target detected, tell me your story |
|
1534 |
if cGear ~= nil then |
|
1535 |
||
1536 |
x,y = GetGearTarget(cGear) |
|
1537 |
||
1538 |
if GetGearType(cGear) == gtAirAttack then |
|
1539 |
DeleteGear(cGear) |
|
1540 |
PlaceObject(x, y) |
|
1541 |
elseif GetGearType(cGear) == gtTeleport then |
|
1542 |
||
1543 |
CheckTeleport(cGear, x, y) |
|
1544 |
cGear = nil |
|
1545 |
elseif GetGearType(cGear) == gtGirder then |
|
1546 |
||
1547 |
CGR = GetState(cGear) |
|
1548 |
||
1549 |
-- improve rectangle test based on CGR when you can be bothered |
|
1550 |
--if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then |
|
1551 |
-- AddCaption("Invalid Girder Placement",0xffba00ff,capgrpVolume) |
|
1552 |
--else |
|
1553 |
PlaceObject(x, y) |
|
1554 |
--end |
|
1555 |
||
1556 |
-- this allows the girder tool to be used like a mining laser |
|
1557 |
||
1558 |
--[[ |
|
1559 |
||
1560 |
if CGR < 4 then |
|
1561 |
AddGear(x, y, gtGrenade, 0, 0, 0, 1) |
|
1562 |
elseif CGR == 4 then |
|
1563 |
g = AddGear(x-30, y, gtGrenade, 0, 0, 0, 1) |
|
1564 |
g = AddGear(x+30, y, gtGrenade, 0, 0, 0, 1) |
|
1565 |
elseif CGR == 5 then ------- |
|
1566 |
g = AddGear(x+30, y+30, gtGrenade, 0, 0, 0, 1) |
|
1567 |
g = AddGear(x-30, y-30, gtGrenade, 0, 0, 0, 1) |
|
1568 |
elseif CGR == 6 then |
|
1569 |
g = AddGear(x, y+30, gtGrenade, 0, 0, 0, 1) |
|
1570 |
g = AddGear(x, y-30, gtGrenade, 0, 0, 0, 1) |
|
1571 |
elseif CGR == 7 then ------- |
|
1572 |
g = AddGear(x+30, y-30, gtGrenade, 0, 0, 0, 1) |
|
1573 |
g = AddGear(x-30, y+30, gtGrenade, 0, 0, 0, 1) |
|
1574 |
end |
|
1575 |
]] |
|
1576 |
end |
|
1577 |
||
1578 |
end |
|
1579 |
||
1580 |
end |
|
1581 |
||
1582 |
--------------------------------------------------------------- |
|
1583 |
-- Cycle through selection subsets (by changing pIndex, pMode) |
|
1584 |
-- i.e health of barrels, medikits, |
|
1585 |
-- timer of mines |
|
1586 |
-- contents of crates |
|
1587 |
-- gears to reposition etc. |
|
1588 |
--------------------------------------------------------------- |
|
1589 |
||
1590 |
function updateCost() |
|
1591 |
||
1592 |
if pMode[pIndex] == loc("Healing Station") then |
|
1593 |
placedExpense = 50 |
|
1594 |
elseif pMode[pIndex] == loc("Weapon Filter") then |
|
1595 |
placedExpense = 50 |
|
1596 |
elseif pMode[pIndex] == loc("Bio-Filter") then |
|
1597 |
placedExpense = 100 |
|
1598 |
elseif pMode[pIndex] == loc("Respawner") then |
|
1599 |
placedExpense = 300 |
|
1600 |
elseif pMode[pIndex] == loc("Teleportation Node") then |
|
1601 |
placedExpense = 30 |
|
1602 |
elseif pMode[pIndex] == loc("Support Station") then |
|
1603 |
placedExpense = 50 |
|
1604 |
elseif pMode[pIndex] == loc("Construction Station") then |
|
1605 |
placedExpense = 50 |
|
1606 |
elseif pMode[pIndex] == loc("Generator") then |
|
1607 |
placedExpense = 300 |
|
1608 |
elseif pMode[pIndex] == loc("Reflector Shield") then |
|
1609 |
placedExpense = 200 |
|
1610 |
elseif pMode[pIndex] == loc("Core") then |
|
1611 |
placedExpense = 1 |
|
11708
d5d798172875
Fix crate costs in Construction Mode being all the same (fixes #15)
Wuzzy <almikes@aol.com>
parents:
11301
diff
changeset
|
1612 |
elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
11015 | 1613 |
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
|
1614 |
elseif cat[cIndex] == "Utility Crate Placement Mode" then |
11015 | 1615 |
placedExpense = utilArray[pIndex][5] |
1616 |
end |
|
1617 |
||
1618 |
AddCaption(loc("Cost") .. ": " .. placedExpense,0xffba00ff,capgrpAmmostate) |
|
1619 |
||
1620 |
end |
|
1621 |
||
1622 |
function onLeft() |
|
1623 |
||
1624 |
pIndex = pIndex - 1 |
|
1625 |
if pIndex == 0 then |
|
1626 |
pIndex = #pMode |
|
1627 |
end |
|
1628 |
||
1629 |
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
|
1630 |
showModeMessage() |
11015 | 1631 |
updateCost() |
1632 |
end |
|
1633 |
||
1634 |
||
1635 |
end |
|
1636 |
||
11714
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1637 |
function showModeMessage() |
11716
c7cdd98bb1ec
Construction Mode: Fix mine timer message being shown at start
Wuzzy <almikes@aol.com>
parents:
11715
diff
changeset
|
1638 |
if CurrentHedgehog == nil then return end |
11714
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1639 |
local val = pMode[pIndex] |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1640 |
local str |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1641 |
if cat[cIndex] == "Mine Placement Mode" then |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1642 |
-- timer in seconds |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1643 |
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
|
1644 |
else |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1645 |
str = tostring(val) |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1646 |
end |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1647 |
AddCaption(str,0xffba00ff,capgrpMessage2) |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1648 |
end |
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1649 |
|
11015 | 1650 |
function onRight() |
1651 |
||
1652 |
pIndex = pIndex + 1 |
|
1653 |
if pIndex > #pMode then |
|
1654 |
pIndex = 1 |
|
1655 |
end |
|
1656 |
||
1657 |
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
|
1658 |
showModeMessage() |
11015 | 1659 |
updateCost() |
1660 |
end |
|
1661 |
||
1662 |
end |
|
1663 |
||
1664 |
||
1665 |
function updatePlacementDisplay(pDir) |
|
1666 |
||
1667 |
foundMatch = false |
|
1668 |
while(foundMatch == false) do |
|
1669 |
cIndex = cIndex + pDir |
|
1670 |
||
1671 |
if (cIndex == 1) or (cIndex == 2) then --1 --we no longer hit girder by normal means |
|
1672 |
cIndex = #cat |
|
1673 |
elseif cIndex > #cat then |
|
1674 |
cIndex = 3 -- 2 ----we no longer hit girder by normal means |
|
1675 |
end |
|
1676 |
||
1677 |
-- new way of doing things |
|
1678 |
-- sProx[cIndex][2] == true just basically means we have ACCESS to something |
|
1679 |
-- but that doesn't neccessarily mean we are in the correct content menu, anymore |
|
1680 |
-- so we need to refine this a little |
|
1681 |
if sProx[cIndex][2] == true then |
|
1682 |
if (GetCurAmmoType() == amNapalm) then |
|
1683 |
if (sProx[cIndex][1] == loc("Health Crate Placement Mode")) or |
|
1684 |
(sProx[cIndex][1] == loc("Weapon Crate Placement Mode")) or |
|
1685 |
(sProx[cIndex][1] == loc("Utility Crate Placement Mode")) |
|
1686 |
then |
|
1687 |
foundMatch = true |
|
1688 |
end |
|
1689 |
elseif (GetCurAmmoType() == amDrillStrike) then |
|
1690 |
if (sProx[cIndex][1] == loc("Mine Placement Mode")) or |
|
1691 |
(sProx[cIndex][1] == loc("Sticky Mine Placement Mode")) or |
|
1692 |
(sProx[cIndex][1] == loc("Barrel Placement Mode")) |
|
1693 |
then |
|
1694 |
foundMatch = true |
|
1695 |
end |
|
1696 |
elseif (GetCurAmmoType() == amAirAttack) then |
|
1697 |
if sProx[cIndex][1] == loc("Structure Placement Mode") then |
|
1698 |
foundMatch = true |
|
1699 |
end |
|
1700 |
end |
|
1701 |
end |
|
1702 |
||
1703 |
||
1704 |
if foundMatch == true then |
|
1705 |
--if sProx[cIndex][2] == true then |
|
1706 |
-- normal case (scrolling through) |
|
1707 |
--foundMatch = true |
|
1708 |
RedefineSubset() |
|
1709 |
updateCost() |
|
1710 |
end |
|
1711 |
||
1712 |
end |
|
1713 |
||
1714 |
end |
|
1715 |
||
1716 |
--------------------------------------------------------- |
|
1717 |
-- Cycle through primary categories (by changing cIndex) |
|
1718 |
-- i.e mine, sticky mine, barrels |
|
1719 |
-- health/weapon/utility crate, placement of gears |
|
1720 |
--------------------------------------------------------- |
|
1721 |
function onUp() |
|
1722 |
||
11715
511d0f2aa9bf
Construction Mode: Disable up/down in building mode
Wuzzy <almikes@aol.com>
parents:
11714
diff
changeset
|
1723 |
if ( (curWep == amNapalm) or (curWep == amDrillStrike) ) then |
11015 | 1724 |
updatePlacementDisplay(-1) |
1725 |
end |
|
1726 |
||
1727 |
end |
|
1728 |
||
1729 |
function onDown() |
|
1730 |
||
11715
511d0f2aa9bf
Construction Mode: Disable up/down in building mode
Wuzzy <almikes@aol.com>
parents:
11714
diff
changeset
|
1731 |
if ( (curWep == amNapalm) or (curWep == amDrillStrike) ) then |
11015 | 1732 |
updatePlacementDisplay(1) |
1733 |
end |
|
1734 |
||
1735 |
end |
|
1736 |
||
1737 |
---------------------------- |
|
1738 |
-- standard event handlers |
|
1739 |
---------------------------- |
|
1740 |
||
1741 |
function onGameInit() |
|
1742 |
||
1743 |
Explosives = 0 |
|
1744 |
MinesNum = 0 |
|
1745 |
||
1746 |
EnableGameFlags(gfInfAttack) |
|
1747 |
||
1748 |
||
1749 |
RedefineSubset() |
|
1750 |
||
1751 |
end |
|
1752 |
||
1753 |
function initialSetup(gear) |
|
1754 |
||
1755 |
FindPlace(gear, false, clanBoundsSX[GetHogClan(gear)], clanBoundsEX[GetHogClan(gear)],true) |
|
1756 |
||
1757 |
-- for now, everyone should have this stuff |
|
1758 |
AddAmmo(gear, amAirAttack, 100) |
|
1759 |
AddAmmo(gear, amSwitch, 100) |
|
1760 |
AddAmmo(gear, amSkip, 100) |
|
1761 |
||
1762 |
end |
|
1763 |
||
1764 |
function onGameStart() |
|
1765 |
||
1766 |
trackTeams() |
|
1767 |
||
1768 |
ShowMission ( |
|
1769 |
loc("CONSTRUCTION MODE"), |
|
1770 |
loc("a Hedgewars mini-game"), |
|
1771 |
" " .. "|" .. |
|
1772 |
loc("Build a fortress and destroy your enemy.") .. "|" .. |
|
1773 |
--loc("Defend your core from the enemy.") .. "|" .. |
|
1774 |
loc("There are a variety of structures available to aid you.") .. "|" .. |
|
1775 |
loc("Use the air-attack weapons and the arrow keys to select structures.") .. "|" .. |
|
1776 |
" " .. "|" .. |
|
1777 |
--loc("Core") .. ": " .. loc("Allows placement of structures.") .. "|" .. |
|
1778 |
loc("Healing Station") .. ": " .. loc("Grants nearby hogs life-regeneration.") .. "|" .. |
|
1779 |
loc("Bio-Filter") .. ": " .. loc("Aggressively removes enemy hedgehogs.") .. "|" .. |
|
1780 |
loc("Weapon Filter") .. ": " .. loc("Dematerializes weapons and equipment carried by enemy hedgehogs.") .. "|" .. |
|
1781 |
loc("Reflector Shield") .. ": " .. loc("Reflects enemy projectiles.") .. "|" .. |
|
1782 |
||
1783 |
loc("Generator") .. ": " .. loc("Generates power.") .. "|" .. |
|
1784 |
loc("Respawner") .. ": " .. loc("Resurrects dead hedgehogs.") .. "|" .. |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
11015
diff
changeset
|
1785 |
loc("Teleportation Node") .. ": " .. loc("Allows free teleportation between other nodes.") .. "|" .. |
11015 | 1786 |
loc("Construction Station") .. ": " .. loc("Allows placement of girders, rubber-bands, mines, sticky mines and barrels.") .. "|" .. |
1787 |
loc("Support Station") .. ": " .. loc("Allows the placement of weapons, utiliites, and health crates.") .. "|" .. |
|
1788 |
||
1789 |
||
1790 |
" " .. "|" .. |
|
1791 |
--" " .. "|" .. |
|
1792 |
"", 4, 5000 |
|
1793 |
) |
|
1794 |
||
1795 |
||
1796 |
sCirc = AddVisualGear(0,0,vgtCircle,0,true) |
|
1797 |
SetVisualGearValues(sCirc, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x00000000) |
|
1798 |
||
1799 |
for i = 0, ClansCount-1 do |
|
1800 |
clanPower[i] = 500 |
|
1801 |
clanLWepIndex[i] = 1 -- for ease of use let's track this stuff |
|
1802 |
clanLUtilIndex[i] = 1 |
|
1803 |
clanLGearIndex[i] = 1 |
|
1804 |
clanUsedExtraTime[i] = false |
|
1805 |
clanCratesSpawned[i] = 0 |
|
1806 |
||
1807 |
||
1808 |
end |
|
1809 |
||
1810 |
tMapWidth = RightX - LeftX |
|
1811 |
tMapHeight = WaterLine - TopY |
|
1812 |
clanInterval = div(tMapWidth,ClansCount) |
|
1813 |
||
1814 |
for i = 1, ClansCount do |
|
1815 |
||
1816 |
clanBoundsSX[i-1] = LeftX+(clanInterval*i)-clanInterval+20 |
|
1817 |
clanBoundsSY[i-1] = TopY |
|
1818 |
clanBoundsEX[i-1] = LeftX+(clanInterval*i)-20 |
|
1819 |
clanBoundsEY[i-1] = WaterLine |
|
1820 |
||
1821 |
--top and bottom |
|
1822 |
AddWall(LeftX+(clanInterval*i)-clanInterval,TopY,clanInterval,margin,GetClanColor(i-1)) |
|
1823 |
AddWall(LeftX+(clanInterval*i)-clanInterval,WaterLine-25,clanInterval,margin,GetClanColor(i-1)) |
|
1824 |
||
1825 |
--add a wall to the left and right |
|
1826 |
AddWall(LeftX+(clanInterval*i)-clanInterval+20,TopY,margin,WaterLine,GetClanColor(i-1)) |
|
1827 |
AddWall(LeftX+(clanInterval*i)-20,TopY,margin,WaterLine,GetClanColor(i-1)) |
|
1828 |
||
1829 |
end |
|
1830 |
||
1831 |
runOnHogs(initialSetup) |
|
1832 |
||
1833 |
end |
|
1834 |
||
1835 |
||
1836 |
function onNewTurn() |
|
1837 |
||
1838 |
clanPower[GetHogClan(CurrentHedgehog)] = clanPower[GetHogClan(CurrentHedgehog)] + 50 |
|
1839 |
clanUsedExtraTime[GetHogClan(CurrentHedgehog)] = false |
|
1840 |
clanCratesSpawned[GetHogClan(CurrentHedgehog)] = 0 |
|
1841 |
||
1842 |
end |
|
1843 |
||
1844 |
function onGameTick() |
|
1845 |
HandleHedgeEditor() |
|
1846 |
end |
|
1847 |
||
1848 |
function isATrackedGear(gear) |
|
1849 |
if (GetGearType(gear) == gtHedgehog) or |
|
1850 |
(GetGearType(gear) == gtTarget) or |
|
1851 |
(GetGearType(gear) == gtCase) |
|
1852 |
then |
|
1853 |
return(true) |
|
1854 |
else |
|
1855 |
return(false) |
|
1856 |
end |
|
1857 |
end |
|
1858 |
||
1859 |
-- track hedgehogs and placement gears |
|
1860 |
function onGearAdd(gear) |
|
1861 |
||
1862 |
if GetGearType(gear) == gtHedgehog then |
|
1863 |
--table.insert(hhs, gear) |
|
1864 |
elseif (GetGearType(gear) == gtAirAttack) or (GetGearType(gear) == gtTeleport) or (GetGearType(gear) == gtGirder) then |
|
1865 |
cGear = gear |
|
1866 |
||
1867 |
end |
|
1868 |
||
1869 |
if isATrackedGear(gear) then |
|
1870 |
trackGear(gear) |
|
1871 |
elseif gearCanBeDeflected(gear) then |
|
1872 |
trackGear(gear) |
|
1873 |
setGearReflectionValues(gear) |
|
1874 |
end |
|
1875 |
||
1876 |
end |
|
1877 |
||
1878 |
function onGearDelete(gear) |
|
1879 |
||
1880 |
if GetGearType(gear) == gtTarget then |
|
1881 |
CheckGearForStructureLink(gear) |
|
1882 |
end |
|
1883 |
||
1884 |
if (GetGearType(gear) == gtAirAttack) or (GetGearType(gear) == gtTeleport) or (GetGearType(gear) == gtGirder) then |
|
1885 |
cGear = nil |
|
1886 |
end |
|
1887 |
||
1888 |
if (isATrackedGear(gear) or gearCanBeDeflected(gear)) then |
|
1889 |
||
1890 |
if getGearValue(gear, "tCirc") ~= nil then |
|
1891 |
DeleteVisualGear(getGearValue(gear, "tCirc")) |
|
1892 |
end |
|
1893 |
||
1894 |
trackDeletion(gear) |
|
1895 |
||
1896 |
end |
|
1897 |
||
1898 |
end |