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