author | unc0rr |
Sat, 17 Nov 2012 00:41:30 +0400 | |
branch | physfslayer |
changeset 8043 | da083f8d95e6 |
parent 7791 | b937274608ba |
child 8682 | 158d7b36b18e |
permissions | -rw-r--r-- |
6349 | 1 |
-------------------------------- |
2 |
-- HIGHLANDER / HOGS OF WAR |
|
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
3 |
-- version 0.3c |
6349 | 4 |
-- by mikade |
5 |
-------------------------------- |
|
6 |
||
7 |
----------- |
|
8 |
--0.1 |
|
9 |
----------- |
|
10 |
||
11 |
-- concept test |
|
12 |
||
13 |
----------- |
|
14 |
--0.2 |
|
15 |
----------- |
|
16 |
||
17 |
-- remove tardis till Henek fixes his tracker |
|
18 |
-- change wep crates to health crates |
|
19 |
-- reset arb turntimevalue |
|
20 |
-- include randomOrder |
|
21 |
-- Until fixed .17 methods come out, remove switches and resurrector |
|
22 |
-- on request, removed kamikaze and piano weapons |
|
23 |
-- provisional fixing of bugs that can't actually be fixed yet |
|
24 |
||
25 |
----------- |
|
26 |
--0.3 |
|
27 |
----------- |
|
28 |
||
29 |
-- meh, update incorrect display |
|
30 |
-- may change this in the future to have switches |
|
31 |
-- but for now people are used to it without, so~ |
|
32 |
||
33 |
-- mudball is now counted as a utility |
|
34 |
||
6378 | 35 |
----------- |
36 |
--0.3b |
|
37 |
----------- |
|
6349 | 38 |
|
6378 | 39 |
-- cleaned up code and got rid of unneccessary vars |
40 |
-- mudball is a weapon again |
|
41 |
-- landgun is now a utility |
|
42 |
-- extra time, vampirism utility removed |
|
43 |
-- hammer wep removed |
|
44 |
-- all hogs have kamikaze |
|
6349 | 45 |
|
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
46 |
----------- |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
47 |
--0.3c |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
48 |
----------- |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
49 |
|
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
50 |
-- restructured some code |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
51 |
-- added napalm (whoops) to list of possible weapons you can get |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
52 |
-- hogs no longer recieve airstrike-related weps on border maps |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
53 |
|
8043 | 54 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
55 |
HedgewarsScriptLoad("/Scripts/Tracker.lua") |
|
6349 | 56 |
|
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
57 |
local airWeapons = {amAirAttack, amMineStrike, amNapalm, amDrillStrike --[[,amPiano]]} |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
58 |
|
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
59 |
local atkArray = { |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
60 |
amBazooka, amBee, amMortar, amDrill, --[[amSnowball,]] |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
61 |
amGrenade, amClusterBomb, amMolotov, amWatermelon, amHellishBomb, amGasBomb, |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
62 |
amShotgun, amDEagle, amFlamethrower, amSniperRifle, amSineGun, |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
63 |
amFirePunch, amWhip, amBaseballBat, --[[amKamikaze,]] amSeduction, --[[amHammer,]] |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
64 |
amMine, amDynamite, amCake, amBallgun, amRCPlane, amSMine, |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
65 |
amRCPlane, amSMine, |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
66 |
amBirdy |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
67 |
} |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
68 |
|
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
69 |
local utilArray = { |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
70 |
amBlowTorch, amPickHammer, amGirder, amPortalGun, |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
71 |
amRope, amParachute, amTeleport, amJetpack, |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
72 |
amInvulnerable, amLaserSight, --[[amVampiric,]] |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
73 |
amLowGravity, amExtraDamage, --[[amExtraTime,]] |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
74 |
amLandGun |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
75 |
--[[,amTardis, amResurrector, amSwitch]] |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
76 |
} |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
77 |
|
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
78 |
local wepArray = {} |
6349 | 79 |
|
80 |
local currName |
|
81 |
local lastName |
|
82 |
local started = false |
|
83 |
local switchStage = 0 |
|
84 |
||
85 |
function StartingSetUp(gear) |
|
86 |
||
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
87 |
for i = 1, #wepArray do |
6349 | 88 |
setGearValue(gear,wepArray[i],0) |
89 |
end |
|
90 |
||
6378 | 91 |
setGearValue(gear,amKamikaze,1) |
92 |
||
93 |
i = 1 + GetRandom(#atkArray) |
|
6349 | 94 |
setGearValue(gear,atkArray[i],1) |
95 |
||
6378 | 96 |
i = 1 + GetRandom(#utilArray) |
6349 | 97 |
setGearValue(gear,utilArray[i],1) |
98 |
||
99 |
SetHealth(gear, 100) |
|
100 |
||
101 |
end |
|
102 |
||
103 |
--[[function SaveWeapons(gear) |
|
104 |
||
105 |
- |
|
6378 | 106 |
for i = 1, (#wepArray) do |
6349 | 107 |
setGearValue(gear, wepArray[i], GetAmmoCount(gear, wepArray[i]) ) |
108 |
--AddAmmo(gear, wepArray[i], getGearValue(gear,wepArray[i]) ) |
|
109 |
end |
|
110 |
||
111 |
end]] |
|
112 |
||
113 |
function ConvertValues(gear) |
|
114 |
||
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
115 |
for i = 1, #wepArray do |
6349 | 116 |
AddAmmo(gear, wepArray[i], getGearValue(gear,wepArray[i]) ) |
117 |
end |
|
118 |
||
119 |
||
120 |
end |
|
121 |
||
122 |
||
123 |
function TransferWeps(gear) |
|
124 |
||
125 |
if CurrentHedgehog ~= nil then |
|
126 |
||
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
127 |
for i = 1, #wepArray do |
6349 | 128 |
val = getGearValue(gear,wepArray[i]) |
129 |
if val ~= 0 then |
|
130 |
setGearValue(CurrentHedgehog, wepArray[i], val) |
|
131 |
AddAmmo(CurrentHedgehog, wepArray[i], val) |
|
132 |
end |
|
133 |
end |
|
134 |
||
135 |
end |
|
136 |
||
137 |
end |
|
138 |
||
139 |
function onGameInit() |
|
140 |
GameFlags = gfInfAttack + gfRandomOrder |
|
141 |
HealthCaseProb = 100 |
|
142 |
end |
|
143 |
||
144 |
function onGameStart() |
|
145 |
||
146 |
||
147 |
ShowMission ( |
|
148 |
loc("HIGHLANDER"), |
|
149 |
loc("Not all hogs are born equal."), |
|
150 |
||
151 |
"- " .. loc("Eliminate enemy hogs and take their weapons.") .. "|" .. |
|
152 |
"- " .. loc("Per-Hog Ammo") .. "|" .. |
|
153 |
"- " .. loc("Weapons reset.") .. "|" .. |
|
154 |
"- " .. loc("Unlimited Attacks") .. "|" .. |
|
155 |
"", 4, 4000 |
|
156 |
) |
|
157 |
||
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
158 |
if MapHasBorder() == false then |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
159 |
for i, w in pairs(airWeapons) do |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
160 |
table.insert(atkArray, w) |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
161 |
end |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
162 |
end |
6349 | 163 |
|
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
164 |
for i, w in pairs(atkArray) do |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
165 |
table.insert(wepArray, w) |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
166 |
end |
6349 | 167 |
|
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
168 |
for i, w in pairs(utilArray) do |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
169 |
table.insert(wepArray, w) |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
170 |
end |
6349 | 171 |
|
172 |
runOnGears(StartingSetUp) |
|
173 |
runOnGears(ConvertValues) |
|
174 |
||
175 |
||
176 |
end |
|
177 |
||
7791
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7139
diff
changeset
|
178 |
--function onNewTurn() |
6349 | 179 |
-- |
7791
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7139
diff
changeset
|
180 |
--end |
6349 | 181 |
|
182 |
||
7139 | 183 |
function onGameTick20() |
6349 | 184 |
|
185 |
if (CurrentHedgehog ~= nil) then |
|
186 |
||
187 |
currName = GetHogName(CurrentHedgehog) |
|
188 |
||
189 |
if (currName ~= lastName) then |
|
190 |
AddCaption(loc("Switched to ") .. currName .. "!") |
|
191 |
ConvertValues(CurrentHedgehog) |
|
192 |
end |
|
193 |
||
194 |
lastName = currName |
|
195 |
end |
|
196 |
||
197 |
end |
|
198 |
||
199 |
--[[function onHogHide(gear) |
|
200 |
-- waiting for Henek |
|
201 |
end |
|
202 |
||
203 |
function onHogRestore(gear) |
|
204 |
-- waiting for Henek |
|
205 |
end]] |
|
206 |
||
207 |
function onGearAdd(gear) |
|
208 |
||
209 |
--if GetGearType(gear) == gtSwitcher then |
|
210 |
-- SaveWeapons(CurrentHedgehog) |
|
211 |
--end |
|
212 |
||
213 |
if (GetGearType(gear) == gtHedgehog) then |
|
214 |
trackGear(gear) |
|
215 |
end |
|
216 |
||
217 |
end |
|
218 |
||
219 |
function onGearDelete(gear) |
|
220 |
||
221 |
if (GetGearType(gear) == gtHedgehog) then --or (GetGearType(gear) == gtResurrector) then |
|
222 |
TransferWeps(gear) |
|
223 |
trackDeletion(gear) |
|
224 |
end |
|
225 |
||
226 |
end |
|
227 |
||
228 |
function onAmmoStoreInit() |
|
229 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
6378 | 230 |
SetAmmo(amKamikaze, 9, 0, 0, 0) |
6349 | 231 |
--SetAmmo(amSwitch, 9, 0, 0, 0) -------1 |
232 |
end |
|
233 |