author | Wuzzy <Wuzzy2@mail.ru> |
Thu, 15 Feb 2018 19:03:04 +0100 | |
changeset 13016 | c819675d4f4f |
parent 12918 | 20e627c1ac20 |
child 13028 | acba432d34b1 |
permissions | -rw-r--r-- |
10413 | 1 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
2 |
HedgewarsScriptLoad("/Scripts/Utils.lua") |
|
10810
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
3 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
10413 | 4 |
|
5 |
local hTag = nil |
|
6 |
local hTagHeight = 33000 |
|
7 |
local tTag = nil |
|
8 |
local rTag = nil |
|
9 |
local startTime = 0 |
|
10 |
local MaxHeight = 32640 |
|
11 |
local RecordHeight = 33000 |
|
10581 | 12 |
local RecordHeightHogName = nil |
10413 | 13 |
local Fire = {} |
14 |
--local BoomFire = nil |
|
15 |
local HH = {} |
|
10581 | 16 |
local totalHedgehogs = 0 |
17 |
local deadHedgehogs = 0 |
|
10632
5ae7ba0b2849
pretty sure the other teams need stats at 0 for the graph to look right
nemo
parents:
10598
diff
changeset
|
18 |
local currTeam = '' |
5ae7ba0b2849
pretty sure the other teams need stats at 0 for the graph to look right
nemo
parents:
10598
diff
changeset
|
19 |
local teams = {} |
10581 | 20 |
local teamScoreStats = {} |
21 |
local teamBests = {} |
|
11640 | 22 |
local teamTimes = {} |
10413 | 23 |
local MrMine -- in honour of sparkle's first arrival in the cabin |
24 |
local YouWon = false |
|
10581 | 25 |
local YouLost = false |
10580
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
26 |
local HogsAreInvulnerable = false |
10413 | 27 |
local WaterRise = nil |
28 |
local Cake = nil |
|
29 |
local CakeTries = 0 |
|
10810
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
30 |
local addCake = true |
10413 | 31 |
local Stars = {} |
10581 | 32 |
local tauntNoo = false |
33 |
local jokeAwardNavy = nil |
|
34 |
local jokeAwardSpeed = nil |
|
35 |
local jokeAwardDamage = nil |
|
36 |
local recordBroken = false |
|
37 |
local dummyHog = nil |
|
10592 | 38 |
local dummySkip = 0 |
10810
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
39 |
local baseWaterSpeed = 2 |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
40 |
local waterSpeed = 0 |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
41 |
local waterAccel = 0 |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
42 |
local delayHeight = 32000 |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
43 |
local delayTime = 0 |
10824 | 44 |
local airMineX = {} |
45 |
local airMineY = {} |
|
46 |
local airMine = {} |
|
47 |
local init = true |
|
12658
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
48 |
local multiplayerVictoryDelay = -1 |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
49 |
local multiplayerWinningHogs = {} |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
50 |
local multiplayerWins = 0 |
12759
c7224d202e8b
2nd try... just shortcircuit most of onGameTick20 when we are between turns.
nemo
parents:
12758
diff
changeset
|
51 |
local racing = false |
12658
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
52 |
|
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
53 |
-- Placement positions of winning hogs |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
54 |
local victoryPosses = { } |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
55 |
do |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
56 |
local m = 0 |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
57 |
for y=108, 39, -32 do |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
58 |
for x=1820+m, 1972-m, 22 do |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
59 |
table.insert(victoryPosses, {x=x, y=y}) |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
60 |
end |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
61 |
m = m + 32 |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
62 |
end |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
63 |
end |
10810
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
64 |
|
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
65 |
function onParameters() |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
66 |
parseParams() |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
67 |
|
10811 | 68 |
if params["speed"] ~= nil then |
69 |
baseWaterSpeed = params["speed"] |
|
70 |
end |
|
10812 | 71 |
if params["accel"] ~= nil then |
10811 | 72 |
waterAccel = params["accel"] |
73 |
if waterAccel ~= 0 then waterAccel = div(32640000,waterAccel) end |
|
74 |
end |
|
75 |
if params["delaytime"] ~= nil then |
|
76 |
delayTime = params["delaytime"] |
|
77 |
end |
|
11618 | 78 |
if params["delayheight"] ~= nil then |
10811 | 79 |
delayHeight = 32768-params["delayheight"] |
80 |
end |
|
10810
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
81 |
if params["nocake"] ~= nil then addCake = false end |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
82 |
end |
10413 | 83 |
|
84 |
function onGameInit() |
|
85 |
-- Ensure people get same map for same theme |
|
86 |
TurnTime = 999999999 |
|
87 |
CaseFreq = 0 |
|
88 |
Explosives = 0 |
|
89 |
MineDudPercent = 0 |
|
10598
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
90 |
EnableGameFlags(gfOneClanMode) |
10413 | 91 |
DisableGameFlags(gfBottomBorder+gfBorder) |
92 |
--This reduced startup time by only about 15% and looked ugly |
|
93 |
--EnableGameFlags(gfDisableLandObjects) |
|
94 |
-- force seed instead. Some themes will still be easier, but at least you won't luck out on the same theme |
|
95 |
Seed = ClimbHome |
|
12084
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
12082
diff
changeset
|
96 |
-- Disable Sudden Death |
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
12082
diff
changeset
|
97 |
WaterRise = 0 |
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
12082
diff
changeset
|
98 |
HealthDecrease = 0 |
10413 | 99 |
end |
100 |
||
101 |
function onGearAdd(gear) |
|
102 |
if GetGearType(gear) == gtHedgehog then |
|
103 |
HH[gear] = 1 |
|
10581 | 104 |
totalHedgehogs = totalHedgehogs + 1 |
10632
5ae7ba0b2849
pretty sure the other teams need stats at 0 for the graph to look right
nemo
parents:
10598
diff
changeset
|
105 |
teams[GetHogTeamName(gear)] = 1 |
10824 | 106 |
elseif init and GetGearType(gear) == gtAirMine then |
107 |
airMine[gear] = 1 |
|
10413 | 108 |
end |
109 |
end |
|
110 |
||
111 |
function onGearDelete(gear) |
|
112 |
if gear == MrMine then |
|
12397
78ad1119eb6c
Make the Mr Mine message in ClimbHome translatable
Wuzzy <almikes@aol.com>
parents:
12193
diff
changeset
|
113 |
AddCaption(loc("Once you set off the proximity trigger, Mr. Mine is not your friend"), 0xFFFFFFFF, capgrpMessage) |
10413 | 114 |
MrMine = nil |
12832
b7453ae2c44d
Fix incorrect check for cake gear type in ClimbHome
Wuzzy <Wuzzy2@mail.ru>
parents:
12831
diff
changeset
|
115 |
elseif GetGearType(gear) == gtCake then |
10413 | 116 |
Cake = nil |
10581 | 117 |
elseif GetGearType(gear) == gtHedgehog then |
11067
c632b47b8ff0
Trying to get these scripts to behave properly, still WIP though.
nemo
parents:
10824
diff
changeset
|
118 |
onGameTick20() |
c632b47b8ff0
Trying to get these scripts to behave properly, still WIP though.
nemo
parents:
10824
diff
changeset
|
119 |
onGearDamage(gear, 0) |
10581 | 120 |
HH[gear] = nil |
10413 | 121 |
end |
122 |
end |
|
123 |
||
124 |
function onGameStart() |
|
10581 | 125 |
--SetClanColor(ClansCount-1, 0x0000ffff) appears to be broken |
126 |
SendHealthStatsOff() |
|
10413 | 127 |
ShowMission(loc("Climb Home"), |
12082
ce3860c82c8b
Rewrite 2nd line of mission panel of most missions for consistency
Wuzzy <almikes@aol.com>
parents:
11894
diff
changeset
|
128 |
loc("Challenge"), |
10581 | 129 |
loc("You are far from home, and the water is rising, climb up as high as you can!|Your score will be based on your height."), |
10413 | 130 |
-amRope, 0) |
131 |
local x = 1818 |
|
132 |
for h,i in pairs(HH) do |
|
10598
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
133 |
if h ~= nil then |
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
134 |
-- SetGearPosition(h,x,32549) |
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
135 |
SetGearPosition(h,x,108) |
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
136 |
SetHealth(h,1) |
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
137 |
if x < 1978 then x = x+32 else x = 1818 end |
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
138 |
if GetEffect(h,heInvulnerable) == 0 then |
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
139 |
SetEffect(h,heInvulnerable,1) |
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
140 |
else |
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
141 |
HogsAreInvulnerable = true |
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
142 |
end |
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
143 |
SetState(h,bor(GetState(h),gstInvisible)) |
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
144 |
end |
10413 | 145 |
end |
146 |
-- 1925,263 - Mr. Mine position |
|
147 |
MrMine = AddGear(1925,263,gtMine,0,0,0,0) |
|
148 |
end |
|
10581 | 149 |
|
10413 | 150 |
function onAmmoStoreInit() |
151 |
SetAmmo(amRope, 9, 0, 0, 0) |
|
152 |
end |
|
153 |
||
154 |
function onNewTurn() |
|
10824 | 155 |
if init then |
156 |
init = false |
|
157 |
for a,i in pairs(airMine) do |
|
158 |
x,y = GetGearPosition(a) |
|
159 |
airMineX[a] = x |
|
160 |
airMineY[a] = y |
|
161 |
end |
|
162 |
else |
|
163 |
for a,i in pairs(airMine) do |
|
164 |
local x,y = GetGearPosition(a) |
|
165 |
if not x or airMineX[a] ~= x or airMineY[a] ~= y then |
|
166 |
DeleteGear(a) |
|
167 |
AddGear(airMineX[a],airMineY[a], gtAirMine, gsttmpFlag, 0, 0, 0) |
|
168 |
end |
|
169 |
end |
|
170 |
end |
|
171 |
||
10413 | 172 |
startTime = GameTime |
173 |
--disable to preserve highest over multiple turns |
|
174 |
--will need to change water check too ofc |
|
175 |
MaxHeight = 32640 |
|
176 |
hTagHeight = 33000 |
|
177 |
SetWaterLine(32768) |
|
10581 | 178 |
YouWon = false |
179 |
YouLost = false |
|
180 |
tauntNoo = false |
|
181 |
recordBroken = false |
|
10632
5ae7ba0b2849
pretty sure the other teams need stats at 0 for the graph to look right
nemo
parents:
10598
diff
changeset
|
182 |
currTeam = GetHogTeamName(CurrentHedgehog) |
10592 | 183 |
if CurrentHedgehog ~= nil then |
12658
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
184 |
if CurrentHedgehog ~= dummyHog or multiplayerWinningHogs[CurrentHedgehog] == true then |
10592 | 185 |
SetGearPosition(CurrentHedgehog, 1951,32640) |
12659
26b0d3b76dea
ClimbHome: Make sure hog faces left on turn start
Wuzzy <almikes@aol.com>
parents:
12658
diff
changeset
|
186 |
HogTurnLeft(CurrentHedgehog, true) |
10592 | 187 |
if not HogsAreInvulnerable then SetEffect(CurrentHedgehog,heInvulnerable,0) end |
10598
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
188 |
AddVisualGear(1951,32640,vgtExplosion,0,false) |
10592 | 189 |
SetState(CurrentHedgehog,band(GetState(CurrentHedgehog),bnot(gstInvisible))) |
190 |
SetWeapon(amRope) |
|
191 |
else |
|
192 |
dummySkip = GameTime+1 |
|
193 |
end |
|
10413 | 194 |
end |
12658
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
195 |
for hog, _ in pairs(multiplayerWinningHogs) do |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
196 |
SetEffect(hog, heInvulnerable, 1) |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
197 |
end |
10413 | 198 |
for f,i in pairs(Fire) do |
199 |
DeleteGear(f) |
|
200 |
end |
|
201 |
for s,i in pairs(Stars) do |
|
202 |
DeleteVisualGear(s) |
|
203 |
Stars[s] = nil |
|
204 |
end |
|
205 |
||
10581 | 206 |
if CurrentHedgehog ~= dummyHog then |
207 |
for i = 0,12 do |
|
208 |
flame = AddGear(2000+i*2,308, gtFlame, gsttmpFlag, 0, 0, 0) |
|
209 |
SetTag(flame, 999999+i) |
|
210 |
Fire[flame]=1 |
|
211 |
end |
|
10413 | 212 |
end |
213 |
if Cake ~= nil then DeleteGear(Cake) end |
|
214 |
CakeTries = 0 |
|
215 |
end |
|
216 |
||
217 |
--function onGearDelete(gear) |
|
218 |
-- if gear == WaterRise and MaxHeight > 500 and CurrentHedgehog ~= nil and band(GetState(CurrentHedgehog),gstHHDriven) ~= 0 then |
|
219 |
-- WaterRise = AddGear(0,0,gtWaterUp, 0, 0, 0, 0) |
|
220 |
-- end |
|
221 |
--end |
|
222 |
||
223 |
function FireBoom(x,y,d) -- going to add for rockets too |
|
224 |
AddVisualGear(x,y,vgtExplosion,0,false) |
|
10580
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
225 |
-- should approximate circle by removing corners |
10581 | 226 |
--if BoomFire == nil then BoomFire = {} end |
10413 | 227 |
for i = 0,50 do |
10580
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
228 |
fx = GetRandom(d)-div(d,2) |
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
229 |
fy = GetRandom(d)-div(d,2) |
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
230 |
if fx<0 then |
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
231 |
fdx = -5000-GetRandom(3000) |
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
232 |
else |
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
233 |
fdx = 5000+GetRandom(3000) |
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
234 |
end |
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
235 |
if fy<0 then |
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
236 |
fdy = -5000-GetRandom(3000) |
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
237 |
else |
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
238 |
fdy = 5000+GetRandom(3000) |
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
239 |
end |
17560eb73b4c
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
nemo
parents:
10413
diff
changeset
|
240 |
flame = AddGear(x+fx, y+fy, gtFlame, gsttmpFlag, fdx, fdy, 0) |
10413 | 241 |
SetTag(flame, 999999+i) |
10589
98ea597e5cd9
expose FlightTime to lua, disable in-air flame harming moving hogs ☹ aaaand override that in ClimbHome ☺
nemo
parents:
10587
diff
changeset
|
242 |
SetFlightTime(flame, 0) |
10413 | 243 |
Fire[flame]=1 |
244 |
-- BoomFire[flame]=1 |
|
245 |
end |
|
246 |
end |
|
247 |
||
248 |
||
249 |
function onGameTick20() |
|
10824 | 250 |
local x,y |
12758
327f71313e04
this should probably sidestep that thing unc0rr keeps bringing up. untested. but then, I've never had it happen. I think what happens is onGameTick20 is called in same tick as onNewTurn and before it...
nemo
parents:
12660
diff
changeset
|
251 |
|
10581 | 252 |
if math.random(20) == 1 then AddVisualGear(2012,56,vgtSmoke,0,false) end |
10592 | 253 |
if CurrentHedgehog == dummyHog and dummySkip ~= 0 and dummySkip < GameTime then |
10585 | 254 |
ParseCommand("/skip") |
10592 | 255 |
dummySkip = 0 |
10585 | 256 |
end |
10581 | 257 |
|
10413 | 258 |
--if BoomFire ~= nil then |
259 |
-- for f,i in pairs(BoomFire) do |
|
260 |
-- if band(GetState(f),gstCollision~=0) then DeleteGear(f) end |
|
261 |
-- end |
|
262 |
-- BoomFire = nil |
|
263 |
--end |
|
264 |
||
265 |
for s,i in pairs(Stars) do |
|
266 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(s) |
|
267 |
if g1 > WaterLine + 500 then |
|
268 |
DeleteVisualGear(s) |
|
269 |
Stars[s] = nil |
|
270 |
end |
|
271 |
--else wasn't really visible, pointless. |
|
272 |
-- g5 = g5+1 |
|
273 |
-- if g5 > 360 then g5 = 0 end |
|
274 |
-- SetVisualGearValues(s, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10) |
|
275 |
--end |
|
276 |
end |
|
277 |
||
12658
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
278 |
-- This will be executed if a player reached home in multiplayer |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
279 |
if multiplayerVictoryDelay > 0 then |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
280 |
multiplayerVictoryDelay = multiplayerVictoryDelay - 20 |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
281 |
if multiplayerVictoryDelay <= 0 then |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
282 |
-- If delay's over, the game will continue with the next hog |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
283 |
if CurrentHedgehog then |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
284 |
|
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
285 |
multiplayerWinningHogs[CurrentHedgehog] = true |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
286 |
multiplayerWins = multiplayerWins + 1 |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
287 |
|
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
288 |
local victoryX, victoryY |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
289 |
if multiplayerWins <= #victoryPosses then |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
290 |
victoryX, victoryY = victoryPosses[multiplayerWins].x, victoryPosses[multiplayerWins].y |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
291 |
else |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
292 |
victoryX, victoryY = victoryPosses[#victoryPosses].x, victoryPosses[#victoryPosses].y |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
293 |
end |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
294 |
SetGearPosition(CurrentHedgehog, victoryX, victoryY) |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
295 |
SetEffect(CurrentHedgehog, heInvulnerable, 1) |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
296 |
SetHealth(CurrentHedgehog, 1) |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
297 |
|
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
298 |
if (deadHedgehogs + multiplayerWins) >= totalHedgehogs then |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
299 |
makeFinalMultiPlayerStats() |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
300 |
EndGame() |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
301 |
onAchievementsDeclaration() |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
302 |
else |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
303 |
EndTurn(true) |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
304 |
SetInputMask(0xFFFFFFFF) |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
305 |
end |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
306 |
return |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
307 |
end |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
308 |
end |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
309 |
end |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
310 |
|
12830 | 311 |
if CurrentHedgehog ~= nil then |
312 |
x,y = GetGearPosition(CurrentHedgehog) |
|
313 |
if Cake ~= nil then |
|
314 |
local cx,cy = GetGearPosition(Cake) |
|
12831
42003e235a46
remove some more test redundancy and restore a missing and important nil check
nemo
parents:
12830
diff
changeset
|
315 |
if y < cy-1500 then DeleteGear(Cake) end |
12830 | 316 |
|
12831
42003e235a46
remove some more test redundancy and restore a missing and important nil check
nemo
parents:
12830
diff
changeset
|
317 |
if Cake ~= nil and GetHealth(Cake) < 999980 and gearIsInCircle(CurrentHedgehog,cx,cy,450) then |
12830 | 318 |
FireBoom(cx,cy,200) -- todo animate |
319 |
DeleteGear(Cake) |
|
12831
42003e235a46
remove some more test redundancy and restore a missing and important nil check
nemo
parents:
12830
diff
changeset
|
320 |
end |
42003e235a46
remove some more test redundancy and restore a missing and important nil check
nemo
parents:
12830
diff
changeset
|
321 |
end |
42003e235a46
remove some more test redundancy and restore a missing and important nil check
nemo
parents:
12830
diff
changeset
|
322 |
if band(GetState(CurrentHedgehog),gstHHDriven) == 0 then |
42003e235a46
remove some more test redundancy and restore a missing and important nil check
nemo
parents:
12830
diff
changeset
|
323 |
for f,i in pairs(Fire) do -- takes too long to fall otherwise |
42003e235a46
remove some more test redundancy and restore a missing and important nil check
nemo
parents:
12830
diff
changeset
|
324 |
DeleteGear(f) |
42003e235a46
remove some more test redundancy and restore a missing and important nil check
nemo
parents:
12830
diff
changeset
|
325 |
end |
42003e235a46
remove some more test redundancy and restore a missing and important nil check
nemo
parents:
12830
diff
changeset
|
326 |
if Cake ~= nil then |
42003e235a46
remove some more test redundancy and restore a missing and important nil check
nemo
parents:
12830
diff
changeset
|
327 |
DeleteGear(Cake) |
12830 | 328 |
end |
10413 | 329 |
end |
12830 | 330 |
end |
12765
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
331 |
|
10413 | 332 |
|
333 |
if CurrentHedgehog ~= nil and TurnTimeLeft > 0 and band(GetState(CurrentHedgehog),gstHHDriven) ~= 0 then |
|
10810
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
334 |
if MaxHeight < delayHeight and |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
335 |
TurnTimeLeft<(999999999-delayTime) and |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
336 |
MaxHeight > 286 and WaterLine > 286 then |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
337 |
if waterAccel ~= 0 then |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
338 |
SetWaterLine(WaterLine-(baseWaterSpeed+div(getActualHeight(MaxHeight)*100,waterAccel))) |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
339 |
else |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
340 |
SetWaterLine(WaterLine-baseWaterSpeed) |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
341 |
end |
931dd8f42763
add some config params - speed,accel,delaytime,delayheight,nocake. water rise speed, water rise acceleration, time delay from start of turn for water rise, height delay for same, and disable cake. also set start boulder to indestructible
nemo
parents:
10697
diff
changeset
|
342 |
end |
10413 | 343 |
if y > 0 and y < 30000 and MaxHeight > 286 and math.random(y) < 500 then |
344 |
local s = AddVisualGear(0, 0, vgtStraightShot, 0, true) |
|
345 |
local c = div(250000,y) |
|
346 |
if c > 255 then c = 255 end |
|
347 |
c = c * 0x10000 + 0xFF0000FF |
|
348 |
SetVisualGearValues(s, |
|
349 |
math.random(2048), -5000, 0, -1-(1/y*1000), |
|
350 |
math.random(360), |
|
351 |
0, |
|
352 |
999999999, -- frameticks |
|
12193
099e59894671
Fix CPU level sprites falling down in ClimbHome (instead of stars)
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
353 |
sprStar, -- star |
10413 | 354 |
0, c) |
355 |
--, 0xFFCC00FF) -- could be fun to make colour shift as you rise... |
|
356 |
Stars[s] = 1 |
|
357 |
end |
|
358 |
||
10581 | 359 |
local vx, vy = GetGearVelocity(CurrentHedgehog) |
12765
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
360 |
local distanceFromWater = WaterLine - y |
10581 | 361 |
|
362 |
--[[ check joke awards ]] |
|
363 |
-- navy award: when distance from main map is over 1000 |
|
364 |
local navyDistance = 1250 |
|
365 |
if x < -navyDistance or x > LAND_WIDTH+navyDistance then |
|
366 |
local awarded = false |
|
367 |
local dist = 0 |
|
368 |
if jokeAwardNavy == nil then |
|
369 |
awarded = true |
|
370 |
else |
|
371 |
if x < 0 then |
|
372 |
dist = math.abs(x) |
|
373 |
else |
|
374 |
dist = x - LAND_WIDTH |
|
375 |
end |
|
376 |
if dist > jokeAwardNavy.distance then |
|
377 |
awarded = true |
|
378 |
end |
|
379 |
end |
|
380 |
if awarded == true then |
|
381 |
jokeAwardNavy = { |
|
382 |
hogName = GetHogName(CurrentHedgehog), |
|
383 |
teamName = GetHogTeamName(CurrentHedgehog), |
|
384 |
distance = dist |
|
385 |
} |
|
386 |
end |
|
387 |
end |
|
388 |
||
389 |
-- Speed award for largest distance from water |
|
390 |
if distanceFromWater > 3000 and WaterLine < 32000 then |
|
391 |
local awarded = false |
|
392 |
if jokeAwardSpeed == nil or distanceFromWater > jokeAwardSpeed.distance then |
|
393 |
awarded = true |
|
394 |
end |
|
395 |
if awarded == true then |
|
396 |
jokeAwardSpeed = { |
|
397 |
hogName = GetHogName(CurrentHedgehog), |
|
398 |
teamName = GetHogTeamName(CurrentHedgehog), |
|
399 |
distance = distanceFromWater |
|
400 |
} |
|
401 |
end |
|
10413 | 402 |
end |
10581 | 403 |
|
12765
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
404 |
local finishTime = (GameTime-startTime)/1000 |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
405 |
local roundedFinishTime = math.ceil(math.floor(finishTime+0.5)) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
406 |
if isSinglePlayer then |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
407 |
if distanceFromWater < 0 and not YouLost and not YouWon then |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
408 |
makeSinglePlayerLoserStats() |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
409 |
YouLost = true |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
410 |
end |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
411 |
-- FIXME: Hog is also in winning box if it just walks into the chair from the left, touching it. Intentional? |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
412 |
if not YouWon and not YouLost and gearIsInBox(CurrentHedgehog, 1920, 252, 50, 50) then |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
413 |
AddCaption(loc("Victory!")) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
414 |
ShowMission(loc("Climb Home"), |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
415 |
loc("Made it!"), |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
416 |
string.format(loc("Ahhh, home, sweet home. Made it in %d seconds."), roundedFinishTime), |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
417 |
-amRope, 0) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
418 |
PlaySound(sndVictory,CurrentHedgehog) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
419 |
SetState(CurrentHedgehog, gstWinner) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
420 |
SendStat(siGameResult, loc("You have beaten the challenge!")) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
421 |
SendStat(siGraphTitle, loc("Your height over time")) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
422 |
SendStat(siCustomAchievement, string.format(loc("%s reached home in %.3f seconds. Congratulations!"), GetHogName(CurrentHedgehog), finishTime)) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
423 |
SendStat(siCustomAchievement, string.format(loc("%s bravely climbed up to a dizzy height of %d to reach home."), GetHogName(CurrentHedgehog), getActualHeight(RecordHeight))) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
424 |
SendStat(siPointType, loc("seconds")) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
425 |
SendStat(siPlayerKills, tostring(roundedFinishTime), GetHogTeamName(CurrentHedgehog)) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
426 |
|
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
427 |
EndGame() |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
428 |
onAchievementsDeclaration() |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
429 |
YouWon = true |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
430 |
end |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
431 |
else |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
432 |
if distanceFromWater < 0 and not YouLost and not YouWon then |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
433 |
makeMultiPlayerLoserStat(CurrentHedgehog) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
434 |
deadHedgehogs = deadHedgehogs + 1 |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
435 |
YouLost = true |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
436 |
if deadHedgehogs >= totalHedgehogs then |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
437 |
makeFinalMultiPlayerStats() |
10581 | 438 |
EndGame() |
11628
515d2d38ab8b
Declare achievements alongwith EndGame call, since it would skip SendStats
unc0rr
parents:
11620
diff
changeset
|
439 |
onAchievementsDeclaration() |
10581 | 440 |
end |
441 |
end |
|
12765
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
442 |
-- Check victory |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
443 |
if not YouWon and not YouLost and gearIsInBox(CurrentHedgehog, 1920, 252, 50, 50) and |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
444 |
-- Delay victory if MrMine is triggered |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
445 |
(not MrMine or (MrMine and band(GetState(MrMine), gstAttacking) == 0)) then |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
446 |
-- Player managed to reach home in multiplayer. |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
447 |
-- Stop hog, disable controls, celebrate victory and continue the game after 4 seconds. |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
448 |
AddCaption(string.format(loc("%s climbed home in %d seconds!"), GetHogName(CurrentHedgehog), roundedFinishTime)) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
449 |
SendStat(siCustomAchievement, string.format(loc("%s (%s) reached home in %.3f seconds."), GetHogName(CurrentHedgehog), GetHogTeamName(CurrentHedgehog), finishTime)) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
450 |
makeMultiPlayerWinnerStat(CurrentHedgehog) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
451 |
PlaySound(sndVictory, CurrentHedgehog) |
12918
20e627c1ac20
ClimbHome, Sniper Rifle training: Unselect weapon after victory
Wuzzy <Wuzzy2@mail.ru>
parents:
12832
diff
changeset
|
452 |
SetWeapon(amNothing) |
12765
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
453 |
SetGearMessage(CurrentHedgehog, band(GetGearMessage(CurrentHedgehog), bnot(gmLeft+gmRight+gmUp+gmDown+gmHJump+gmLJump+gmPrecise))) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
454 |
SetInputMask(0x00) |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
455 |
-- TODO: Add stupid winner grin. |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
456 |
multiplayerVictoryDelay = 4000 |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
457 |
YouWon = true |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
458 |
end |
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
459 |
end |
10598
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
460 |
|
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
461 |
if GameTime % 500 == 0 then |
11894
c8979eeb73fa
Fix ClimbHome mission bugs (broken teams, broken graph)
Wuzzy <almikes@aol.com>
parents:
11640
diff
changeset
|
462 |
if not isSinglePlayer then |
c8979eeb73fa
Fix ClimbHome mission bugs (broken teams, broken graph)
Wuzzy <almikes@aol.com>
parents:
11640
diff
changeset
|
463 |
for t,i in pairs(teams) do |
c8979eeb73fa
Fix ClimbHome mission bugs (broken teams, broken graph)
Wuzzy <almikes@aol.com>
parents:
11640
diff
changeset
|
464 |
if currTeam == t then |
c8979eeb73fa
Fix ClimbHome mission bugs (broken teams, broken graph)
Wuzzy <almikes@aol.com>
parents:
11640
diff
changeset
|
465 |
SendStat(siClanHealth, tostring(getActualHeight(y)), t) |
c8979eeb73fa
Fix ClimbHome mission bugs (broken teams, broken graph)
Wuzzy <almikes@aol.com>
parents:
11640
diff
changeset
|
466 |
else |
c8979eeb73fa
Fix ClimbHome mission bugs (broken teams, broken graph)
Wuzzy <almikes@aol.com>
parents:
11640
diff
changeset
|
467 |
SendStat(siClanHealth, '0', t) |
c8979eeb73fa
Fix ClimbHome mission bugs (broken teams, broken graph)
Wuzzy <almikes@aol.com>
parents:
11640
diff
changeset
|
468 |
end |
10632
5ae7ba0b2849
pretty sure the other teams need stats at 0 for the graph to look right
nemo
parents:
10598
diff
changeset
|
469 |
end |
12765
5acf6b91df76
you know what... I think everything would have been fine if we'd simply required all this hog stuff to be in the same block...
nemo
parents:
12759
diff
changeset
|
470 |
else |
11894
c8979eeb73fa
Fix ClimbHome mission bugs (broken teams, broken graph)
Wuzzy <almikes@aol.com>
parents:
11640
diff
changeset
|
471 |
SendStat(siClanHealth, tostring(getActualHeight(y)), GetHogTeamName(CurrentHedgehog)) |
10632
5ae7ba0b2849
pretty sure the other teams need stats at 0 for the graph to look right
nemo
parents:
10598
diff
changeset
|
472 |
end |
10581 | 473 |
|
474 |
-- play taunts |
|
475 |
if not YouWon and not YouLost then |
|
476 |
local nooDistance = 500 |
|
477 |
if ((x < -nooDistance and vx < 0) or (x > LAND_WIDTH+nooDistance and vx > 0)) then |
|
478 |
if (tauntNoo == false and distanceFromWater > 80) then |
|
479 |
PlaySound(sndNooo, CurrentHedgehog) |
|
480 |
tauntNoo = true |
|
481 |
end |
|
482 |
end |
|
483 |
end |
|
484 |
||
12831
42003e235a46
remove some more test redundancy and restore a missing and important nil check
nemo
parents:
12830
diff
changeset
|
485 |
if addCake and CakeTries < 10 and y < 32600 and y > 3000 and Cake == nil then |
10581 | 486 |
-- doing this just after the start the first time to take advantage of randomness sources |
487 |
-- Pick a clear y to start with |
|
488 |
if y > 31000 then cy = 24585 elseif |
|
489 |
y > 28000 then cy = 21500 elseif |
|
490 |
y > 24000 then cy = 19000 elseif |
|
491 |
y > 21500 then cy = 16000 elseif |
|
492 |
y > 19000 then cy = 12265 elseif |
|
493 |
y > 16000 then cy = 8800 elseif |
|
494 |
y > 12000 then cy = 5700 else |
|
495 |
cy = 400 end |
|
496 |
Cake = AddGear(GetRandom(2048), cy, gtCake, 0, 0, 0, 0) |
|
497 |
SetHealth(Cake,999999) |
|
498 |
CakeTries = CakeTries + 1 |
|
499 |
end |
|
500 |
||
501 |
if (y > 286) or (y < 286 and MaxHeight > 286) then |
|
11640 | 502 |
if MaxHeight > 286 and y <= 286 then |
503 |
-- wow, reached top |
|
504 |
local teamName = GetHogTeamName(CurrentHedgehog) |
|
505 |
if teamTimes[teamName] == nil or teamTimes[teamName] > GameTime - startTime then |
|
506 |
teamTimes[teamName] = GameTime - startTime |
|
507 |
end |
|
508 |
MaxHeight = 286 |
|
509 |
end |
|
10581 | 510 |
if y < MaxHeight and y > 286 then MaxHeight = y end |
511 |
if MaxHeight < hTagHeight then |
|
512 |
hTagHeight = MaxHeight |
|
513 |
if hTag ~= nil then DeleteVisualGear(hTag) end |
|
514 |
hTag = AddVisualGear(0, 0, vgtHealthTag, 0, true) |
|
515 |
local g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(hTag) |
|
516 |
-- snagged from space invasion |
|
517 |
SetVisualGearValues ( |
|
518 |
hTag, --id |
|
519 |
-(ScreenWidth/2) + 40, --xoffset |
|
520 |
ScreenHeight - 60, --yoffset |
|
521 |
0, --dx |
|
522 |
0, --dy |
|
523 |
1.1, --zoom |
|
524 |
1, --~= 0 means align to screen |
|
525 |
g7, --frameticks |
|
526 |
-- 116px off bottom for lowest rock, 286 or so off top for position of chair |
|
527 |
-- 32650 is "0" |
|
528 |
32640-hTagHeight, --value |
|
529 |
99999999999,--timer |
|
530 |
GetClanColor(GetHogClan(CurrentHedgehog)) |
|
531 |
) |
|
532 |
end |
|
533 |
||
534 |
if MaxHeight < RecordHeight then |
|
535 |
RecordHeight = MaxHeight |
|
536 |
local oldName = RecordHeightHogName |
|
537 |
RecordHeightHogName = GetHogName(CurrentHedgehog) |
|
538 |
if oldName == nil then recordBroken = true end |
|
539 |
if not isSinglePlayer and RecordHeight > 1500 and not recordBroken then |
|
540 |
recordBroken = true |
|
541 |
AddCaption(string.format(loc("%s has passed the best height of %s!"), RecordHeightHogName, oldName)) |
|
542 |
end |
|
543 |
if not isSinglePlayer then |
|
544 |
if rTag ~= nil then DeleteVisualGear(rTag) end |
|
545 |
rTag = AddVisualGear(0, 0, vgtHealthTag, 0, true) |
|
546 |
local g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(hTag) |
|
547 |
-- snagged from space invasion |
|
548 |
SetVisualGearValues ( |
|
549 |
rTag, --id |
|
550 |
-(ScreenWidth/2) + 100, --xoffset |
|
551 |
ScreenHeight - 60, --yoffset |
|
552 |
0, --dx |
|
553 |
0, --dy |
|
554 |
1.1, --zoom |
|
555 |
1, --~= 0 means align to screen |
|
556 |
g7, --frameticks |
|
557 |
-- 116px off bottom for lowest rock, 286 or so off top for position of chair |
|
558 |
-- 32650 is "0" |
|
559 |
getActualHeight(RecordHeight), --value |
|
560 |
99999999999,--timer |
|
561 |
GetClanColor(GetHogClan(CurrentHedgehog)) |
|
562 |
) |
|
563 |
end |
|
564 |
end |
|
565 |
end |
|
566 |
if MaxHeight > 286 then |
|
567 |
if tTag ~= nil then DeleteVisualGear(tTag) end |
|
568 |
tTag = AddVisualGear(0, 0, vgtHealthTag, 0, true) |
|
569 |
local g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tTag) |
|
10413 | 570 |
-- snagged from space invasion |
571 |
SetVisualGearValues ( |
|
572 |
tTag, --id |
|
573 |
-(ScreenWidth/2) + 40, --xoffset |
|
574 |
ScreenHeight - 100, --yoffset |
|
575 |
0, --dx |
|
576 |
0, --dy |
|
577 |
1.1, --zoom |
|
578 |
1, --~= 0 means align to screen |
|
579 |
g7, --frameticks |
|
580 |
(GameTime-startTime)/1000, --value |
|
581 |
99999999999,--timer |
|
582 |
0xffffffff |
|
583 |
) |
|
10581 | 584 |
end |
10413 | 585 |
end |
586 |
end |
|
587 |
end |
|
10581 | 588 |
|
589 |
function onGearDamage(gear, damage) |
|
590 |
if GetGearType(gear) == gtHedgehog and not YouLost and not YouWon then |
|
591 |
-- Joke award for largest damage to hog |
|
592 |
local qualifyDamage = 50 |
|
593 |
if (damage >= qualifyDamage) then |
|
594 |
local awarded = false |
|
595 |
if jokeAwardDamage == nil or damage > jokeAwardDamage.damage then |
|
596 |
awarded = true |
|
597 |
end |
|
598 |
if awarded == true then |
|
599 |
jokeAwardDamage = { |
|
600 |
hogName = GetHogName(CurrentHedgehog), |
|
601 |
teamName = GetHogTeamName(CurrentHedgehog), |
|
602 |
damage = damage |
|
603 |
} |
|
604 |
end |
|
605 |
end |
|
606 |
||
607 |
if isSinglePlayer then |
|
608 |
makeSinglePlayerLoserStats() |
|
609 |
else |
|
610 |
deadHedgehogs = deadHedgehogs + 1 |
|
12660
913d25669131
ClimbHome: Fix final team scoring 0 if hog took damage
Wuzzy <almikes@aol.com>
parents:
12659
diff
changeset
|
611 |
makeMultiPlayerLoserStat(gear) |
12658
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
612 |
if (deadHedgehogs + multiplayerWins) >= totalHedgehogs then |
10581 | 613 |
makeFinalMultiPlayerStats() |
614 |
EndGame() |
|
11628
515d2d38ab8b
Declare achievements alongwith EndGame call, since it would skip SendStats
unc0rr
parents:
11620
diff
changeset
|
615 |
onAchievementsDeclaration() |
10581 | 616 |
end |
617 |
end |
|
618 |
YouLost = true |
|
619 |
end |
|
620 |
end |
|
621 |
||
622 |
function makeLoserComment() |
|
623 |
local m |
|
624 |
if isSinglePlayer then m = 10 else m = 6 end |
|
625 |
local r = math.random(1,m) |
|
626 |
if r == 1 then text = loc("%s never got the ninja diploma.") |
|
627 |
elseif r == 2 then text = loc("You have to move upwards, not downwards, %s!") |
|
628 |
elseif r == 3 then text = loc("%s never wanted to reach for the sky in the first place.") |
|
629 |
elseif r == 4 then text = loc("%s should try the rope training mission first.") |
|
630 |
elseif r == 5 then text = loc("%s skipped ninja classes.") |
|
631 |
elseif r == 6 then text = loc("%s doesn’t really know how to handle a rope properly.") |
|
632 |
elseif r == 7 then text = loc("Better luck next time!") |
|
633 |
elseif r == 8 then text = loc("It was all just bad luck!") |
|
634 |
elseif r == 9 then text = loc("Well, that escalated quickly!") |
|
635 |
elseif r == 10 then text = loc("What? Is it over already?") end |
|
636 |
return text |
|
637 |
end |
|
638 |
||
639 |
function makeSinglePlayerLoserStats() |
|
640 |
local actualHeight = getActualHeight(RecordHeight) |
|
641 |
SendStat(siGameResult, loc("You lose!")) |
|
642 |
SendStat(siGraphTitle, loc("Your height over time")) |
|
643 |
local text |
|
644 |
if actualHeight > 30000 then text = loc("%s was damn close to home.") |
|
645 |
elseif actualHeight > 28000 then text = loc("%s was close to home.") |
|
646 |
elseif actualHeight > 24265 then text = loc("%s was good, but not good enough.") |
|
647 |
elseif actualHeight > 16177 then text = loc("%s managed to pass half of the distance towards home.") |
|
648 |
elseif actualHeight > 8088 then text = loc("%s went over a quarter of the way towards home.") |
|
649 |
elseif actualHeight > 5100 then text = loc("%s still had a long way to go.") |
|
650 |
elseif actualHeight > 2000 then text = loc("%s made it past the hogosphere.") |
|
651 |
elseif actualHeight > 1500 then text = loc("%s barely made it past the hogosphere.") |
|
652 |
else |
|
653 |
text = makeLoserComment() |
|
654 |
end |
|
655 |
if actualHeight > 1500 then |
|
656 |
SendStat(siCustomAchievement, string.format(text, RecordHeightHogName, actualHeight)) |
|
657 |
else |
|
658 |
SendStat(siCustomAchievement, string.format(text, RecordHeightHogName)) |
|
659 |
end |
|
11067
c632b47b8ff0
Trying to get these scripts to behave properly, still WIP though.
nemo
parents:
10824
diff
changeset
|
660 |
SendStat(siPointType, loc("points")) |
12429
b9cc405541c1
Fix various loc() syntax errors in scripts
Wuzzy <almikes@aol.com>
parents:
12397
diff
changeset
|
661 |
SendStat(siPlayerKills, actualHeight, GetHogTeamName(CurrentHedgehog)) |
10581 | 662 |
EndGame() |
11628
515d2d38ab8b
Declare achievements alongwith EndGame call, since it would skip SendStats
unc0rr
parents:
11620
diff
changeset
|
663 |
onAchievementsDeclaration() |
10581 | 664 |
end |
665 |
||
666 |
function makeMultiPlayerLoserStat(gear) |
|
667 |
local teamName = GetHogTeamName(gear) |
|
668 |
local actualHeight = getActualHeight(MaxHeight) |
|
669 |
if teamBests[teamName] == nil then teamBests[teamName] = actualHeight end |
|
670 |
if teamBests[teamName] < actualHeight then teamBests[teamName] = actualHeight end |
|
671 |
if teamScoreStats[teamName] == nil then teamScoreStats[teamName] = {} end |
|
672 |
table.insert(teamScoreStats[teamName], actualHeight) |
|
10598
9dd0f41d3244
This should probably fix multiplayer desync, but is the result of fiddling while pretty sick/feverish so, needs testing, and the water/scaling stuff is disabled.
nemo
parents:
10593
diff
changeset
|
673 |
--SendStat(siClanHealth, tostring(teamBests[teamName]), teamName) |
10581 | 674 |
end |
675 |
||
12658
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
676 |
function makeMultiPlayerWinnerStat(gear) |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
677 |
return makeMultiPlayerLoserStat(gear) |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
678 |
end |
1215fd246e08
Climb Home: Fix game getting stuck when player reaches home
Wuzzy <almikes@aol.com>
parents:
12429
diff
changeset
|
679 |
|
10581 | 680 |
function makeFinalMultiPlayerStats() |
681 |
local ranking = {} |
|
682 |
for k,v in pairs(teamBests) do |
|
683 |
table.insert(ranking, {name=k, score=v}) |
|
684 |
end |
|
685 |
local comp = function(table1, table2) |
|
686 |
if table1.score < table2.score then |
|
687 |
return true |
|
688 |
else |
|
689 |
return false |
|
690 |
end |
|
691 |
end |
|
692 |
table.sort(ranking, comp) |
|
693 |
||
694 |
local winner = ranking[#ranking] |
|
695 |
local loser = ranking[1] |
|
696 |
SendStat(siGameResult, string.format(loc("%s wins!"), winner.name)) |
|
11894
c8979eeb73fa
Fix ClimbHome mission bugs (broken teams, broken graph)
Wuzzy <almikes@aol.com>
parents:
11640
diff
changeset
|
697 |
SendStat(siGraphTitle, string.format(loc("Height over time"))) |
10581 | 698 |
|
699 |
if winner.score < 1500 then |
|
11067
c632b47b8ff0
Trying to get these scripts to behave properly, still WIP though.
nemo
parents:
10824
diff
changeset
|
700 |
SendStat(siCustomAchievement, string.format(loc("This round’s award for ultimate disappointment goes to: Everyone!"))) |
10581 | 701 |
else |
702 |
if winner.score > 30000 then text = loc("%s (%s) reached for the sky and beyond with a height of %d!") |
|
703 |
elseif winner.score > 24750 then text = loc("%s (%s) was certainly not afraid of heights: Peak height of %d!") |
|
704 |
elseif winner.score > 16500 then text = loc("%s (%s) does not have to feel ashamed for their best height of %d.") |
|
705 |
elseif winner.score > 8250 then text = loc("%s (%s) reached a decent peak height of %d.") |
|
706 |
else text = loc("%s (%s) reached a peak height of %d.") end |
|
707 |
SendStat(siCustomAchievement, string.format(text, RecordHeightHogName, winner.name, winner.score)) |
|
708 |
||
709 |
if loser.score < 1500 then |
|
710 |
text = makeLoserComment() |
|
711 |
SendStat(siCustomAchievement, string.format(text, loser.name)) |
|
712 |
end |
|
713 |
end |
|
714 |
checkAwards() |
|
715 |
for i = #ranking, 1, -1 do |
|
10632
5ae7ba0b2849
pretty sure the other teams need stats at 0 for the graph to look right
nemo
parents:
10598
diff
changeset
|
716 |
SendStat(siPointType, loc("points")) |
10581 | 717 |
SendStat(siPlayerKills, tostring(ranking[i].score), ranking[i].name) |
718 |
end |
|
719 |
end |
|
720 |
||
721 |
function checkAwards() |
|
722 |
if jokeAwardNavy ~= nil then |
|
723 |
if isSinglePlayer then |
|
724 |
SendStat(siCustomAchievement, string.format(loc("The Navy greets %s for managing to get in a distance of %d away from the mainland!"), jokeAwardNavy.hogName, jokeAwardNavy.distance)) |
|
725 |
else |
|
726 |
SendStat(siCustomAchievement, string.format(loc("Greetings from the Navy, %s (%s), for being a distance of %d away from the mainland!"), jokeAwardNavy.hogName, jokeAwardNavy.teamName, jokeAwardNavy.distance)) |
|
727 |
end |
|
728 |
end |
|
729 |
if jokeAwardSpeed ~= nil then |
|
730 |
if isSinglePlayer then |
|
731 |
SendStat(siCustomAchievement, string.format(loc("Your hedgehog was panicly afraid of the water and decided to go in a safe distance of %d from it."), jokeAwardSpeed.distance)) |
|
732 |
else |
|
733 |
SendStat(siCustomAchievement, string.format(loc("%s (%s) was panicly afraid of the water and decided to get in a safe distance of %d from it."), jokeAwardSpeed.hogName, jokeAwardSpeed.teamName, jokeAwardSpeed.distance)) |
|
734 |
end |
|
735 |
end |
|
736 |
if jokeAwardDamage ~= nil then |
|
737 |
if isSinglePlayer then |
|
738 |
SendStat(siCustomAchievement, string.format(loc("Ouch! That must have hurt. You mutilated your poor hedgehog hog with %d damage."), jokeAwardDamage.damage)) |
|
739 |
else |
|
740 |
SendStat(siCustomAchievement, string.format(loc("Ouch! That must have hurt. %s (%s) hit the ground with %d damage points."), jokeAwardDamage.hogName, jokeAwardDamage.teamName, jokeAwardDamage.damage)) |
|
741 |
end |
|
742 |
end |
|
743 |
end |
|
744 |
||
745 |
function getActualHeight(height) |
|
746 |
return 32640-height |
|
747 |
end |
|
11620 | 748 |
|
749 |
function onAchievementsDeclaration() |
|
750 |
for teamname, score in pairs(teamBests) do |
|
11632 | 751 |
DeclareAchievement("height reached", teamname, "ClimbHome", -score) |
11620 | 752 |
end |
11640 | 753 |
for teamname, score in pairs(teamTimes) do |
754 |
DeclareAchievement("rope race", teamname, "ClimbHome", score) |
|
755 |
end |
|
11620 | 756 |
end |