author | Wuzzy <Wuzzy2@mail.ru> |
Fri, 09 Feb 2018 19:58:55 +0100 | |
changeset 12946 | 1a1a514aef2e |
parent 12945 | 0e698562d76d |
child 12948 | f85a040d0350 |
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 |
||
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
181 |
-- for ease of use let's track previous selection |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
182 |
teamLStructIndex = {} |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
183 |
teamLObjectMode = {} |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
184 |
teamLCrateMode = {} |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
185 |
teamLMineIndex = {} |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
186 |
teamLWeapIndex = {} |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
187 |
teamLUtilIndex = {} |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
188 |
|
11015 | 189 |
clanUsedExtraTime = {} |
190 |
clanCratesSpawned = {} |
|
11721
8c1a30d4cbc8
Construction Mode: Fix giving round energy boost at first round
Wuzzy <almikes@aol.com>
parents:
11720
diff
changeset
|
191 |
clanFirstTurn = {} |
11015 | 192 |
|
193 |
effectTimer = 0 |
|
194 |
||
195 |
wallsVisible = false |
|
196 |
wX = {} |
|
197 |
wY = {} |
|
198 |
wWidth = {} |
|
199 |
wHeight = {} |
|
200 |
wCol = {} |
|
201 |
margin = 20 |
|
202 |
||
12836
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
203 |
clanPowerTag = nil |
11015 | 204 |
lastWep = nil |
205 |
||
11717
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
206 |
checkForSpecialWeaponsIn = -1 |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
207 |
|
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
208 |
-- Fake ammo types, for the overwritten weapons in Construction Mode |
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
209 |
amCMStructurePlacer = amAirAttack |
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
210 |
amCMCratePlacer = amNapalm |
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
211 |
amCMObjectPlacer = amDrillStrike |
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
212 |
|
11720
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
213 |
-- Config variables (script parameter) |
11721
8c1a30d4cbc8
Construction Mode: Fix giving round energy boost at first round
Wuzzy <almikes@aol.com>
parents:
11720
diff
changeset
|
214 |
conf_initialEnergy = 550 |
11720
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
215 |
conf_energyPerRound = 50 |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
216 |
conf_maxEnergy = 1000 |
12092
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
217 |
conf_cratesPerRound = 5 |
11720
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
218 |
|
12836
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
219 |
function DrawClanPowerTag() |
11015 | 220 |
|
221 |
zoomL = 1.3 |
|
222 |
||
223 |
xOffset = 40 |
|
224 |
||
12836
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
225 |
zoomL = 1.1 |
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
226 |
xOffset = 45 |
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
227 |
yOffset = 70 |
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
228 |
tCol = 0x00ff00ff |
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
229 |
tValue = clanPower[GetHogClan(CurrentHedgehog)] |
11015 | 230 |
|
12836
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
231 |
DeleteVisualGear(clanPowerTag) |
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
232 |
clanPowerTag = AddVisualGear(0, 0, vgtHealthTag, 0, false) |
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
233 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(clanPowerTag) |
11015 | 234 |
SetVisualGearValues ( |
12836
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
235 |
clanPowerTag, --id |
11015 | 236 |
-div(ScreenWidth,2) + xOffset, --xoffset |
237 |
ScreenHeight - yOffset, --yoffset |
|
238 |
0, --dx |
|
239 |
0, --dy |
|
240 |
zoomL, --zoom |
|
241 |
1, --~= 0 means align to screen |
|
242 |
g7, --frameticks |
|
243 |
tValue, --value |
|
244 |
240000, --timer |
|
245 |
tCol --GetClanColor( GetHogClan(CurrentHedgehog) ) |
|
246 |
) |
|
247 |
||
248 |
end |
|
249 |
||
250 |
function onScreenResize() |
|
251 |
||
252 |
-- redraw Tags so that their screen locations are updated |
|
253 |
if (CurrentHedgehog ~= nil) then |
|
12836
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
254 |
DrawClanPowerTag() |
11015 | 255 |
end |
256 |
||
257 |
end |
|
258 |
||
259 |
function XYisInRect(px, py, psx, psy, pex, pey) |
|
260 |
||
261 |
if (px > psx) and (px < pex) and (py > psy) and (py < pey) then |
|
262 |
return(true) |
|
263 |
else |
|
264 |
return(false) |
|
265 |
end |
|
266 |
||
267 |
end |
|
268 |
||
269 |
function AddWall(zXMin,zYMin, zWidth, zHeight, zCol) |
|
270 |
||
271 |
table.insert(wX, zXMin) |
|
272 |
table.insert(wY, zYMin) |
|
273 |
table.insert(wWidth, zWidth) |
|
274 |
table.insert(wHeight, zHeight) |
|
275 |
table.insert(wCol, zCol) |
|
276 |
||
277 |
end |
|
278 |
||
279 |
function BorderSpark(zXMin,zYMin, zWidth, zHeight, bCol) |
|
280 |
||
281 |
eX = zXMin + GetRandom(zWidth+10) |
|
282 |
eY = zYMin + GetRandom(zHeight+10) |
|
283 |
tempE = AddVisualGear(eX, eY, vgtDust, 0, false) |
|
284 |
if tempE ~= 0 then |
|
285 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
|
286 |
SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, 1, g9, bCol ) |
|
287 |
end |
|
288 |
||
289 |
end |
|
290 |
||
291 |
function HandleBorderEffects() |
|
292 |
||
293 |
effectTimer = effectTimer + 1 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
294 |
if effectTimer > 15 then |
11015 | 295 |
effectTimer = 1 |
296 |
for i = 1, #wX do |
|
297 |
BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], wCol[i]) |
|
298 |
end |
|
299 |
end |
|
300 |
||
301 |
end |
|
302 |
||
303 |
---- |
|
304 |
-- old reflecting stuff from like 3 years ago lol |
|
305 |
--- |
|
306 |
||
307 |
function gearCanBeDeflected(gear) |
|
308 |
||
309 |
if (GetGearType(gear) == gtShell) or |
|
310 |
(GetGearType(gear) == gtGrenade) or |
|
311 |
(GetGearType(gear) == gtAirBomb) or |
|
312 |
(GetGearType(gear) == gtClusterBomb) or |
|
313 |
(GetGearType(gear) == gtCluster) or |
|
314 |
(GetGearType(gear) == gtGasBomb) or |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
315 |
(GetGearType(gear) == gtMine) or |
11015 | 316 |
(GetGearType(gear) == gtMortar) or |
317 |
(GetGearType(gear) == gtHellishBomb) or |
|
318 |
(GetGearType(gear) == gtWatermelon) or |
|
319 |
(GetGearType(gear) == gtMelonPiece) or |
|
320 |
(GetGearType(gear) == gtEgg) or |
|
321 |
(GetGearType(gear) == gtDrill) or |
|
322 |
(GetGearType(gear) == gtBall) or |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
323 |
(GetGearType(gear) == gtExplosives) or |
11015 | 324 |
(GetGearType(gear) == gtFlame) or |
325 |
(GetGearType(gear) == gtPortal) or |
|
326 |
(GetGearType(gear) == gtDynamite) or |
|
327 |
(GetGearType(gear) == gtSMine) or |
|
328 |
(GetGearType(gear) == gtKnife) or |
|
329 |
(GetGearType(gear) == gtJetpack) or -- test this and birdy plz |
|
330 |
(GetGearType(gear) == gtBirdy) or -- test this and birdy plz |
|
331 |
(GetGearType(gear) == gtSnowball) or |
|
332 |
(GetGearType(gear) == gtMolotov) |
|
333 |
then |
|
334 |
return(true) |
|
335 |
else |
|
336 |
return(false) |
|
337 |
end |
|
338 |
||
339 |
end |
|
340 |
||
341 |
function getThreatDamage(gear) |
|
342 |
||
343 |
--- damage amounts for weapons |
|
344 |
if (GetGearType(gear) == gtGrenade) or |
|
345 |
(GetGearType(gear) == gtClusterBomb) or |
|
346 |
(GetGearType(gear) == gtGasBomb) or |
|
347 |
(GetGearType(gear) == gtKnife) or |
|
348 |
(GetGearType(gear) == gtEgg) or |
|
349 |
(GetGearType(gear) == gtMolotov) or |
|
350 |
(GetGearType(gear) == gtHellishBomb) or |
|
351 |
(GetGearType(gear) == gtWatermelon) or |
|
352 |
(GetGearType(gear) == gtSMine) |
|
353 |
then |
|
354 |
dmg = 30 |
|
355 |
||
356 |
elseif (GetGearType(gear) == gtMelonPiece) then |
|
357 |
dmg = 40 |
|
358 |
||
359 |
elseif (GetGearType(gear) == gtAirBomb) or |
|
360 |
(GetGearType(gear) == gtDrill) or |
|
361 |
(GetGearType(gear) == gtMine) or |
|
362 |
(GetGearType(gear) == gtCluster) then |
|
363 |
dmg = 20 |
|
364 |
||
365 |
elseif (GetGearType(gear) == gtFlame) or |
|
366 |
(GetGearType(gear) == gtPortal) or |
|
367 |
(GetGearType(gear) == gtDynamite) |
|
368 |
then |
|
369 |
dmg = 0 |
|
370 |
||
371 |
elseif (GetGearType(gear) == gtBall) then |
|
372 |
dmg = 1 |
|
373 |
||
374 |
else --normal shell, snowball etc |
|
375 |
dmg = 65 |
|
376 |
end |
|
377 |
||
378 |
return(dmg) |
|
379 |
||
380 |
end |
|
381 |
||
382 |
function setGearReflectionValues(gear) |
|
383 |
||
384 |
dmg = getThreatDamage(gear) |
|
385 |
setGearValue(gear,"damage",dmg) |
|
386 |
setGearValue(gear,"deflects",0) |
|
387 |
||
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
388 |
if (CurrentHedgehog ~= nil) then |
11015 | 389 |
setGearValue(gear,"owner",GetHogClan(CurrentHedgehog)) -- NEW NEEDS CHANGE? |
390 |
else |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
391 |
setGearValue(gear,"owner",10) |
11015 | 392 |
end |
393 |
||
394 |
end |
|
395 |
||
396 |
function AddStruc(pX,pY, pType, pClan) |
|
397 |
||
398 |
sUID = sUID + 1 |
|
399 |
||
400 |
tempG = AddGear(0, 0, gtTarget, 0, 0, 0, 0) |
|
401 |
SetGearPosition(tempG, pX, pY) |
|
402 |
setGearValue(tempG, "sUID", sUID) |
|
403 |
||
404 |
tempCirc = AddVisualGear(0,0,vgtCircle,0,true) |
|
405 |
||
406 |
SetVisualGearValues(tempCirc, 0, 0, 100, 255, 1, 100, 0, 500, 1, 0xFFFFFF00) |
|
407 |
||
408 |
table.insert(strucID, sUID) |
|
409 |
table.insert(strucType, pType) |
|
410 |
table.insert(strucGear,tempG) |
|
411 |
table.insert(strucClan,pClan) |
|
412 |
table.insert(strucCost,2) |
|
413 |
||
414 |
frameID = 0 |
|
415 |
visualSprite = sprTarget |
|
416 |
madness = AddVisualGear(GetX(tempG), GetY(tempG), vgtStraightShot, 1, true,1) |
|
417 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(madness) --g9 |
|
418 |
||
419 |
||
420 |
if pType == loc("Reflector Shield") then |
|
421 |
table.insert(strucHealth,255) |
|
422 |
||
423 |
else |
|
424 |
table.insert(strucHealth,1) |
|
425 |
end |
|
426 |
||
427 |
table.insert(strucCirc,tempCirc) |
|
428 |
||
429 |
table.insert(strucCircType, 1) |
|
430 |
if pType == loc("Bio-Filter") then |
|
431 |
table.insert(strucCircCol,colorRed) |
|
432 |
table.insert(strucCircRadius,1000) |
|
433 |
frameID = 7 |
|
434 |
elseif pType == loc("Healing Station") then |
|
435 |
table.insert(strucCircCol,0xFF00FF00) |
|
436 |
table.insert(strucCircRadius,500) |
|
437 |
frameID = 3 |
|
438 |
elseif pType == loc("Respawner") then |
|
439 |
table.insert(strucCircCol,0xFF00FF00) |
|
440 |
table.insert(strucCircRadius,75) |
|
441 |
runOnHogs(EnableHogResurrectionForThisClan) |
|
442 |
frameID = 1 |
|
443 |
elseif pType == loc("Teleportation Node") then |
|
444 |
table.insert(strucCircCol,0x0000FFFF) |
|
445 |
table.insert(strucCircRadius,350) |
|
446 |
frameID = 6 |
|
447 |
elseif pType == loc("Generator") then |
|
448 |
table.insert(strucCircCol,0xFFFF00FF) |
|
449 |
table.insert(strucCircRadius,75) |
|
450 |
setGearValue(tempG, "power", 0) |
|
451 |
frameID = 2 |
|
452 |
elseif pType == loc("Support Station") then |
|
453 |
table.insert(strucCircCol,0xFFFF00FF) |
|
454 |
table.insert(strucCircRadius,500) |
|
455 |
frameID = 4 |
|
456 |
elseif pType == loc("Construction Station") then |
|
457 |
table.insert(strucCircCol,0xFFFFFFFF) |
|
458 |
table.insert(strucCircRadius,500) |
|
459 |
frameID = 8 |
|
460 |
elseif pType == loc("Reflector Shield") then |
|
461 |
table.insert(strucCircCol,0xffae00ff) |
|
462 |
table.insert(strucCircRadius,750) |
|
463 |
frameID = 9 |
|
464 |
elseif pType == loc("Weapon Filter") then |
|
465 |
table.insert(strucCircCol,0xa800ffff) |
|
466 |
table.insert(strucCircRadius,750) |
|
467 |
frameID = 5 |
|
468 |
end |
|
469 |
||
470 |
||
471 |
SetVisualGearValues(madness, g1, g2, 0, 0, g5, frameID, g7, visualSprite, g9, g10 ) |
|
472 |
SetState(tempG, bor(GetState(tempG),gstInvisible) ) |
|
473 |
table.insert(strucAltDisplay, madness) |
|
474 |
||
475 |
end |
|
476 |
||
477 |
-- this is basically onStructureDelete |
|
478 |
-- we may need to expand it for non-gear structures later |
|
479 |
function CheckGearForStructureLink(gear) |
|
480 |
||
481 |
respawnerDestroyed = false |
|
482 |
||
483 |
for i = 1, #strucID do |
|
484 |
if strucID[i] == getGearValue(gear,"sUID") then |
|
485 |
||
486 |
if strucType[i] == loc("Respawner") then |
|
487 |
respawnerDestroyed = true |
|
488 |
end |
|
489 |
||
490 |
table.remove(strucID,i) |
|
491 |
table.remove(strucGear,i) |
|
492 |
table.remove(strucClan,i) |
|
493 |
table.remove(strucType,i) |
|
494 |
table.remove(strucCost,i) |
|
495 |
table.remove(strucHealth,i) |
|
496 |
||
497 |
DeleteVisualGear(strucCirc[i]) |
|
498 |
table.remove(strucCirc,i) |
|
499 |
||
500 |
table.remove(strucCircCol,i) |
|
501 |
table.remove(strucCircRadius,i) |
|
502 |
table.remove(strucCircType,i) |
|
503 |
||
504 |
if strucAltDisplay[i] ~= 1 then |
|
505 |
DeleteVisualGear(strucAltDisplay[i]) |
|
506 |
end |
|
507 |
table.remove(strucAltDisplay,i) |
|
508 |
||
509 |
end |
|
510 |
end |
|
511 |
||
512 |
if respawnerDestroyed == true then |
|
513 |
runOnHogs(RecalibrateRespawn) |
|
514 |
end |
|
515 |
||
516 |
end |
|
517 |
||
518 |
-- called when we add a new respawner |
|
519 |
function EnableHogResurrectionForThisClan(gear) |
|
520 |
if GetHogClan(gear) == GetHogClan(CurrentHedgehog) then |
|
521 |
SetEffect(gear, heResurrectable, 1) |
|
522 |
end |
|
523 |
end |
|
524 |
||
525 |
-- this is called when a respawner blows up |
|
526 |
function RecalibrateRespawn(gear) |
|
527 |
||
528 |
respawnerList = {} |
|
529 |
for i = 1, #strucID do |
|
530 |
if (strucType[i] == loc("Respawner")) and (strucClan[i] == GetHogClan(gear)) then |
|
531 |
table.insert(respawnerList, i) |
|
532 |
end |
|
533 |
end |
|
534 |
||
535 |
if #respawnerList >= 1 then |
|
536 |
SetEffect(gear, heResurrectable, 1) |
|
537 |
else |
|
538 |
SetEffect(gear, heResurrectable, 0) |
|
539 |
end |
|
540 |
||
541 |
end |
|
542 |
||
543 |
--resposition dead hogs at a respawner if they own one |
|
544 |
function FindRespawner(gear) |
|
545 |
||
546 |
respawnerList = {} |
|
547 |
for i = 1, #strucID do |
|
548 |
if (strucType[i] == loc("Respawner")) and (strucClan[i] == GetHogClan(gear)) then |
|
549 |
table.insert(respawnerList, i) |
|
550 |
end |
|
551 |
end |
|
552 |
||
553 |
if #respawnerList >= 1 then |
|
554 |
i = GetRandom(#respawnerList)+1 |
|
555 |
SetGearPosition(gear,GetX(strucGear[respawnerList[i]]),GetY(strucGear[respawnerList[i]])-25) |
|
556 |
AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
|
557 |
else -- (this should never happen, but just in case) |
|
558 |
SetEffect(gear, heResurrectable, 0) |
|
559 |
DeleteGear(gear) |
|
560 |
end |
|
561 |
||
562 |
end |
|
563 |
||
564 |
function onGearResurrect(gear) |
|
565 |
AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
|
566 |
FindRespawner(gear) |
|
567 |
end |
|
568 |
||
569 |
||
570 |
function CheckTeleport(gear, tX, tY) |
|
571 |
||
572 |
teleportOriginSuccessful = false |
|
573 |
teleportDestinationSuccessful = false |
|
574 |
||
575 |
for i = 1, #strucID do |
|
576 |
||
577 |
if (strucType[i] == loc("Teleportation Node")) and (strucClan[i] == GetHogClan(CurrentHedgehog)) then |
|
578 |
||
579 |
dist = GetDistFromGearToXY(CurrentHedgehog,GetX(strucGear[i]), GetY(strucGear[i])) |
|
580 |
if strucCircType[i] == 0 then |
|
581 |
NR = strucCircRadius[i] |
|
582 |
else |
|
583 |
NR = (48/100*strucCircRadius[i])/2 |
|
584 |
end |
|
585 |
if dist <= NR*NR then |
|
586 |
teleportOriginSuccessful = true |
|
587 |
end |
|
588 |
||
589 |
dist = GetDistFromXYtoXY(tX,tY,GetX(strucGear[i]), GetY(strucGear[i])) |
|
590 |
if strucCircType[i] == 0 then |
|
591 |
NR = strucCircRadius[i] |
|
592 |
else |
|
593 |
NR = (48/100*strucCircRadius[i])/2 |
|
594 |
end |
|
595 |
if dist <= NR*NR then |
|
596 |
teleportDestinationSuccessful = true |
|
597 |
end |
|
598 |
||
599 |
end |
|
600 |
||
601 |
||
602 |
end |
|
603 |
||
604 |
if ((teleportDestinationSuccessful == false) or (teleportOriginSuccessful == false)) then |
|
605 |
AddCaption(loc("Teleport Unsuccessful. Please teleport within a clan teleporter's sphere of influence.")) |
|
606 |
SetGearTarget(gear, GetX(CurrentHedgehog), GetY(CurrentHedgehog)) |
|
607 |
end |
|
608 |
||
609 |
end |
|
610 |
||
611 |
--Check for proximity of gears to structures, and make structures behave accordingly |
|
612 |
function CheckProximity(gear) |
|
613 |
||
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
614 |
dist = GetDistFromGearToXY(gear, GetX(strucGear[tempID]), GetY(strucGear[tempID])) |
12682
b7fd7ab8ddf9
Construction Mode: Fix Lua error spam when using time box with filters on map
Wuzzy <almikes@aol.com>
parents:
12397
diff
changeset
|
615 |
if not dist then |
b7fd7ab8ddf9
Construction Mode: Fix Lua error spam when using time box with filters on map
Wuzzy <almikes@aol.com>
parents:
12397
diff
changeset
|
616 |
return |
b7fd7ab8ddf9
Construction Mode: Fix Lua error spam when using time box with filters on map
Wuzzy <almikes@aol.com>
parents:
12397
diff
changeset
|
617 |
end |
11015 | 618 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
619 |
-- 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
|
620 |
if strucCircType[tempID] == 0 then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
621 |
NR = strucCircRadius[tempID] |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
622 |
else |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
623 |
NR = (48/100*strucCircRadius[tempID])/2 |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
624 |
end |
11015 | 625 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
626 |
-- we're in business |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
627 |
if dist <= NR*NR then |
11015 | 628 |
|
629 |
||
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
630 |
-- heal clan hogs |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
631 |
if strucType[tempID] == loc("Healing Station") then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
632 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
633 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
634 |
if GetHogClan(gear) == strucClan[tempID] then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
635 |
|
12940
39b7b3ed619e
Add healing visual effect + heal msg in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
12836
diff
changeset
|
636 |
local hogLife = GetHealth(gear) |
39b7b3ed619e
Add healing visual effect + heal msg in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
12836
diff
changeset
|
637 |
-- Heal hog by 1 HP, up to 150 HP total |
39b7b3ed619e
Add healing visual effect + heal msg in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
12836
diff
changeset
|
638 |
if hogLife < 150 then |
39b7b3ed619e
Add healing visual effect + heal msg in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
12836
diff
changeset
|
639 |
if ((hogLife + 1) % 5) == 0 then |
39b7b3ed619e
Add healing visual effect + heal msg in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
12836
diff
changeset
|
640 |
-- Health anim every 5 HP |
39b7b3ed619e
Add healing visual effect + heal msg in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
12836
diff
changeset
|
641 |
HealHog(gear, 1, false) |
39b7b3ed619e
Add healing visual effect + heal msg in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
12836
diff
changeset
|
642 |
else |
39b7b3ed619e
Add healing visual effect + heal msg in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
12836
diff
changeset
|
643 |
SetHealth(gear, hogLife+1) |
39b7b3ed619e
Add healing visual effect + heal msg in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
12836
diff
changeset
|
644 |
end |
11015 | 645 |
end |
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
646 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
647 |
-- 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
|
648 |
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
|
649 |
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
|
650 |
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
|
651 |
|
11015 | 652 |
end |
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
653 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
654 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
655 |
-- explode enemy clan hogs |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
656 |
elseif strucType[tempID] == loc("Bio-Filter") then |
11015 | 657 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
658 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
659 |
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
|
660 |
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
|
661 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
662 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
663 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
664 |
-- 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
|
665 |
elseif strucType[tempID] == loc("Weapon Filter") then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
666 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
667 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
668 |
if (GetHogClan(gear) ~= strucClan[tempID]) then |
11015 | 669 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
670 |
for wpnIndex = 1, #atkArray do |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
671 |
AddAmmo(gear, atkArray[wpnIndex][1], 0) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
672 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
673 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
674 |
for wpnIndex = 1, #utilArray do |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
675 |
AddAmmo(gear, utilArray[wpnIndex][1], 0) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
676 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
677 |
|
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
678 |
AddAmmo(gear, amCMStructurePlacer, 100) |
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
679 |
AddAmmo(gear, amSwitch, 100) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
680 |
AddAmmo(gear, amSkip, 100) |
11015 | 681 |
|
682 |
end |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
683 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
684 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
685 |
-- BOUNCE! POGO! POGO! POGO! POGO! |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
686 |
elseif strucType[tempID] == loc("Reflector Shield") then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
687 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
688 |
-- add check for whose projectile it is |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
689 |
if gearCanBeDeflected(gear) == true then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
690 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
691 |
gOwner = getGearValue(gear,"owner") |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
692 |
gDeflects = getGearValue(gear,"deflects") |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
693 |
gDmg = getGearValue(gear,"damage") |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
694 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
695 |
if gDeflects >= 3 then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
696 |
DeleteGear(gear) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
697 |
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
|
698 |
PlaySound(sndVaporize) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
699 |
elseif gOwner ~= strucClan[tempID] then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
700 |
--whether to vaporize gears or bounce them |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
701 |
if gDmg ~= 0 then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
702 |
dx, dy = GetGearVelocity(gear) |
11015 | 703 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
704 |
if (dx == 0) and (dy == 0) then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
705 |
-- static mine, explosive, etc encountered |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
706 |
-- do nothing |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
707 |
else |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
708 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
709 |
--let's bounce something! |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
710 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
711 |
dx = dx*(-1) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
712 |
dy = dy*(-1) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
713 |
SetGearVelocity(gear,dx,dy) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
714 |
setGearValue(gear,"deflects",(gDeflects+1)) |
11015 | 715 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
716 |
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
|
717 |
PlaySound(sndExplosion) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
718 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
719 |
strucHealth[tempID] = strucHealth[tempID] - gDmg |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
720 |
strucCircCol[tempID] = strucCircCol[tempID] - gDmg |
11015 | 721 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
722 |
if strucHealth[tempID] <= 0 then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
723 |
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
|
724 |
DeleteGear(strucGear[tempID]) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
725 |
PlaySound(sndExplosion) |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
726 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
727 |
|
11015 | 728 |
end |
729 |
||
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
730 |
else |
11015 | 731 |
DeleteGear(gear) |
732 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) |
|
733 |
PlaySound(sndVaporize) |
|
734 |
end |
|
735 |
end |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
736 |
end |
11015 | 737 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
738 |
--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
|
739 |
elseif strucType[tempID] == loc("Teleportation Node") then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
740 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
741 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
742 |
if GetHogClan(gear) == strucClan[tempID] then |
11015 | 743 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
744 |
for i = 1, #sProx do |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
745 |
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
|
746 |
sProx[i][2] = true |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
747 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
748 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
749 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
750 |
end |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
751 |
end |
11015 | 752 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
753 |
-- mark as within range of construction station |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
754 |
-- 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
|
755 |
-- for girders, mines, sticky mines and barrels |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
756 |
elseif strucType[tempID] == loc("Construction Station") then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
757 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
758 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
759 |
if GetHogClan(gear) == strucClan[tempID] then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
760 |
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
|
761 |
|
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
762 |
for i = 1, #sProx do |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
763 |
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
|
764 |
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
|
765 |
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
|
766 |
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
|
767 |
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
|
768 |
then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
769 |
sProx[i][2] = true |
11015 | 770 |
end |
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
771 |
end |
11015 | 772 |
|
773 |
||
774 |
end |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
775 |
end |
11015 | 776 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
777 |
-- mark as within stupport station range |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
778 |
-- 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
|
779 |
-- for weapon, utility, and med crates |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
780 |
elseif strucType[tempID] == loc("Support Station") then |
11015 | 781 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
782 |
if GetGearType(gear) == gtHedgehog then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
783 |
if GetHogClan(gear) == strucClan[tempID] then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
784 |
tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) |
11015 | 785 |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
786 |
for i = 1, #sProx do |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
787 |
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
|
788 |
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
|
789 |
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
|
790 |
then |
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
791 |
sProx[i][2] = true |
11015 | 792 |
end |
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
793 |
end |
11015 | 794 |
|
795 |
||
796 |
end |
|
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
797 |
end |
11015 | 798 |
end |
799 |
||
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
800 |
end |
11015 | 801 |
|
802 |
end |
|
803 |
||
804 |
-- used to check if we need to run through all hogs or just currenthedgehog |
|
805 |
function isAStructureThatAppliesToMultipleGears(pID) |
|
806 |
if strucType[pID] == loc("Healing Station") or |
|
807 |
strucType[pID] == loc("Reflector Shield") or |
|
808 |
strucType[pID] == loc("Weapon Filter") or |
|
809 |
strucType[pID] == loc("Bio-Filter") |
|
810 |
then |
|
811 |
return(true) |
|
812 |
else |
|
813 |
return(false) |
|
814 |
end |
|
815 |
end |
|
816 |
||
817 |
function HandleStructures() |
|
818 |
||
11724
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
819 |
if GameTime % 100 == 0 then |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
820 |
for i = 1, #sProx do |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
821 |
sProx[i][2] = false |
11015 | 822 |
|
11724
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
823 |
if sProx[i][1] == loc("Structure Placement Mode") then |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
824 |
sProx[i][2] = true |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
825 |
end |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
826 |
|
11015 | 827 |
end |
828 |
end |
|
829 |
||
830 |
for i = 1, #strucID do |
|
831 |
||
11723
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
832 |
SetVisualGearValues(strucCirc[i], GetX(strucGear[i]), GetY(strucGear[i]), nil, nil, nil, nil, nil, strucCircRadius[i], nil, strucCircCol[i]) |
11015 | 833 |
|
834 |
tempID = i |
|
835 |
||
11723
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
836 |
SetVisualGearValues(strucAltDisplay[i], GetX(strucGear[i]), GetY(strucGear[i]), 0, 0, nil, nil, 800000, sprTarget) |
11015 | 837 |
|
11723
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
838 |
if GameTime % 100 == 0 then |
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
839 |
-- 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
|
840 |
if isAStructureThatAppliesToMultipleGears(i) then |
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
841 |
runOnGears(CheckProximity) |
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
842 |
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
|
843 |
if CurrentHedgehog ~= nil then |
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
844 |
CheckProximity(CurrentHedgehog) |
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
845 |
end |
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
846 |
end |
11015 | 847 |
|
11723
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
848 |
if strucType[i] == loc("Generator") then |
11732 | 849 |
|
11723
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
850 |
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
|
851 |
if z == strucClan[i] then |
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
852 |
increaseGearValue(strucGear[i],"power") |
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
853 |
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
|
854 |
setGearValue(strucGear[i],"power",0) |
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
855 |
clanPower[z] = clanPower[z] + 1 |
11728
373150be0356
Construction Mode: Sanity-check numbers from script parameter
Wuzzy <almikes@aol.com>
parents:
11727
diff
changeset
|
856 |
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
|
857 |
clanPower[z] = conf_maxEnergy |
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
858 |
end |
11015 | 859 |
end |
11732 | 860 |
|
11015 | 861 |
end |
862 |
end |
|
863 |
end |
|
864 |
||
865 |
end |
|
866 |
||
867 |
end |
|
868 |
||
869 |
||
870 |
||
871 |
-- this is kinda messy and gross (even more than usual), fix it up at some point |
|
872 |
-- it just assumes that if you have access to girders, it works for rubbers |
|
873 |
-- 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
|
874 |
if GameTime % 100 == 0 and CurrentHedgehog ~= nil then |
11724
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
875 |
anyUIProx = false |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
876 |
for i = 1, #sProx do |
11015 | 877 |
|
11724
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
878 |
if sProx[i][1] == loc("Girder Placement Mode") then |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
879 |
if sProx[i][2] == true then |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
880 |
AddAmmo(CurrentHedgehog, amGirder, 100) |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
881 |
AddAmmo(CurrentHedgehog, amRubber, 100) |
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
882 |
AddAmmo(CurrentHedgehog, amCMObjectPlacer, 100) |
11724
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
883 |
else |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
884 |
AddAmmo(CurrentHedgehog, amGirder, 0) |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
885 |
AddAmmo(CurrentHedgehog, amRubber, 0) |
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
886 |
AddAmmo(CurrentHedgehog, amCMObjectPlacer, 0) -- new |
11724
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
887 |
end |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
888 |
elseif sProx[i][1] == loc("Teleportation Mode") then |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
889 |
if sProx[i][2] == true then |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
890 |
AddAmmo(CurrentHedgehog, amTeleport, 100) |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
891 |
else |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
892 |
AddAmmo(CurrentHedgehog, amTeleport, 0) |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
893 |
end |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
894 |
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
|
895 |
-- this is new stuff |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
896 |
if sProx[i][2] == true then |
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
897 |
AddAmmo(CurrentHedgehog, amCMCratePlacer, 100) |
11724
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
898 |
else |
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
899 |
AddAmmo(CurrentHedgehog, amCMCratePlacer, 0) |
11724
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
900 |
end |
11015 | 901 |
end |
11724
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
902 |
|
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
903 |
if (sProx[i][2] == true) then |
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
904 |
anyUIProx = true |
11015 | 905 |
end |
11724
cf4d61123440
Construction Mode: Fix construction/support station
Wuzzy <almikes@aol.com>
parents:
11723
diff
changeset
|
906 |
|
11015 | 907 |
end |
908 |
end |
|
909 |
||
910 |
end |
|
911 |
||
912 |
||
913 |
function checkForSpecialWeapons() |
|
914 |
||
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
915 |
if (GetCurAmmoType() == amCMObjectPlacer) then |
11942
abdb24f0c2d9
Change descriptions for special Construction Mode tools
Wuzzy <almikes@aol.com>
parents:
11881
diff
changeset
|
916 |
AddCaption(loc("Object Placer"),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpAmmoinfo) |
11015 | 917 |
end |
918 |
||
919 |
lastWep = GetCurAmmoType() |
|
920 |
||
921 |
end |
|
922 |
||
923 |
---------------------------------------------------------- |
|
924 |
-- EXCERPTS OF ADAPTED HEDGE_EDITOR CODE FOLLOWS |
|
925 |
---------------------------------------------------------- |
|
926 |
-- experimental crap |
|
927 |
||
928 |
local landType = 0 |
|
929 |
----------------------------------------- |
|
930 |
-- tracking vars for save slash load purposes |
|
931 |
----------------------------------------- |
|
932 |
||
933 |
local hhs = {} |
|
934 |
||
935 |
--------------------------------- |
|
936 |
-- crates are made of this stuff |
|
937 |
--------------------------------- |
|
938 |
placeholder = 20 |
|
939 |
atkArray = |
|
940 |
{ |
|
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
941 |
{amBazooka, "amBazooka", 0, 2*placeholder}, |
11015 | 942 |
--{amBee, "amBee", 0, loc("Homing Bee"), 4*placeholder}, |
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
943 |
{amMortar, "amMortar", 0, 1*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
944 |
{amDrill, "amDrill", 0, 3*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
945 |
{amSnowball, "amSnowball", 0, 3*placeholder}, |
11015 | 946 |
|
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
947 |
{amGrenade, "amGrenade", 0, 2*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
948 |
{amClusterBomb, "amClusterBomb", 0, 3*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
949 |
{amWatermelon, "amWatermelon", 0, 25*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
950 |
{amHellishBomb, "amHellishBomb", 0, 25*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
951 |
{amMolotov, "amMolotov", 0, 3*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
952 |
{amGasBomb, "amGasBomb", 0, 3*placeholder}, |
11015 | 953 |
|
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
954 |
{amShotgun, "amShotgun", 0, 2*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
955 |
{amDEagle, "amDEagle", 0, 2*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
956 |
{amSniperRifle, "amSniperRifle", 0, 3*placeholder}, |
11709
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
diff
changeset
|
957 |
--{amSineGun, "amSineGun", 0, loc("Sine Gun"), 6*placeholder}, |
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
958 |
{amFlamethrower,"amFlamethrower", 0, 4*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
959 |
{amIceGun, "amIceGun", 0, 15*placeholder}, |
11015 | 960 |
|
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
961 |
{amFirePunch, "amFirePunch", 0, 3*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
962 |
{amWhip, "amWhip", 0, 1*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
963 |
{amBaseballBat, "amBaseballBat", 0, 7*placeholder}, |
11015 | 964 |
--{amKamikaze, "amKamikaze", 0, loc("Kamikaze"), 1*placeholder}, |
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
965 |
{amSeduction, "amSeduction", 0, 1*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
966 |
{amHammer, "amHammer", 0, 1*placeholder}, |
11015 | 967 |
|
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
968 |
{amMine, "amMine", 0, 1*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
969 |
{amDynamite, "amDynamite", 0, 9*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
970 |
{amCake, "amCake", 0, 25*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
971 |
{amBallgun, "amBallgun", 0, 40*placeholder}, |
11015 | 972 |
--{amRCPlane, "amRCPlane", 0, loc("RC Plane"), 25*placeholder}, |
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
973 |
{amSMine, "amSMine", 0, 5*placeholder}, |
11015 | 974 |
|
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
975 |
-- Careful! Some airborne attacks are overwritten by the special Construction Mode tools |
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
976 |
|
11015 | 977 |
--{amAirAttack, "amAirAttack", 0, loc("Air Attack"), 10*placeholder}, |
978 |
--{amMineStrike, "amMineStrike", 0, loc("Mine Strike"), 15*placeholder}, |
|
979 |
--{amNapalm, "amNapalm", 0, loc("Napalm"), 15*placeholder}, |
|
980 |
--{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
|
981 |
--{amDrillStrike, "amDrillStrike", 0, loc("Drill Strike"), 15*placeholder}, |
11015 | 982 |
|
12397
414bcb4ca5ee
Construction Mode: Move pick hammer and blow torch into weapon crates (game default)
Wuzzy <almikes@aol.com>
parents:
12336
diff
changeset
|
983 |
{amPickHammer, "amPickHammer", 0, 2*placeholder}, |
414bcb4ca5ee
Construction Mode: Move pick hammer and blow torch into weapon crates (game default)
Wuzzy <almikes@aol.com>
parents:
12336
diff
changeset
|
984 |
{amBlowTorch, "amBlowTorch", 0, 4*placeholder}, |
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
985 |
{amKnife, "amKnife", 0, 2*placeholder}, |
11015 | 986 |
|
12214
facbc3c6e166
Increase duck cost in Construction Mode to 40
Wuzzy <almikes@aol.com>
parents:
12207
diff
changeset
|
987 |
{amBirdy, "amBirdy", 0, 7*placeholder}, |
11015 | 988 |
|
12214
facbc3c6e166
Increase duck cost in Construction Mode to 40
Wuzzy <almikes@aol.com>
parents:
12207
diff
changeset
|
989 |
{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
|
990 |
|
11015 | 991 |
} |
992 |
||
993 |
utilArray = |
|
994 |
{ |
|
995 |
--{amGirder, "amGirder", 0, loc("Girder"), 4*placeholder}, |
|
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
996 |
{amLandGun, "amLandGun", 0, 5*placeholder}, |
11709
cea5418c1af6
Construction Mode: Make weapon names match en.txt
Wuzzy <almikes@aol.com>
parents:
11708
diff
changeset
|
997 |
--{amRubber, "amRubber", 0, loc("Rubber"), 5*placeholder}, |
11015 | 998 |
|
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
999 |
{amRope, "amRope", 0, 7*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1000 |
{amParachute, "amParachute", 0, 2*placeholder}, |
11015 | 1001 |
--{amTeleport, "amTeleport", 0, loc("Teleport"), 6*placeholder}, |
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1002 |
{amJetpack, "amJetpack", 0, 8*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1003 |
{amPortalGun, "amPortalGun", 0, 15*placeholder}, |
11015 | 1004 |
|
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1005 |
{amInvulnerable, "amInvulnerable", 0, 5*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1006 |
{amLaserSight, "amLaserSight", 0, 2*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1007 |
{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
|
1008 |
--{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
|
1009 |
--{amTardis, "amTardis", 0, loc("Time Box"), 2*placeholder}, |
11015 | 1010 |
|
11759
1e2ec1be5041
Construction Mode: Reorder weapon and utility list to parrallel weapon menu order
Wuzzy <almikes@aol.com>
parents:
11758
diff
changeset
|
1011 |
--{amSwitch, "amSwitch", 0, loc("Switch Hog"), 4*placeholder} |
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1012 |
{amLowGravity, "amLowGravity", 0, 4*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1013 |
{amExtraDamage, "amExtraDamage", 0, 6*placeholder}, |
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1014 |
{amExtraTime, "amExtraTime", 0, 8*placeholder} |
11015 | 1015 |
|
1016 |
} |
|
1017 |
||
1018 |
---------------------------- |
|
1019 |
-- placement shite |
|
1020 |
---------------------------- |
|
1021 |
||
1022 |
local cGear = nil -- detects placement of girders and objects (using airattack) |
|
1023 |
local curWep = amNothing |
|
1024 |
||
1025 |
-- primary placement categories |
|
1026 |
local cIndex = 1 -- category index |
|
12945
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1027 |
local cat = { |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1028 |
"Girder Placement Mode", |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1029 |
"Rubber Placement Mode", |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1030 |
"Mine Placement Mode", |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1031 |
"Sticky Mine Placement Mode", |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1032 |
"Barrel Placement Mode", |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1033 |
"Weapon Crate Placement Mode", |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1034 |
"Utility Crate Placement Mode", |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1035 |
"Health Crate Placement Mode", |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1036 |
"Structure Placement Mode" |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1037 |
} |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1038 |
local catReverse = {} |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1039 |
for c=1, #cat do |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1040 |
catReverse[cat[c]] = c |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1041 |
end |
11015 | 1042 |
|
12945
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1043 |
sProx = { |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1044 |
{loc("Girder Placement Mode"),false}, |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1045 |
{loc("Rubber Placement Mode"),false}, |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1046 |
{loc("Mine Placement Mode"),false}, |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1047 |
{loc("Sticky Mine Placement Mode"),false}, |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1048 |
{loc("Barrel Placement Mode"),false}, |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1049 |
{loc("Weapon Crate Placement Mode"),false}, |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1050 |
{loc("Utility Crate Placement Mode"),false}, |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1051 |
{loc("Health Crate Placement Mode"),false}, |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1052 |
{loc("Structure Placement Mode"),false}, |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1053 |
{loc("Teleportation Mode"),false}, |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1054 |
} |
11015 | 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) |
|
12682
b7fd7ab8ddf9
Construction Mode: Fix Lua error spam when using time box with filters on map
Wuzzy <almikes@aol.com>
parents:
12397
diff
changeset
|
1083 |
if not g1X then |
b7fd7ab8ddf9
Construction Mode: Fix Lua error spam when using time box with filters on map
Wuzzy <almikes@aol.com>
parents:
12397
diff
changeset
|
1084 |
return nil |
b7fd7ab8ddf9
Construction Mode: Fix Lua error spam when using time box with filters on map
Wuzzy <almikes@aol.com>
parents:
12397
diff
changeset
|
1085 |
end |
11015 | 1086 |
q = g1X - g2X |
1087 |
w = g1Y - g2Y |
|
1088 |
||
1089 |
return ( (q*q) + (w*w) ) |
|
1090 |
||
1091 |
end |
|
1092 |
||
1093 |
function GetDistFromXYtoXY(a, b, c, d) |
|
1094 |
q = a - c |
|
1095 |
w = b - d |
|
1096 |
return ( (q*q) + (w*w) ) |
|
1097 |
end |
|
1098 |
||
1099 |
function SelectGear(gear) |
|
1100 |
||
1101 |
d = GetDistFromGearToXY(gear, placedX[placedCount], placedY[placedCount]) |
|
1102 |
||
1103 |
if d < closestDist then |
|
1104 |
closestDist = d |
|
1105 |
closestGear = gear |
|
1106 |
end |
|
1107 |
||
1108 |
end |
|
1109 |
||
1110 |
-- essentially called when user clicks the mouse |
|
1111 |
-- with girders or an airattack |
|
1112 |
function PlaceObject(x,y) |
|
1113 |
||
1114 |
placedX[placedCount] = x |
|
1115 |
placedY[placedCount] = y |
|
1116 |
placedType[placedCount] = cat[cIndex] |
|
1117 |
placedSpec[placedCount] = pMode[pIndex] |
|
1118 |
||
1119 |
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
|
1120 |
AddCaption(loc("You may only place 1 Extra Time crate per turn."),0xffba00ff,capgrpVolume) |
11015 | 1121 |
PlaySound(sndDenied) |
12092
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
1122 |
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
|
1123 |
AddCaption(string.format(loc("You may only place %d crates per round."), conf_cratesPerRound),0xffba00ff,capgrpVolume) |
11015 | 1124 |
PlaySound(sndDenied) |
1125 |
elseif (XYisInRect(x,y, clanBoundsSX[GetHogClan(CurrentHedgehog)],clanBoundsSY[GetHogClan(CurrentHedgehog)],clanBoundsEX[GetHogClan(CurrentHedgehog)],clanBoundsEY[GetHogClan(CurrentHedgehog)]) == true) |
|
1126 |
and (clanPower[GetHogClan(CurrentHedgehog)] >= placedExpense) |
|
1127 |
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 |
-- 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
|
1129 |
local placed = false |
11015 | 1130 |
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
|
1131 |
placed = PlaceGirder(x, y, CGR) |
11015 | 1132 |
placedSpec[placedCount] = CGR |
1133 |
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
|
1134 |
placed = PlaceRubber(x, y, CGR) |
11015 | 1135 |
placedSpec[placedCount] = CGR |
1136 |
elseif cat[cIndex] == "Health Crate Placement Mode" then |
|
1137 |
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
|
1138 |
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
|
1139 |
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
|
1140 |
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
|
1141 |
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
|
1142 |
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
|
1143 |
end |
11015 | 1144 |
elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
1145 |
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
|
1146 |
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
|
1147 |
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
|
1148 |
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
|
1149 |
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
|
1150 |
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
|
1151 |
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
|
1152 |
end |
11015 | 1153 |
elseif cat[cIndex] == "Utility Crate Placement Mode" then |
1154 |
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
|
1155 |
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
|
1156 |
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
|
1157 |
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
|
1158 |
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
|
1159 |
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
|
1160 |
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
|
1161 |
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
|
1162 |
end |
db5e12d623cc
Contruction Mode: Fix rubber being placable in land and invalid girder placement costing energy
Wuzzy <almikes@aol.com>
parents:
11982
diff
changeset
|
1163 |
clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1 |
11015 | 1164 |
end |
1165 |
elseif cat[cIndex] == "Barrel Placement Mode" then |
|
1166 |
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
|
1167 |
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
|
1168 |
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
|
1169 |
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
|
1170 |
end |
11015 | 1171 |
elseif cat[cIndex] == "Mine Placement Mode" then |
1172 |
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
|
1173 |
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
|
1174 |
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
|
1175 |
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
|
1176 |
end |
11015 | 1177 |
elseif cat[cIndex] == "Sticky Mine Placement Mode" then |
1178 |
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
|
1179 |
placed = gear ~= nil |
11015 | 1180 |
elseif cat[cIndex] == "Structure Placement Mode" then |
1181 |
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
|
1182 |
placed = true |
11015 | 1183 |
end |
1184 |
||
12091
db5e12d623cc
Contruction Mode: Fix rubber being placable in land and invalid girder placement costing energy
Wuzzy <almikes@aol.com>
parents:
11982
diff
changeset
|
1185 |
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
|
1186 |
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
|
1187 |
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
|
1188 |
else |
db5e12d623cc
Contruction Mode: Fix rubber being placable in land and invalid girder placement costing energy
Wuzzy <almikes@aol.com>
parents:
11982
diff
changeset
|
1189 |
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
|
1190 |
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
|
1191 |
end |
11015 | 1192 |
|
1193 |
else |
|
1194 |
if (clanPower[GetHogClan(CurrentHedgehog)] >= placedExpense) then |
|
1195 |
AddCaption(loc("Invalid Placement"),0xffba00ff,capgrpVolume) |
|
1196 |
else |
|
1197 |
AddCaption(loc("Insufficient Power"),0xffba00ff,capgrpVolume) |
|
1198 |
end |
|
1199 |
PlaySound(sndDenied) |
|
1200 |
end |
|
1201 |
||
1202 |
||
1203 |
end |
|
1204 |
||
1205 |
-- called when user changes primary selection |
|
1206 |
-- either via up/down keys |
|
1207 |
-- or selecting girder/airattack |
|
1208 |
function RedefineSubset() |
|
1209 |
||
1210 |
pIndex = 1 |
|
1211 |
pMode = {} |
|
1212 |
placedExpense = 1 |
|
1213 |
||
12945
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1214 |
if (CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0) then |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1215 |
return false |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1216 |
end |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1217 |
|
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1218 |
local team = GetHogTeamName(CurrentHedgehog) |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1219 |
|
11015 | 1220 |
if cat[cIndex] == "Girder Placement Mode" then |
1221 |
pIndex = CGR |
|
11712
0a33c3172e6d
Mark some forgotten Construction Mode strings for translation
Wuzzy <almikes@aol.com>
parents:
11711
diff
changeset
|
1222 |
pMode = {loc("Girder")} |
11015 | 1223 |
elseif cat[cIndex] == "Rubber Placement Mode" then |
1224 |
pIndex = CGR |
|
11712
0a33c3172e6d
Mark some forgotten Construction Mode strings for translation
Wuzzy <almikes@aol.com>
parents:
11711
diff
changeset
|
1225 |
pMode = {loc("Rubber")} |
11015 | 1226 |
placedExpense = 3 |
1227 |
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
|
1228 |
pMode = {60} |
11015 | 1229 |
placedExpense = 10 |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1230 |
teamLObjectMode[team] = cat[cIndex] |
11015 | 1231 |
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
|
1232 |
pMode = {HealthCaseAmount} |
11015 | 1233 |
placedExpense = 5 |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1234 |
teamLCrateMode[team] = cat[cIndex] |
11015 | 1235 |
elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
1236 |
for i = 1, #atkArray do |
|
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1237 |
pMode[i] = GetAmmoName(atkArray[i][1]) |
11015 | 1238 |
end |
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1239 |
placedExpense = atkArray[pIndex][4] |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1240 |
teamLCrateMode[team] = cat[cIndex] |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1241 |
pIndex = teamLWeapIndex[team] |
11015 | 1242 |
elseif cat[cIndex] == "Utility Crate Placement Mode" then |
1243 |
for i = 1, #utilArray do |
|
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1244 |
pMode[i] = GetAmmoName(utilArray[i][1]) |
11015 | 1245 |
end |
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1246 |
placedExpense = utilArray[pIndex][4] |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1247 |
teamLCrateMode[team] = cat[cIndex] |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1248 |
pIndex = teamLUtilIndex[team] |
11015 | 1249 |
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
|
1250 |
pMode = {0,1000,2000,3000,4000,5000} |
11015 | 1251 |
placedExpense = 15 |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1252 |
teamLObjectMode[team] = cat[cIndex] |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1253 |
pIndex = teamLMineIndex[team] |
11015 | 1254 |
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
|
1255 |
pMode = {loc("Sticky Mine")} |
11015 | 1256 |
placedExpense = 20 |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1257 |
teamLObjectMode[team] = cat[cIndex] |
11015 | 1258 |
elseif cat[cIndex] == "Structure Placement Mode" then |
12943
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1259 |
pMode = { |
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1260 |
loc("Support Station"), |
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1261 |
loc("Construction Station"), |
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1262 |
loc("Healing Station"), |
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1263 |
loc("Teleportation Node"), |
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1264 |
loc("Weapon Filter"), |
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1265 |
|
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1266 |
loc("Bio-Filter"), |
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1267 |
loc("Reflector Shield"), |
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1268 |
loc("Respawner"), |
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1269 |
loc("Generator"), |
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1270 |
} |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1271 |
pIndex = teamLStructIndex[team] |
11015 | 1272 |
end |
1273 |
||
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1274 |
return true |
11015 | 1275 |
end |
1276 |
||
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1277 |
-- Updates the handling of the main construction mode tools: |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1278 |
-- Structure Placer, Crate Placer, Object Placer. |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1279 |
-- This handles the internal category state, |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1280 |
-- the HUD display and the clans outline. |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1281 |
function HandleConstructionModeTools() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1282 |
-- Update display selection criteria |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1283 |
if (CurrentHedgehog ~= nil and band(GetState(CurrentHedgehog), gstHHDriven) ~= 0) then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1284 |
curWep = GetCurAmmoType() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1285 |
|
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1286 |
local updated = false |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1287 |
local team = GetHogTeamName(CurrentHedgehog) |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1288 |
if (curWep == amGirder) then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1289 |
cIndex = 1 |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1290 |
RedefineSubset() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1291 |
updated = true |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1292 |
elseif (curWep == amRubber) then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1293 |
cIndex = 2 |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1294 |
RedefineSubset() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1295 |
updated = true |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1296 |
elseif (curWep == amCMStructurePlacer) then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1297 |
cIndex = 9 |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1298 |
RedefineSubset() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1299 |
updateCost() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1300 |
updated = true |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1301 |
elseif (curWep == amCMCratePlacer) then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1302 |
cIndex = catReverse[teamLCrateMode[team]] |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1303 |
RedefineSubset() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1304 |
updateCost() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1305 |
updated = true |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1306 |
elseif (curWep == amCMObjectPlacer) then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1307 |
cIndex = catReverse[teamLObjectMode[team]] |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1308 |
RedefineSubset() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1309 |
updateCost() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1310 |
updated = true |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1311 |
end |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1312 |
|
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1313 |
if updated then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1314 |
AddCaption(loc(cat[cIndex]), 0xffba00ff, capgrpMessage) |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1315 |
showModeMessage() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1316 |
wallsVisible = true |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1317 |
else |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1318 |
wallsVisible = false |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1319 |
end |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1320 |
else |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1321 |
curWep = amNothing |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1322 |
wallsVisible = false |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1323 |
end |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1324 |
end |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1325 |
|
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1326 |
|
11015 | 1327 |
-- called in onGameTick() |
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1328 |
function HandleConstructionMode() |
11015 | 1329 |
|
11723
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
1330 |
HandleStructures() |
456f4e9f9dce
Construction Mode: Update structure overlay each tick, thus falling smoothly
Wuzzy <almikes@aol.com>
parents:
11722
diff
changeset
|
1331 |
|
11015 | 1332 |
if CurrentHedgehog ~= nil then |
1333 |
||
1334 |
if wallsVisible == true then |
|
1335 |
HandleBorderEffects() |
|
1336 |
end |
|
1337 |
||
12945
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1338 |
if (TurnTimeLeft ~= TurnTime) then |
11015 | 1339 |
if (lastWep ~= GetCurAmmoType()) then |
1340 |
checkForSpecialWeapons() |
|
11717
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1341 |
elseif checkForSpecialWeaponsIn == 0 then |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1342 |
checkForSpecialWeapons() |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1343 |
checkForSpecialWeaponsIn = -1 |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1344 |
else |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1345 |
checkForSpecialWeaponsIn = checkForSpecialWeaponsIn - 1 |
11015 | 1346 |
end |
1347 |
end |
|
1348 |
||
11727
1c09b8d050ce
Construction Mode: Fix timer issues
Wuzzy <almikes@aol.com>
parents:
11726
diff
changeset
|
1349 |
if GameTime % 100 == 0 then |
11015 | 1350 |
|
12836
8610462e3d33
Remove 2 unused number tags in Construction Mode GUI
Wuzzy <Wuzzy2@mail.ru>
parents:
12682
diff
changeset
|
1351 |
DrawClanPowerTag() |
11015 | 1352 |
|
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1353 |
-- Force-update the construction mode tools every 100ms. |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1354 |
-- This makes sure the announcer messages don't disappear |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1355 |
-- while the tool is selected. |
12945
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1356 |
if (band(GetState(CurrentHedgehog), gstHHDriven) ~= 0) then |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1357 |
curWep = GetCurAmmoType() |
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1358 |
HandleConstructionModeTools() |
11015 | 1359 |
else |
12945
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1360 |
curWep = amNothing |
11015 | 1361 |
end |
1362 |
||
1363 |
end |
|
1364 |
||
1365 |
end |
|
1366 |
||
1367 |
-- some kind of target detected, tell me your story |
|
1368 |
if cGear ~= nil then |
|
1369 |
||
1370 |
x,y = GetGearTarget(cGear) |
|
1371 |
||
1372 |
if GetGearType(cGear) == gtAirAttack then |
|
1373 |
DeleteGear(cGear) |
|
1374 |
PlaceObject(x, y) |
|
1375 |
elseif GetGearType(cGear) == gtTeleport then |
|
1376 |
||
1377 |
CheckTeleport(cGear, x, y) |
|
1378 |
cGear = nil |
|
1379 |
elseif GetGearType(cGear) == gtGirder then |
|
1380 |
||
1381 |
CGR = GetState(cGear) |
|
1382 |
||
11718
f699978eae19
Throw away old out-commented Construction Mode code
Wuzzy <almikes@aol.com>
parents:
11717
diff
changeset
|
1383 |
PlaceObject(x, y) |
11015 | 1384 |
end |
1385 |
||
1386 |
end |
|
1387 |
||
1388 |
end |
|
1389 |
||
1390 |
--------------------------------------------------------------- |
|
1391 |
-- Cycle through selection subsets (by changing pIndex, pMode) |
|
1392 |
-- i.e health of barrels, medikits, |
|
1393 |
-- timer of mines |
|
1394 |
-- contents of crates |
|
1395 |
-- gears to reposition etc. |
|
1396 |
--------------------------------------------------------------- |
|
1397 |
||
1398 |
function updateCost() |
|
1399 |
||
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
|
1400 |
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
|
1401 |
|
11015 | 1402 |
if pMode[pIndex] == loc("Healing Station") then |
1403 |
placedExpense = 50 |
|
1404 |
elseif pMode[pIndex] == loc("Weapon Filter") then |
|
1405 |
placedExpense = 50 |
|
1406 |
elseif pMode[pIndex] == loc("Bio-Filter") then |
|
1407 |
placedExpense = 100 |
|
1408 |
elseif pMode[pIndex] == loc("Respawner") then |
|
1409 |
placedExpense = 300 |
|
1410 |
elseif pMode[pIndex] == loc("Teleportation Node") then |
|
1411 |
placedExpense = 30 |
|
1412 |
elseif pMode[pIndex] == loc("Support Station") then |
|
1413 |
placedExpense = 50 |
|
1414 |
elseif pMode[pIndex] == loc("Construction Station") then |
|
1415 |
placedExpense = 50 |
|
1416 |
elseif pMode[pIndex] == loc("Generator") then |
|
1417 |
placedExpense = 300 |
|
1418 |
elseif pMode[pIndex] == loc("Reflector Shield") then |
|
1419 |
placedExpense = 200 |
|
11708
d5d798172875
Fix crate costs in Construction Mode being all the same (fixes #15)
Wuzzy <almikes@aol.com>
parents:
11301
diff
changeset
|
1420 |
elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1421 |
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
|
1422 |
elseif cat[cIndex] == "Utility Crate Placement Mode" then |
11981
acae870a66b9
Use GetAmmoName in Construction Mode
Wuzzy <almikes@aol.com>
parents:
11942
diff
changeset
|
1423 |
placedExpense = utilArray[pIndex][4] |
11015 | 1424 |
end |
1425 |
||
1426 |
AddCaption(loc("Cost") .. ": " .. placedExpense,0xffba00ff,capgrpAmmostate) |
|
1427 |
||
1428 |
end |
|
1429 |
||
11717
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1430 |
function onTimer(key) |
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1431 |
curWep = GetCurAmmoType() |
11717
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1432 |
|
12942
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1433 |
-- Hacky workaround for object placer: Since this is based on the drill strike, it |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1434 |
-- allows the 5 timer keys to be pressed, causing the announcer to show up |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1435 |
-- This triggers code in 1 tick to send other message to mask the earlier one. |
11717
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1436 |
checkForSpecialWeaponsIn = 1 |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1437 |
|
12942
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1438 |
if (curWep == amCMStructurePlacer) then |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1439 |
-- Select structure directly in structure placer |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1440 |
-- [Timer X] selects structures 1-5 |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1441 |
-- [Precise]+[Timer X] selects structures 6-10 |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1442 |
|
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1443 |
local structureID = key |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1444 |
local precise = band(GetGearMessage(CurrentHedgehog), gmPrecise) ~= 0 |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1445 |
if precise then |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1446 |
structureID = structureID + 5 |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1447 |
end |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1448 |
-- Check for valid pIndex |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1449 |
if structureID <= #pMode then |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1450 |
pIndex = structureID |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1451 |
updateIndex() |
12942
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1452 |
end |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1453 |
elseif (curWep == amCMObjectPlacer) then |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1454 |
-- [Timer X]: Set mine time 1-5 |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1455 |
if cat[cIndex] == "Mine Placement Mode" then |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1456 |
local index = key + 1 |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1457 |
if key <= #pMode then |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1458 |
pIndex = index |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1459 |
updateIndex() |
12942
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1460 |
end |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1461 |
end |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1462 |
end |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1463 |
|
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1464 |
end |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1465 |
|
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1466 |
function onSwitch() |
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1467 |
curWep = GetCurAmmoType() |
12942
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1468 |
if (curWep == amCMObjectPlacer) then |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1469 |
-- [Switch]: Set mine time to 0 |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1470 |
pIndex = 1 |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1471 |
updateIndex() |
12942
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1472 |
end |
11717
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1473 |
end |
f35139700d22
Construction Mode: Disable setting drill strike timer in object placement mode
Wuzzy <almikes@aol.com>
parents:
11716
diff
changeset
|
1474 |
|
11015 | 1475 |
function onLeft() |
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1476 |
curWep = GetCurAmmoType() |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1477 |
if (curWep == amGirder) or (curWep == amRubber) or (curWep == amCMStructurePlacer) or (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) then |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1478 |
pIndex = pIndex - 1 |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1479 |
if pIndex == 0 then |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1480 |
pIndex = #pMode |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1481 |
end |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1482 |
updateIndex() |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1483 |
end |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1484 |
end |
11015 | 1485 |
|
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1486 |
function onRight() |
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1487 |
curWep = GetCurAmmoType() |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1488 |
if (curWep == amGirder) or (curWep == amRubber) or (curWep == amCMStructurePlacer) or (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) then |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1489 |
pIndex = pIndex + 1 |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1490 |
if pIndex > #pMode then |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1491 |
pIndex = 1 |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1492 |
end |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1493 |
updateIndex() |
11015 | 1494 |
end |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1495 |
end |
11015 | 1496 |
|
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1497 |
-- Should be called when the index of the mode was changed by the player. |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1498 |
-- E.g. new weapon crate contents or structure type |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1499 |
function updateIndex() |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1500 |
if (curWep == amGirder) or (curWep == amRubber) or (curWep == amCMStructurePlacer) or (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) then |
11714
8575b8b76373
Construction Mode: Show mine timer in seconds
Wuzzy <almikes@aol.com>
parents:
11713
diff
changeset
|
1501 |
showModeMessage() |
11015 | 1502 |
updateCost() |
1503 |
end |
|
1504 |
||
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1505 |
-- Update team variables so the previous state can be restored later |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1506 |
if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then return end |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1507 |
local val = pMode[pIndex] |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1508 |
local team = GetHogTeamName(CurrentHedgehog) |
12945
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1509 |
if cat[cIndex] == "Structure Placement Mode" then |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1510 |
teamLStructIndex[team] = pIndex |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1511 |
elseif cat[cIndex] == "Mine Placement Mode" then |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1512 |
teamLMineIndex[team] = pIndex |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1513 |
elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1514 |
teamLWeapIndex[team] = pIndex |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1515 |
elseif cat[cIndex] == "Utility Crate Placement Mode" then |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1516 |
teamLUtilIndex[team] = pIndex |
11015 | 1517 |
end |
1518 |
end |
|
1519 |
||
11730
8cc9c8a43dcc
Construction Mode: Fix Girder/Rubber mode sometimes show nil
Wuzzy <almikes@aol.com>
parents:
11729
diff
changeset
|
1520 |
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
|
1521 |
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
|
1522 |
local val = pMode[pIndex] |
8cc9c8a43dcc
Construction Mode: Fix Girder/Rubber mode sometimes show nil
Wuzzy <almikes@aol.com>
parents:
11729
diff
changeset
|
1523 |
local str |
8cc9c8a43dcc
Construction Mode: Fix Girder/Rubber mode sometimes show nil
Wuzzy <almikes@aol.com>
parents:
11729
diff
changeset
|
1524 |
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
|
1525 |
-- timer in seconds |
8cc9c8a43dcc
Construction Mode: Fix Girder/Rubber mode sometimes show nil
Wuzzy <almikes@aol.com>
parents:
11729
diff
changeset
|
1526 |
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
|
1527 |
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
|
1528 |
str = loc("Girder") |
8cc9c8a43dcc
Construction Mode: Fix Girder/Rubber mode sometimes show nil
Wuzzy <almikes@aol.com>
parents:
11729
diff
changeset
|
1529 |
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
|
1530 |
str = loc("Rubber") |
8cc9c8a43dcc
Construction Mode: Fix Girder/Rubber mode sometimes show nil
Wuzzy <almikes@aol.com>
parents:
11729
diff
changeset
|
1531 |
else |
8cc9c8a43dcc
Construction Mode: Fix Girder/Rubber mode sometimes show nil
Wuzzy <almikes@aol.com>
parents:
11729
diff
changeset
|
1532 |
str = tostring(val) |
8cc9c8a43dcc
Construction Mode: Fix Girder/Rubber mode sometimes show nil
Wuzzy <almikes@aol.com>
parents:
11729
diff
changeset
|
1533 |
end |
8cc9c8a43dcc
Construction Mode: Fix Girder/Rubber mode sometimes show nil
Wuzzy <almikes@aol.com>
parents:
11729
diff
changeset
|
1534 |
AddCaption(str,0xffba00ff,capgrpMessage2) |
8cc9c8a43dcc
Construction Mode: Fix Girder/Rubber mode sometimes show nil
Wuzzy <almikes@aol.com>
parents:
11729
diff
changeset
|
1535 |
end |
11015 | 1536 |
|
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1537 |
function rotateMode(pDir) |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1538 |
curWep = GetCurAmmoType() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1539 |
local foundMatch = false |
11015 | 1540 |
while(foundMatch == false) do |
1541 |
cIndex = cIndex + pDir |
|
1542 |
||
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1543 |
if (cIndex == 1) or (cIndex == 2) then -- we no longer hit girder by normal means |
11015 | 1544 |
cIndex = #cat |
1545 |
elseif cIndex > #cat then |
|
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1546 |
cIndex = 3 -- we no longer hit girder by normal means |
11015 | 1547 |
end |
1548 |
||
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1549 |
if (GetCurAmmoType() == amCMCratePlacer) then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1550 |
if (sProx[cIndex][1] == loc("Health Crate Placement Mode")) or |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1551 |
(sProx[cIndex][1] == loc("Weapon Crate Placement Mode")) or |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1552 |
(sProx[cIndex][1] == loc("Utility Crate Placement Mode")) then |
11015 | 1553 |
foundMatch = true |
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1554 |
end |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1555 |
elseif (GetCurAmmoType() == amCMObjectPlacer) then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1556 |
if (sProx[cIndex][1] == loc("Mine Placement Mode")) or |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1557 |
(sProx[cIndex][1] == loc("Sticky Mine Placement Mode")) or |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1558 |
(sProx[cIndex][1] == loc("Barrel Placement Mode")) then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1559 |
foundMatch = true |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1560 |
end |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1561 |
elseif (GetCurAmmoType() == amCMStructurePlacer) then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1562 |
if sProx[cIndex][1] == loc("Structure Placement Mode") then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1563 |
foundMatch = true |
11015 | 1564 |
end |
1565 |
end |
|
1566 |
end |
|
1567 |
||
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1568 |
if foundMatch == true then |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1569 |
RedefineSubset() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1570 |
--updateCost() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1571 |
HandleConstructionModeTools() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1572 |
end |
11015 | 1573 |
end |
1574 |
||
1575 |
--------------------------------------------------------- |
|
1576 |
-- Cycle through primary categories (by changing cIndex) |
|
1577 |
-- i.e mine, sticky mine, barrels |
|
1578 |
-- health/weapon/utility crate, placement of gears |
|
1579 |
--------------------------------------------------------- |
|
1580 |
function onUp() |
|
1581 |
||
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1582 |
curWep = GetCurAmmoType() |
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
1583 |
if ( (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) ) then |
12945
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1584 |
if CurrentHedgehog ~= nil and band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then |
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1585 |
rotateMode(-1) |
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
|
1586 |
end |
11015 | 1587 |
end |
1588 |
||
1589 |
end |
|
1590 |
||
1591 |
function onDown() |
|
1592 |
||
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1593 |
curWep = GetCurAmmoType() |
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
1594 |
if ( (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) ) then |
12945
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1595 |
if CurrentHedgehog ~= nil and band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then |
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1596 |
rotateMode(1) |
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
|
1597 |
end |
11015 | 1598 |
end |
1599 |
||
1600 |
end |
|
1601 |
||
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1602 |
onSetWeapon = HandleConstructionModeTools() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1603 |
onSlot = onSetWeapon |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1604 |
|
11015 | 1605 |
---------------------------- |
1606 |
-- standard event handlers |
|
1607 |
---------------------------- |
|
1608 |
||
11720
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1609 |
-- Parses a positive integer |
12092
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
1610 |
function parseInt(str, default, infinityPermitted) |
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
1611 |
if str == "inf" and infinityPermitted then |
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
1612 |
return "inf" |
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
1613 |
end |
11720
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1614 |
if str == nil then return default end |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1615 |
local s = string.match(str, "(%d*)") |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1616 |
if s ~= nil then |
11728
373150be0356
Construction Mode: Sanity-check numbers from script parameter
Wuzzy <almikes@aol.com>
parents:
11727
diff
changeset
|
1617 |
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
|
1618 |
else |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1619 |
return nil |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1620 |
end |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1621 |
end |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1622 |
|
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1623 |
-- Parse parameters |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1624 |
function onParameters() |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1625 |
parseParams() |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1626 |
conf_initialEnergy = parseInt(params["initialenergy"], conf_initialEnergy) |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1627 |
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
|
1628 |
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
|
1629 |
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
|
1630 |
end |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1631 |
|
11015 | 1632 |
function onGameInit() |
1633 |
||
1634 |
Explosives = 0 |
|
1635 |
MinesNum = 0 |
|
1636 |
||
1637 |
EnableGameFlags(gfInfAttack) |
|
12093
0d6e0ed36c9e
Construction Mode: Fix free girder/rubber placement near hog
Wuzzy <almikes@aol.com>
parents:
12092
diff
changeset
|
1638 |
-- 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
|
1639 |
SetMaxBuildDistance(1) |
11015 | 1640 |
|
11881
34ede05e4d4f
Remove old Fort Mode from frontend
Wuzzy <almikes@aol.com>
parents:
11762
diff
changeset
|
1641 |
fortMode = MapGen == mgForts |
11733
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1642 |
|
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1643 |
-- 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
|
1644 |
if fortMode then |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1645 |
EnableGameFlags(gfDivideTeams) |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1646 |
end |
11015 | 1647 |
|
1648 |
RedefineSubset() |
|
1649 |
||
1650 |
end |
|
1651 |
||
1652 |
function initialSetup(gear) |
|
1653 |
||
11733
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1654 |
-- 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
|
1655 |
if not fortMode then |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1656 |
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
|
1657 |
end |
11015 | 1658 |
|
1659 |
-- for now, everyone should have this stuff |
|
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
1660 |
AddAmmo(gear, amCMStructurePlacer, 100) |
11015 | 1661 |
AddAmmo(gear, amSwitch, 100) |
1662 |
AddAmmo(gear, amSkip, 100) |
|
1663 |
||
1664 |
end |
|
1665 |
||
1666 |
function onGameStart() |
|
1667 |
||
1668 |
trackTeams() |
|
1669 |
||
1670 |
ShowMission ( |
|
1671 |
loc("CONSTRUCTION MODE"), |
|
1672 |
loc("a Hedgewars mini-game"), |
|
1673 |
loc("Build a fortress and destroy your enemy.") .. "|" .. |
|
1674 |
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
|
1675 |
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
|
1676 |
, 4, 5000 |
11015 | 1677 |
) |
1678 |
||
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
1679 |
SetAmmoTexts(amCMStructurePlacer, loc("Structure Placer"), loc("Construction Mode tool"), loc("Build one of multiple different structures|to aid you in victory, at the cost of energy.") .. "| |" .. |
12943
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1680 |
loc("Support Station: Allows placement of crates.") .. "|".. |
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1681 |
loc("Construction Station: Allows placement of| girders, rubber, mines, sticky mines| and barrels.") .. "|" .. |
11942
abdb24f0c2d9
Change descriptions for special Construction Mode tools
Wuzzy <almikes@aol.com>
parents:
11881
diff
changeset
|
1682 |
loc("Healing Station: Heals nearby hogs.") .. "|" .. |
12943
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1683 |
loc("Teleportation Node: Allows teleportation| between other nodes.") .. "|" .. |
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1684 |
loc("Weapon Filter: Dematerializes all ammo| carried by enemies entering it.") .. "|" .. |
11942
abdb24f0c2d9
Change descriptions for special Construction Mode tools
Wuzzy <almikes@aol.com>
parents:
11881
diff
changeset
|
1685 |
loc("Bio-Filter: Aggressively removes enemies.") .. "|" .. |
abdb24f0c2d9
Change descriptions for special Construction Mode tools
Wuzzy <almikes@aol.com>
parents:
11881
diff
changeset
|
1686 |
loc("Reflector Shield: Reflects enemy projectiles.") .. "|" .. |
abdb24f0c2d9
Change descriptions for special Construction Mode tools
Wuzzy <almikes@aol.com>
parents:
11881
diff
changeset
|
1687 |
loc("Respawner: Resurrects dead hogs.") .. "|" .. |
12942
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1688 |
loc("Generator: Generates energy.") .. "|" .. |
12943
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1689 |
" |" .. |
11942
abdb24f0c2d9
Change descriptions for special Construction Mode tools
Wuzzy <almikes@aol.com>
parents:
11881
diff
changeset
|
1690 |
|
12942
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1691 |
loc("Left/right: Choose structure type").."|".. |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1692 |
loc("1-5, Precise + 1-4: Choose structure type").."|".. |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1693 |
loc("Cursor: Build structure")) |
11942
abdb24f0c2d9
Change descriptions for special Construction Mode tools
Wuzzy <almikes@aol.com>
parents:
11881
diff
changeset
|
1694 |
|
12092
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
1695 |
local txt_crateLimit = "" |
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
1696 |
if conf_cratesPerRound ~= "inf" then |
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
1697 |
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
|
1698 |
end |
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
1699 |
|
12941
ffbd31afed96
HedgeEditor, Construction Mode: Refactor code by adding fake ammo type variables
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
1700 |
SetAmmoTexts(amCMCratePlacer, loc("Crate Placer"), loc("Construction Mode tool"), |
12092
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
1701 |
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
|
1702 |
txt_crateLimit .. |
12943
3feab46234dd
Construction Mode: Sort structure types roughly by importance and convenience
Wuzzy <Wuzzy2@mail.ru>
parents:
12942
diff
changeset
|
1703 |
loc("Up/down: Choose crate type") .. "|" .. |
12092
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
1704 |
loc("Left/right: Choose crate contents") .. "|" .. |
9fe7eb1f7df2
Construction Mode: Turn crate limit into a script parameter
Wuzzy <almikes@aol.com>
parents:
12091
diff
changeset
|
1705 |
loc("|Cursor: Place crate")) |
12942
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1706 |
SetAmmoTexts(amCMObjectPlacer, loc("Object Placer"), loc("Construction Mode tool"), |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1707 |
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.").."|".. |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1708 |
loc("Up/down: Choose object type|1-5/Switch/Left/Right: Choose mine timer|Cursor: Place object") |
ca23981ec219
Add a few key shortcuts in Costruction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12941
diff
changeset
|
1709 |
) |
11015 | 1710 |
|
12336
fbc268170015
Construction Mode: Mention teleportation restriction in tooltip
Wuzzy <almikes@aol.com>
parents:
12214
diff
changeset
|
1711 |
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
|
1712 |
|
11015 | 1713 |
sCirc = AddVisualGear(0,0,vgtCircle,0,true) |
1714 |
SetVisualGearValues(sCirc, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x00000000) |
|
1715 |
||
1716 |
for i = 0, ClansCount-1 do |
|
11982
6f4b96669f9d
Fix Construction Mode screwing up when initialenergy > maxenergy
Wuzzy <almikes@aol.com>
parents:
11981
diff
changeset
|
1717 |
clanPower[i] = math.min(conf_initialEnergy, conf_maxEnergy) |
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1718 |
|
11015 | 1719 |
clanUsedExtraTime[i] = false |
1720 |
clanCratesSpawned[i] = 0 |
|
11721
8c1a30d4cbc8
Construction Mode: Fix giving round energy boost at first round
Wuzzy <almikes@aol.com>
parents:
11720
diff
changeset
|
1721 |
clanFirstTurn[i] = true |
11015 | 1722 |
|
1723 |
end |
|
12944
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1724 |
for i = 0, TeamsCount-1 do |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1725 |
local team = GetTeamName(i) |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1726 |
teamLStructIndex[team] = 1 |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1727 |
teamLObjectMode[team] = "Mine Placement Mode" |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1728 |
teamLCrateMode[team] = "Weapon Crate Placement Mode" |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1729 |
teamLMineIndex[team] = 1 |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1730 |
teamLWeapIndex[team] = 1 |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1731 |
teamLUtilIndex[team] = 1 |
712ae7ff8c3d
Construction Mode: Remember previous selection of pIndex
Wuzzy <Wuzzy2@mail.ru>
parents:
12943
diff
changeset
|
1732 |
end |
11015 | 1733 |
|
1734 |
tMapWidth = RightX - LeftX |
|
1735 |
tMapHeight = WaterLine - TopY |
|
1736 |
clanInterval = div(tMapWidth,ClansCount) |
|
1737 |
||
11733
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1738 |
-- 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
|
1739 |
-- 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
|
1740 |
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
|
1741 |
local slot |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1742 |
if fortMode then |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1743 |
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
|
1744 |
else |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1745 |
slot = i |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1746 |
end |
11015 | 1747 |
|
11733
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1748 |
local color = GetClanColor(i) |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1749 |
|
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1750 |
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
|
1751 |
clanBoundsSY[i] = TopY |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1752 |
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
|
1753 |
clanBoundsEY[i] = WaterLine |
11015 | 1754 |
|
1755 |
--top and bottom |
|
11733
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
11732
diff
changeset
|
1756 |
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
|
1757 |
AddWall(LeftX+(clanInterval*slot),WaterLine-25,clanInterval,margin,color) |
11015 | 1758 |
|
1759 |
--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
|
1760 |
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
|
1761 |
AddWall(LeftX+(clanInterval*slot)+clanInterval-20,TopY,margin,WaterLine,color) |
11015 | 1762 |
|
1763 |
end |
|
1764 |
||
1765 |
runOnHogs(initialSetup) |
|
1766 |
||
1767 |
end |
|
1768 |
||
1769 |
||
1770 |
function onNewTurn() |
|
1771 |
||
12945
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1772 |
curWep = GetCurAmmoType() |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1773 |
|
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1774 |
HandleConstructionModeTools() |
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1775 |
|
11720
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1776 |
local clan = GetHogClan(CurrentHedgehog) |
11721
8c1a30d4cbc8
Construction Mode: Fix giving round energy boost at first round
Wuzzy <almikes@aol.com>
parents:
11720
diff
changeset
|
1777 |
if clanFirstTurn[clan] then |
8c1a30d4cbc8
Construction Mode: Fix giving round energy boost at first round
Wuzzy <almikes@aol.com>
parents:
11720
diff
changeset
|
1778 |
clanFirstTurn[clan] = false |
8c1a30d4cbc8
Construction Mode: Fix giving round energy boost at first round
Wuzzy <almikes@aol.com>
parents:
11720
diff
changeset
|
1779 |
else |
8c1a30d4cbc8
Construction Mode: Fix giving round energy boost at first round
Wuzzy <almikes@aol.com>
parents:
11720
diff
changeset
|
1780 |
clanPower[clan] = clanPower[clan] + conf_energyPerRound |
11728
373150be0356
Construction Mode: Sanity-check numbers from script parameter
Wuzzy <almikes@aol.com>
parents:
11727
diff
changeset
|
1781 |
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
|
1782 |
clanPower[clan] = conf_maxEnergy |
8c1a30d4cbc8
Construction Mode: Fix giving round energy boost at first round
Wuzzy <almikes@aol.com>
parents:
11720
diff
changeset
|
1783 |
end |
11720
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1784 |
end |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1785 |
clanUsedExtraTime[clan] = false |
5cb2f245ee2f
Add script parameter support to Construction Mode
Wuzzy <almikes@aol.com>
parents:
11719
diff
changeset
|
1786 |
clanCratesSpawned[clan] = 0 |
11015 | 1787 |
end |
1788 |
||
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1789 |
function onEndTurn() |
12945
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1790 |
curWep = amNothing |
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1791 |
HandleConstructionModeTools() |
12945
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1792 |
end |
0e698562d76d
More Construction Mode refactoring
Wuzzy <Wuzzy2@mail.ru>
parents:
12944
diff
changeset
|
1793 |
|
11015 | 1794 |
function onGameTick() |
12946
1a1a514aef2e
Construction Mode: Each team remembers its selections now
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
1795 |
HandleConstructionMode() |
11015 | 1796 |
end |
1797 |
||
1798 |
function isATrackedGear(gear) |
|
1799 |
if (GetGearType(gear) == gtHedgehog) or |
|
1800 |
(GetGearType(gear) == gtTarget) or |
|
1801 |
(GetGearType(gear) == gtCase) |
|
1802 |
then |
|
1803 |
return(true) |
|
1804 |
else |
|
1805 |
return(false) |
|
1806 |
end |
|
1807 |
end |
|
1808 |
||
1809 |
-- track hedgehogs and placement gears |
|
1810 |
function onGearAdd(gear) |
|
1811 |
||
1812 |
if GetGearType(gear) == gtHedgehog then |
|
1813 |
elseif (GetGearType(gear) == gtAirAttack) or (GetGearType(gear) == gtTeleport) or (GetGearType(gear) == gtGirder) then |
|
1814 |
cGear = gear |
|
1815 |
||
1816 |
end |
|
1817 |
||
1818 |
if isATrackedGear(gear) then |
|
1819 |
trackGear(gear) |
|
1820 |
elseif gearCanBeDeflected(gear) then |
|
1821 |
trackGear(gear) |
|
1822 |
setGearReflectionValues(gear) |
|
1823 |
end |
|
1824 |
||
1825 |
end |
|
1826 |
||
1827 |
function onGearDelete(gear) |
|
1828 |
||
1829 |
if GetGearType(gear) == gtTarget then |
|
1830 |
CheckGearForStructureLink(gear) |
|
1831 |
end |
|
1832 |
||
1833 |
if (GetGearType(gear) == gtAirAttack) or (GetGearType(gear) == gtTeleport) or (GetGearType(gear) == gtGirder) then |
|
1834 |
cGear = nil |
|
1835 |
end |
|
1836 |
||
1837 |
if (isATrackedGear(gear) or gearCanBeDeflected(gear)) then |
|
1838 |
||
1839 |
if getGearValue(gear, "tCirc") ~= nil then |
|
1840 |
DeleteVisualGear(getGearValue(gear, "tCirc")) |
|
1841 |
end |
|
1842 |
||
1843 |
trackDeletion(gear) |
|
1844 |
||
1845 |
end |
|
1846 |
||
1847 |
end |