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