WxW: Play taunt if crate spawns between turns
authorWuzzy <Wuzzy2@mail.ru>
Mon, 08 Apr 2019 19:16:02 +0200
changeset 14778 a9f32ff53389
parent 14777 f5dcf47dff2c
child 14779 d0ad9fd923fd
WxW: Play taunt if crate spawns between turns
share/hedgewars/Data/Scripts/Multiplayer/WxW.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua	Mon Apr 08 19:02:01 2019 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua	Mon Apr 08 19:16:02 2019 +0200
@@ -853,15 +853,20 @@
 end
 
 function onCaseDrop()
+	local crates
 	if roundN == 100 then
 		allowCrate = crateGearsInGame < maxCrates
-		CheckCrateConditions()
+		crates = CheckCrateConditions()
+	end
+	if type(crates) == "table" and #crates > 0 and CurrentHedgehog then
+		PlaySound(sndReinforce, CurrentHedgehog)
 	end
 end
 
 function CheckCrateConditions()
 
 	local crateSpawn = AreCratesUnlocked()
+	local crates = {}
 
 	if crateSpawn == true and crateSpawned == false then
 		UnfreezeCrates()
@@ -872,7 +877,7 @@
 				toSpawn = maxCrates - cratesInGame
 			end
 			for i=1,toSpawn do
-				SpawnSupplyCrate(0, 0, weapons[1+GetRandom(#weapons)] )
+				table.insert(crates, SpawnSupplyCrate(0, 0, weapons[1+GetRandom(#weapons)]))
 			end
 			rPingTimer = 0
 			rAlpha = 0
@@ -882,6 +887,7 @@
 		end
 	end
 
+	return crates
 end
 
 function onGearWaterSkip(gear)