Hedge Editor: Allow to add/subtract health in Health Modification Mode
authorWuzzy <almikes@aol.com>
Fri, 11 Sep 2015 03:39:27 +0200
changeset 11638 df8fbbbcd775
parent 11637 45316b6eb4a0
child 11639 6733d6076915
Hedge Editor: Allow to add/subtract health in Health Modification Mode
share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Fri Sep 11 03:07:48 2015 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Fri Sep 11 03:39:27 2015 +0200
@@ -1641,7 +1641,12 @@
 
 		sGear = GetClosestGear()
 		if (sGear ~= nil) and (GetGearType(sGear) == gtHedgehog) then
-			SetHealth(sGear, pMode[pIndex])
+			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]))
+				SetHealth(sGear, newHealth)
+			end
 		else
 			AddCaption(loc("Please click on a hedgehog."),0xffba00ff,capgrpVolume)
 		end
@@ -1789,7 +1794,8 @@
 	elseif cat[cIndex] == loc("Team Identity Mode") then
 		pMode = {"Clowns","Street Fighters","Cybernetic Empire","Color Squad","Fruit","The Police","The Ninja-Samurai Alliance","Pokemon","The Zoo","The Devs","Mushroom Kingdom","Pirates","Gangsters","Twenty-Twenty","Monsters","The Iron Curtain","The Hospital"}
 	elseif cat[cIndex] == loc("Health Modification Mode") then
-		pMode = {1, 25, 30, 50, 75, 100, 120, 150, 200, 1000}
+		pMode = { {1, "set"}, {25, "set"}, {30, "set"}, {50, "set"}, {75, "set"}, {100, "set"}, {120, "set"}, {150, "set"}, {200, "set"}, {1000, "set"},
+			{"+1", "mod"}, {"+10", "mod"}, {"+100", "mod"}, {"-1", "mod"}, {"-10", "mod"}, {"-100", "mod"} } 
 	elseif cat[cIndex] == loc("Sprite Modification Mode") then
 		--pMode = {"Sprite Selection Mode","LandFlag Modification Mode","Sprite Erasure Mode"}
 		pMode = {loc("LandFlag Modification Mode"),loc("Sprite Erasure Mode")}
@@ -3327,7 +3333,13 @@
 			-- update display selection criteria
 			if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
 				AddCaption(cat[cIndex],0xffba00ff,capgrpMessage)
-				AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2)
+				local caption2
+				if type(pMode[pIndex]) == "table" then
+					caption2 = tostring(pMode[pIndex][1])
+				else
+					caption2 = tostring(pMode[pIndex])
+				end
+				AddCaption(caption2,0xffba00ff,capgrpMessage2)
 				if superDelete == true then
 					AddCaption(loc("Warning: Deletition Mode Active"),0xffba00ff,capgrpAmmoinfo)
 				end