HedgeEditor: Allow health crates with 0 health
authorWuzzy <almikes@aol.com>
Wed, 20 Apr 2016 17:31:34 +0200
changeset 12030 325b39ee6bc8
parent 12029 16dbc3a92d14
child 12031 6bc9a499c60b
HedgeEditor: Allow health crates with 0 health
share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Wed Nov 23 13:53:51 2016 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Wed Apr 20 17:31:34 2016 +0200
@@ -1245,7 +1245,9 @@
 			if pMode[pIndex][2] == "set" then
 				SetHealth(sGear, pMode[pIndex][1])
 			elseif pMode[pIndex][2] == "mod" then
-				local newHealth = math.max(1, GetHealth(sGear) + tonumber(pMode[pIndex][1]))
+				local min
+				if gt == gtCase then min = 0 else min = 1 end
+				local newHealth = math.max(min, GetHealth(sGear) + tonumber(pMode[pIndex][1]))
 				SetHealth(sGear, newHealth)
 			end
 		elseif gt == gtMine and GetHealth(sGear) == 0 then
@@ -1373,7 +1375,7 @@
 	elseif cat[cIndex] == loc("Barrel Placement Mode") then
 		pMode = {60,80,100,120,160,200,240,1,10,20,30,40,50}
 	elseif cat[cIndex] == loc("Health Crate Placement Mode") then
-		pMode = {25,30,40,50,75,100,150,200,5,10,15,20}
+		pMode = {25,30,40,50,75,100,150,200,0,5,10,15,20}
 	elseif cat[cIndex] == loc("Weapon Crate Placement Mode") then
 		for i = 1, #atkArray do
 			pMode[i] = GetAmmoName(atkArray[i][1], false)