--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua Mon Sep 25 21:18:59 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua Mon Sep 25 21:41:38 2017 +0200
@@ -191,6 +191,11 @@
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
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/global_functions.lua Mon Sep 25 21:18:59 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/global_functions.lua Mon Sep 25 21:41:38 2017 +0200
@@ -118,13 +118,16 @@
if GetCampaignVar("CurrentMission") ~= mission then
SaveCampaignVar("CurrentMission", mission)
SaveCampaignVar("CurrentMissionCheckpoint", 1)
- SaveCampaignVar("HogsPosition", "")
else
- checkPoint = tonumber(GetCampaignVar("currentMissionCheckpoint"))
+ checkPoint = tonumber(GetCampaignVar("CurrentMissionCheckpoint"))
end
return checkPoint
end
+function resetCheckpoint(mission)
+ SaveCampaignVar("CurrentMissionCheckpoint", 1)
+end
+
function saveCheckpoint(cp)
SaveCampaignVar("CurrentMissionCheckpoint", cp)
end