ACF: Show "Mission succeeded/failed" in stats screen
authorWuzzy <Wuzzy2@mail.ru>
Mon, 17 Jun 2019 19:20:02 +0200
changeset 15172 9d4a6ab60dec
parent 15171 d2e477eee433
child 15173 e1dbe2c9026f
ACF: Show "Mission succeeded/failed" in stats screen
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/enemy.lua
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/first_blood.lua
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/queen.lua
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/shadow.lua
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/united.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua	Mon Jun 17 00:10:18 2019 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua	Mon Jun 17 19:20:02 2019 +0200
@@ -1260,3 +1260,11 @@
     highJumped = true
   end
 end
+
+function onGameResult(winner)
+  if winner == GetTeamClan(nativesTeamName) then
+    SendStat(siGameResult, loc("Mission succeeded!"))
+  else
+    SendStat(siGameResult, loc("Mission failed!"))
+  end
+end
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua	Mon Jun 17 00:10:18 2019 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua	Mon Jun 17 19:20:02 2019 +0200
@@ -170,7 +170,7 @@
 cyborgsPos = {{2937, 831}, {2945, 1264}, {2335, 1701}, {448, 484}}
 cyborgsDir = {"Left", "Left", "Left", "Right"}
 
-cyborgTeamName, fighterTeamName = nil, nil
+cyborgTeamName, fighterTeamName, nativesTeamName = nil, nil, nil
 
 cratePos = {
             {{788, 1919, amGirder, 2}, true}, {{412, 1615, amGirder, 1}, true},
@@ -639,7 +639,7 @@
 end
 
 function AddHogs()
-  AddMissionTeam(-2)
+  nativesTeamName = AddMissionTeam(-2)
   for i = 1, 7 do
     natives[i] = AddHog(nativeNames[i], 0, 200, nativeHats[i])
     gearDead[natives[i]] = false
@@ -771,3 +771,12 @@
     SetAnimSkip(true)
   end
 end
+
+function onGameResult(winner)
+  if winner == GetTeamClan(nativesTeamName) then
+    SendStat(siGameResult, loc("Mission succeeded!"))
+  else
+    SendStat(siGameResult, loc("Mission failed!"))
+  end
+end
+
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/enemy.lua	Mon Jun 17 00:10:18 2019 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/enemy.lua	Mon Jun 17 19:20:02 2019 +0200
@@ -727,3 +727,12 @@
     SetAnimSkip(true)
   end
 end
+
+function onGameResult(winner)
+  if winner == GetTeamClan(nativesTeamName) then
+    SendStat(siGameResult, loc("Mission succeeded!"))
+  else
+    SendStat(siGameResult, loc("Mission failed!"))
+  end
+end
+
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua	Mon Jun 17 00:10:18 2019 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua	Mon Jun 17 19:20:02 2019 +0200
@@ -673,3 +673,12 @@
 --  end
 --  AddAmmo(natives[1], amTeleport, 100)
 end
+
+function onGameResult(winner)
+  if winner == GetTeamClan(nativesTeamName) then
+    SendStat(siGameResult, loc("Mission succeeded!"))
+  else
+    SendStat(siGameResult, loc("Mission failed!"))
+  end
+end
+
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/first_blood.lua	Mon Jun 17 00:10:18 2019 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/first_blood.lua	Mon Jun 17 19:20:02 2019 +0200
@@ -121,6 +121,7 @@
 rope2GirderX = 3245
 rope2GirderY = 1190
 
+nativesTeamName = nil
 inCrateChallenge = false
 cratesCollected = 0
 chalTries = 0
@@ -756,7 +757,7 @@
 	HealthDecrease = 0
 
 
-  AddMissionTeam(-2)
+  nativesTeamName = AddMissionTeam(-2)
   youngh = AddHog(loc("Leaks A Lot"), 0, 100, "Rambo")
   elderh = AddHog(loc("Righteous Beard"), 0, 99, "IndianChief")
   princess = AddHog(loc("Fell From Heaven"), 0, 300, "tiara")
@@ -935,3 +936,11 @@
     DoChoice()
   end
 end
+
+function onGameResult(winner)
+  if winner == GetTeamClan(nativesTeamName) then
+    SendStat(siGameResult, loc("Mission succeeded!"))
+  else
+    SendStat(siGameResult, loc("Mission failed!"))
+  end
+end
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua	Mon Jun 17 00:10:18 2019 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua	Mon Jun 17 19:20:02 2019 +0200
@@ -1222,3 +1222,10 @@
   end
 end
 
+function onGameResult(winner)
+  if winner == GetTeamClan(nativesTeamName) then
+    SendStat(siGameResult, loc("Mission succeeded!"))
+  else
+    SendStat(siGameResult, loc("Mission failed!"))
+  end
+end
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/queen.lua	Mon Jun 17 00:10:18 2019 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/queen.lua	Mon Jun 17 19:20:02 2019 +0200
@@ -858,3 +858,11 @@
     SetAnimSkip(true)
   end
 end
+
+function onGameResult(winner)
+  if winner == GetTeamClan(nativesTeamName) then
+    SendStat(siGameResult, loc("Mission succeeded!"))
+  else
+    SendStat(siGameResult, loc("Mission failed!"))
+  end
+end
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/shadow.lua	Mon Jun 17 00:10:18 2019 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/shadow.lua	Mon Jun 17 19:20:02 2019 +0200
@@ -1162,3 +1162,10 @@
   end
 end
 
+function onGameResult(winner)
+  if winner == GetTeamClan(nativesTeamName) then
+    SendStat(siGameResult, loc("Mission succeeded!"))
+  else
+    SendStat(siGameResult, loc("Mission failed!"))
+  end
+end
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/united.lua	Mon Jun 17 00:10:18 2019 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/united.lua	Mon Jun 17 19:20:02 2019 +0200
@@ -551,3 +551,10 @@
   end
 end
 
+function onGameResult(winner)
+  if winner == GetTeamClan(nativesTeamName) then
+    SendStat(siGameResult, loc("Mission succeeded!"))
+  else
+    SendStat(siGameResult, loc("Mission failed!"))
+  end
+end