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