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