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