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