HedgeEditor: Allow to modify dud mine health
authorWuzzy <almikes@aol.com>
Sat, 09 Apr 2016 08:59:29 +0200
changeset 12007 a2f0c0d0e534
parent 12006 acf5dab74f92
child 12008 9790a4c72d7b
HedgeEditor: Allow to modify dud mine health
share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Sat Apr 09 08:52:19 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Sat Apr 09 08:59:29 2016 +0200
@@ -1230,8 +1230,20 @@
 				local newHealth = math.max(1, GetHealth(sGear) + tonumber(pMode[pIndex][1]))
 				SetHealth(sGear, newHealth)
 			end
+		elseif gt == gtMine and GetHealth(sGear) == 0 then
+			local newHealth 
+			if pMode[pIndex][2] == "set" then
+				newHealth =  pMode[pIndex][1]
+			elseif pMode[pIndex][2] == "mod" then
+				local _, oldHealth
+				_,_,_,_,_,_,_,_,_,_,_, oldHealth = GetGearValues(sGear)
+				local newHealth = math.max(1, oldHealth + tonumber(pMode[pIndex][1]))
+			end
+			if newHealth ~= nil then
+				SetGearValues(sGear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 36 - newHealth)
+			end
 		else
-			AddCaption(loc("Please click on a hedgehog, barrel or health crate."),0xffba00ff,capgrpVolume)
+			AddCaption(loc("Please click on a hedgehog, barrel, health crate or dud mine."),0xffba00ff,capgrpVolume)
 		end
 
 	elseif cat[cIndex] == loc("Sprite Modification Mode") then
@@ -2726,7 +2738,7 @@
 
 		ShowMission	(
 				loc("HEALTH MODIFICATION MODE"),
-				loc("Use this mode to set the health of hogs, health crates and barrels."),
+				loc("Use this mode to set the health of hogs, health crates, barrels and duds."),
 				loc("Set Health: [Left Click]") .. "|" ..
 				loc("[Left], [Right]: Change health value.") .. "|" ..
 				" " .. "|" ..