CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
authorWuzzy <Wuzzy2@mail.ru>
Thu, 08 Mar 2018 15:37:49 +0100
changeset 13122 cd1561b0337f
parent 13121 3b7cd18c4a06
child 13123 1ddb8aac5e30
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
ChangeLog.txt
share/hedgewars/Data/Maps/CTF_Blizzard/map.lua
--- a/ChangeLog.txt	Thu Mar 08 15:15:11 2018 +0100
+++ b/ChangeLog.txt	Thu Mar 08 15:37:49 2018 +0100
@@ -57,6 +57,7 @@
  * Capture the Flag: Fix many bugs caused by playing with >2 teams
  * Capture the Flag: Properly place flag when first hog uses kamikaze or TimeBox
  * Capture the Flag: Fix flag not being dropped when carrier uses piano strike
+ * CTF_Blizzard: Don't allow more than 2 clans. Excess hogs will be removed
 
 A Space Adventure:
  + Precise Shooting: Display collected ammo
--- a/share/hedgewars/Data/Maps/CTF_Blizzard/map.lua	Thu Mar 08 15:15:11 2018 +0100
+++ b/share/hedgewars/Data/Maps/CTF_Blizzard/map.lua	Thu Mar 08 15:37:49 2018 +0100
@@ -435,15 +435,12 @@
 					SetGearMessage(CurrentHedgehog, gmAttack)
 				end
 			end
-			--AddCaption(actionReset .. ";" .. "attack")
 		elseif actionReset == 10 then
 			SetGearMessage(CurrentHedgehog, 0)
-			--AddCaption(actionReset .. ";" .. "reset")
 		elseif actionReset == 20 then
 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false)
 			SetGearPosition(CurrentHedgehog,destinationX,destinationY)
 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false)
-			--AddCaption(actionReset .. ";" .. "teleport")
 		end
 
 		actionReset = actionReset + 1
@@ -529,16 +526,15 @@
 
 	-- Things we don't modify here will use their default values.
 	GameFlags = gfDivideTeams -- Game settings and rules
-	TurnTime = 30000 -- (was 30) The time the player has to move each round (in ms)
+	TurnTime = 30000 -- The time the player has to move each round (in ms)
 	CaseFreq = 0 -- The frequency of crate drops
 	MinesNum = 0 -- The number of mines being placed
-	MinesTime  = 2000
 	Explosives = 0 -- The number of explosives being placed
 	-- Disable Sudden Death
 	WaterRise = 0
 	HealthDecrease = 0
 	Map = "Blizzard" -- The map to be played
-	Theme = "Snow" -- The theme to be used "Nature"
+	Theme = "Snow" -- The theme to be used
 
 end
 
@@ -701,17 +697,25 @@
 
 end
 
+local excessHogsWarning = false
+
 function onGearAdd(gear)
 
 	if GetGearType(gear) == gtHedgehog then
 
-		hhs[numhhs] = gear
-		numhhs = numhhs + 1
-		SetEffect(gear, heResurrectable, 1)
+		if GetHogClan(gear) > 1 then
+			DeleteGear(gear)
+			if not excessHogsWarning then
+				WriteLnToChat(loc("Only two clans allowed! Excess hedgehogs will be removed."))
+				excessHogsWarning = true
+			end
+		else
+			hhs[numhhs] = gear
+			numhhs = numhhs + 1
+			SetEffect(gear, heResurrectable, 1)
+		end
 
-	end
-
-	if GetGearType(gear) == gtRope then
+	elseif GetGearType(gear) == gtRope then
 		ropeGear = gear
 	end