# HG changeset patch # User Wuzzy # Date 1506371110 -7200 # Node ID a5ddc6b4abbd8e37eac42d0778a43d79a67ee4b6 # Parent f2a19a6056be90e5fcd048019860d21d55401c1e ASA: Inform the player about a checkpoint reset diff -r f2a19a6056be -r a5ddc6b4abbd share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua --- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua Mon Sep 25 21:41:38 2017 +0200 +++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua Mon Sep 25 22:25:10 2017 +0200 @@ -55,6 +55,8 @@ local teamC = {} -- to check if flying saucer is active local saucerGear = nil +-- if player abandoned any incomplete planet mission +local abandonedPlanetMission = false -- hedgehogs values hero.name = loc("Hog Solo") hero.x = 1450 @@ -156,6 +158,12 @@ end end AnimInit(startSequence) + + -- Reset checkpoint of other missions when entering this mission. + -- The player has left the planet, so we count that “abandoning” any incomplete missions. + -- This also allows the player (indirectly) to reset the checkpointed missions. + abandonedPlanetMission = resetCheckpoint() + AnimationSetup() end @@ -191,11 +199,6 @@ AddAmmo(hero.gear, amJetpack, 100) end - -- Reset checkpoint of other missions when entering this mission. - -- The player has left the planet, so we count that “abandoning” any incomplete missions. - -- This also allows the player (indirectly) to reset the checkpointed missions. - abandoned = resetCheckpoint() - AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) AddEvent(onNoFuelAtLand, {hero.gear}, noFuelAtLand, {hero.gear}, 0) -- always check for landings @@ -255,7 +258,16 @@ SetAmmo(amJetpack, 0, 0, 0, 1) end +local abandonCheck = false + function onNewTurn() + if not abandonCheck and checkPointReached == 5 then + if abandonedPlanetMission then + HogSay(hero.gear, loc("I just forgot all checkpoints of incomplete missions."), SAY_THINK) + end + abandonCheck = false + end + if guard1.keepTurning then AnimSwitchHog(hero.gear) TurnTimeLeft = -1 @@ -598,6 +610,10 @@ -- DIALOG 05 - Hero returned from moon without fuels AddSkipFunction(dialog05, Skipanim, {dialog05}) table.insert(dialog05, {func = AnimSay, args = {hero.gear, loc("I guess I can't go far without fuel!"), SAY_THINK, 6000}}) + if abandonedPlanetMission then + -- Hog solo is mad he has to play the moon main mission from start. Very sarcastic tone. ;-) + table.insert(dialog05, {func = AnimSay, args = {hero.gear, loc("And I just forgot the checkpoint of my main mission. Great, just great!"), SAY_THINK, 7000}}) + end table.insert(dialog05, {func = AnimSay, args = {hero.gear, loc("Got to go back."), SAY_THINK, 2000}}) table.insert(dialog05, {func = sendStatsOnRetry, args = {hero.gear}}) -- DIALOG 06 - Landing on wrong planet or on earth if not enough fuels diff -r f2a19a6056be -r a5ddc6b4abbd share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/global_functions.lua --- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/global_functions.lua Mon Sep 25 21:41:38 2017 +0200 +++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/global_functions.lua Mon Sep 25 22:25:10 2017 +0200 @@ -124,8 +124,13 @@ return checkPoint end +-- Reset mission checkpoint to 1 +-- Returns true if the player reached a checkpoint before, false otherwise. function resetCheckpoint(mission) + local cp = tonumber(GetCampaignVar("CurrentMissionCheckpoint")) SaveCampaignVar("CurrentMissionCheckpoint", 1) + + return (type(cp) == "number" and cp > 1) end function saveCheckpoint(cp)