share/hedgewars/Data/Missions/Scenario/User_Mission_-_Spooky_Tree.lua
changeset 15091 5c8c729a16ce
parent 15015 a1165392c9db
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Spooky_Tree.lua	Fri May 31 21:10:17 2019 +0200
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Spooky_Tree.lua	Fri May 31 21:39:47 2019 +0200
@@ -3,6 +3,7 @@
 
 ---------------------------------------------------------------
 
+local playerTeamName
 local player = nil -- This variable will point to the hog's gear
 local instructor = nil
 local enemy = nil
@@ -29,7 +30,7 @@
 	HealthDecrease = 0
 	WaterRise = 0
 
-	AddMissionTeam(-1)
+	playerTeamName = AddMissionTeam(-1)
 	player = AddMissionHog(1)
 	AddTeam(loc("Toxic Team"), -6, "skull", "Island", "Default_qau", "cm_magicskull")
 	enemy = AddHog(loc("Poison"), 1, 10, "Skull")
@@ -116,7 +117,6 @@
 	end
 
 	if TurnTimeLeft == 1 then
-		--ShowMission(loc(caption), loc(subcaption), loc(timeout), -amSkip, 0);
 		SetHealth(player, 0)
 		GameOver = true
 	end
@@ -149,12 +149,12 @@
 end
 
 function onGameResult(winner)
-	if winner == 0 then
-		ShowMission(loc("Spooky Tree"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0);
+	if winner == GetTeamClan(playerTeamName) then
 		SaveMissionVar("Won", "true")
+		SendStat(siGameResult, loc("Mission succeeded!"))
 		GameOver = true
 	else
-		ShowMission(loc("Spooky Tree"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
+		SendStat(siGameResult, loc("Mission failed!"))
 		GameOver = true
 	end
 end