changeset 12759 | c7224d202e8b |
parent 12758 | 327f71313e04 |
child 12765 | 5acf6b91df76 |
12758:327f71313e04 | 12759:c7224d202e8b |
---|---|
47 local airMine = {} |
47 local airMine = {} |
48 local init = true |
48 local init = true |
49 local multiplayerVictoryDelay = -1 |
49 local multiplayerVictoryDelay = -1 |
50 local multiplayerWinningHogs = {} |
50 local multiplayerWinningHogs = {} |
51 local multiplayerWins = 0 |
51 local multiplayerWins = 0 |
52 local racing = false |
|
52 |
53 |
53 -- Placement positions of winning hogs |
54 -- Placement positions of winning hogs |
54 local victoryPosses = { } |
55 local victoryPosses = { } |
55 do |
56 do |
56 local m = 0 |
57 local m = 0 |
115 elseif gear == Cake then |
116 elseif gear == Cake then |
116 Cake = nil |
117 Cake = nil |
117 elseif GetGearType(gear) == gtHedgehog then |
118 elseif GetGearType(gear) == gtHedgehog then |
118 onGameTick20() |
119 onGameTick20() |
119 onGearDamage(gear, 0) |
120 onGearDamage(gear, 0) |
121 ready = false |
|
120 HH[gear] = nil |
122 HH[gear] = nil |
121 end |
123 end |
122 end |
124 end |
123 |
125 |
124 function onGameStart() |
126 function onGameStart() |
249 |
251 |
250 |
252 |
251 function onGameTick20() |
253 function onGameTick20() |
252 local x,y |
254 local x,y |
253 |
255 |
254 if gameTime - startTime < 40 then |
|
255 return |
|
256 end |
|
257 |
|
258 if math.random(20) == 1 then AddVisualGear(2012,56,vgtSmoke,0,false) end |
256 if math.random(20) == 1 then AddVisualGear(2012,56,vgtSmoke,0,false) end |
259 if CurrentHedgehog == dummyHog and dummySkip ~= 0 and dummySkip < GameTime then |
257 if CurrentHedgehog == dummyHog and dummySkip ~= 0 and dummySkip < GameTime then |
260 ParseCommand("/skip") |
258 ParseCommand("/skip") |
261 dummySkip = 0 |
259 dummySkip = 0 |
262 end |
260 end |
277 --else wasn't really visible, pointless. |
275 --else wasn't really visible, pointless. |
278 -- g5 = g5+1 |
276 -- g5 = g5+1 |
279 -- if g5 > 360 then g5 = 0 end |
277 -- if g5 > 360 then g5 = 0 end |
280 -- SetVisualGearValues(s, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10) |
278 -- SetVisualGearValues(s, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10) |
281 --end |
279 --end |
280 end |
|
281 |
|
282 if not ready then |
|
283 return |
|
282 end |
284 end |
283 |
285 |
284 -- This will be executed if a player reached home in multiplayer |
286 -- This will be executed if a player reached home in multiplayer |
285 if multiplayerVictoryDelay > 0 then |
287 if multiplayerVictoryDelay > 0 then |
286 multiplayerVictoryDelay = multiplayerVictoryDelay - 20 |
288 multiplayerVictoryDelay = multiplayerVictoryDelay - 20 |
415 local roundedFinishTime = math.ceil(math.floor(finishTime+0.5)) |
417 local roundedFinishTime = math.ceil(math.floor(finishTime+0.5)) |
416 if isSinglePlayer then |
418 if isSinglePlayer then |
417 if distanceFromWater < 0 and not YouLost and not YouWon then |
419 if distanceFromWater < 0 and not YouLost and not YouWon then |
418 makeSinglePlayerLoserStats() |
420 makeSinglePlayerLoserStats() |
419 YouLost = true |
421 YouLost = true |
422 ready = false |
|
420 end |
423 end |
421 -- FIXME: Hog is also in winning box if it just walks into the chair from the left, touching it. Intentional? |
424 -- FIXME: Hog is also in winning box if it just walks into the chair from the left, touching it. Intentional? |
422 if not YouWon and not YouLost and gearIsInBox(CurrentHedgehog, 1920, 252, 50, 50) then |
425 if not YouWon and not YouLost and gearIsInBox(CurrentHedgehog, 1920, 252, 50, 50) then |
423 AddCaption(loc("Victory!")) |
426 AddCaption(loc("Victory!")) |
424 ShowMission(loc("Climb Home"), |
427 ShowMission(loc("Climb Home"), |
435 SendStat(siPlayerKills, tostring(roundedFinishTime), GetHogTeamName(CurrentHedgehog)) |
438 SendStat(siPlayerKills, tostring(roundedFinishTime), GetHogTeamName(CurrentHedgehog)) |
436 |
439 |
437 EndGame() |
440 EndGame() |
438 onAchievementsDeclaration() |
441 onAchievementsDeclaration() |
439 YouWon = true |
442 YouWon = true |
443 ready = false |
|
440 end |
444 end |
441 else |
445 else |
442 if distanceFromWater < 0 and not YouLost and not YouWon then |
446 if distanceFromWater < 0 and not YouLost and not YouWon then |
443 makeMultiPlayerLoserStat(CurrentHedgehog) |
447 makeMultiPlayerLoserStat(CurrentHedgehog) |
444 deadHedgehogs = deadHedgehogs + 1 |
448 deadHedgehogs = deadHedgehogs + 1 |
445 YouLost = true |
449 YouLost = true |
450 ready = false |
|
446 if deadHedgehogs >= totalHedgehogs then |
451 if deadHedgehogs >= totalHedgehogs then |
447 makeFinalMultiPlayerStats() |
452 makeFinalMultiPlayerStats() |
448 EndGame() |
453 EndGame() |
449 onAchievementsDeclaration() |
454 onAchievementsDeclaration() |
450 end |
455 end |
464 SetGearMessage(CurrentHedgehog, band(GetGearMessage(CurrentHedgehog), bnot(gmLeft+gmRight+gmUp+gmDown+gmHJump+gmLJump+gmPrecise))) |
469 SetGearMessage(CurrentHedgehog, band(GetGearMessage(CurrentHedgehog), bnot(gmLeft+gmRight+gmUp+gmDown+gmHJump+gmLJump+gmPrecise))) |
465 SetInputMask(0x00) |
470 SetInputMask(0x00) |
466 -- TODO: Add stupid winner grin. |
471 -- TODO: Add stupid winner grin. |
467 multiplayerVictoryDelay = 4000 |
472 multiplayerVictoryDelay = 4000 |
468 YouWon = true |
473 YouWon = true |
474 ready = false |
|
469 end |
475 end |
470 end |
476 end |
471 |
477 |
472 if GameTime % 500 == 0 then |
478 if GameTime % 500 == 0 then |
473 if not isSinglePlayer then |
479 if not isSinglePlayer then |
625 EndGame() |
631 EndGame() |
626 onAchievementsDeclaration() |
632 onAchievementsDeclaration() |
627 end |
633 end |
628 end |
634 end |
629 YouLost = true |
635 YouLost = true |
636 ready = false |
|
630 end |
637 end |
631 end |
638 end |
632 |
639 |
633 function makeLoserComment() |
640 function makeLoserComment() |
634 local m |
641 local m |