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