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