Make sure scripts don't break w/ only 1 clan
authorWuzzy <Wuzzy2@mail.ru>
Tue, 11 Sep 2018 16:18:24 +0200
changeset 13774 e874bfe563c7
parent 13773 c084bd440009
child 13775 baf15d31cd42
Make sure scripts don't break w/ only 1 clan See also: c084bd440009
share/hedgewars/Data/Maps/CTF_Blizzard/map.lua
share/hedgewars/Data/Maps/TrophyRace/map.lua
share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua
--- a/share/hedgewars/Data/Maps/CTF_Blizzard/map.lua	Tue Sep 11 16:00:23 2018 +0200
+++ b/share/hedgewars/Data/Maps/CTF_Blizzard/map.lua	Tue Sep 11 16:18:24 2018 +0200
@@ -580,6 +580,10 @@
 	fSpawnX[1] = 3123
 	fSpawnY[1] = 1747
 
+	if ClansCount < 2 then
+		return
+	end
+
 	for i = 0, 1 do
 		fGear[i] = SpawnFakeAmmoCrate(fSpawnX[i],fSpawnY[i],false,false)
 		fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true)
--- a/share/hedgewars/Data/Maps/TrophyRace/map.lua	Tue Sep 11 16:00:23 2018 +0200
+++ b/share/hedgewars/Data/Maps/TrophyRace/map.lua	Tue Sep 11 16:18:24 2018 +0200
@@ -82,7 +82,9 @@
     for i=0, ClansCount-1 do
         clantimes[i] = 0
     end
-    SendAchievementsStatsOff()
+    if ClansCount >= 2 then
+        SendAchievementsStatsOff()
+    end
 end
 
 function onAmmoStoreInit()
--- a/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Tue Sep 11 16:00:23 2018 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Tue Sep 11 16:18:24 2018 +0200
@@ -153,9 +153,11 @@
 end
 
 function onGameStart()
-    SendHealthStatsOff()
+    if ClansCount >= 2 then
+        SendHealthStatsOff()
+        SendAchievementsStatsOff()
+    end
     SendRankingStatsOff()
-    SendAchievementsStatsOff()
     trackTeams()
     teamScan()
     runOnHogs(saveStuff)
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Tue Sep 11 16:00:23 2018 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Tue Sep 11 16:18:24 2018 +0200
@@ -663,10 +663,12 @@
 end
 
 function onGameStart()
-	SendGameResultOff()
-	SendRankingStatsOff()
-        SendHealthStatsOff()
-	SendAchievementsStatsOff()
+	if ClansCount >= 2 then
+		SendGameResultOff()
+		SendRankingStatsOff()
+        	SendHealthStatsOff()
+		SendAchievementsStatsOff()
+	end
 
         SetSoundMask(sndIncoming, true)
         SetSoundMask(sndMissed, true)
--- a/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua	Tue Sep 11 16:00:23 2018 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua	Tue Sep 11 16:18:24 2018 +0200
@@ -1091,10 +1091,12 @@
 end
 
 function onGameStart()
-	SendGameResultOff()
-	SendRankingStatsOff()
-	SendAchievementsStatsOff()
-	SendHealthStatsOff()
+	if ClansCount >= 2 then
+		SendGameResultOff()
+		SendRankingStatsOff()
+		SendAchievementsStatsOff()
+		SendHealthStatsOff()
+	end
 
 	ShowMission	(
 				loc("SPACE INVASION"),
--- a/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua	Tue Sep 11 16:00:23 2018 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua	Tue Sep 11 16:18:24 2018 +0200
@@ -864,10 +864,12 @@
 end
 
 function onGameStart()
-	SendGameResultOff()
-	SendRankingStatsOff()
-	SendAchievementsStatsOff()
-	SendHealthStatsOff()
+	if ClansCount >= 2 then
+		SendGameResultOff()
+		SendRankingStatsOff()
+		SendAchievementsStatsOff()
+		SendHealthStatsOff()
+	end
 
 	trackTeams()