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