share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
changeset 12007 a2f0c0d0e534
parent 12006 acf5dab74f92
child 12008 9790a4c72d7b
equal deleted inserted replaced
12006:acf5dab74f92 12007:a2f0c0d0e534
  1228 				SetHealth(sGear, pMode[pIndex][1])
  1228 				SetHealth(sGear, pMode[pIndex][1])
  1229 			elseif pMode[pIndex][2] == "mod" then
  1229 			elseif pMode[pIndex][2] == "mod" then
  1230 				local newHealth = math.max(1, GetHealth(sGear) + tonumber(pMode[pIndex][1]))
  1230 				local newHealth = math.max(1, GetHealth(sGear) + tonumber(pMode[pIndex][1]))
  1231 				SetHealth(sGear, newHealth)
  1231 				SetHealth(sGear, newHealth)
  1232 			end
  1232 			end
       
  1233 		elseif gt == gtMine and GetHealth(sGear) == 0 then
       
  1234 			local newHealth 
       
  1235 			if pMode[pIndex][2] == "set" then
       
  1236 				newHealth =  pMode[pIndex][1]
       
  1237 			elseif pMode[pIndex][2] == "mod" then
       
  1238 				local _, oldHealth
       
  1239 				_,_,_,_,_,_,_,_,_,_,_, oldHealth = GetGearValues(sGear)
       
  1240 				local newHealth = math.max(1, oldHealth + tonumber(pMode[pIndex][1]))
       
  1241 			end
       
  1242 			if newHealth ~= nil then
       
  1243 				SetGearValues(sGear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 36 - newHealth)
       
  1244 			end
  1233 		else
  1245 		else
  1234 			AddCaption(loc("Please click on a hedgehog, barrel or health crate."),0xffba00ff,capgrpVolume)
  1246 			AddCaption(loc("Please click on a hedgehog, barrel, health crate or dud mine."),0xffba00ff,capgrpVolume)
  1235 		end
  1247 		end
  1236 
  1248 
  1237 	elseif cat[cIndex] == loc("Sprite Modification Mode") then
  1249 	elseif cat[cIndex] == loc("Sprite Modification Mode") then
  1238 
  1250 
  1239 		SelectClosestSprite()
  1251 		SelectClosestSprite()
  2724 
  2736 
  2725 	elseif cat[cIndex] == loc("Health Modification Mode") then
  2737 	elseif cat[cIndex] == loc("Health Modification Mode") then
  2726 
  2738 
  2727 		ShowMission	(
  2739 		ShowMission	(
  2728 				loc("HEALTH MODIFICATION MODE"),
  2740 				loc("HEALTH MODIFICATION MODE"),
  2729 				loc("Use this mode to set the health of hogs, health crates and barrels."),
  2741 				loc("Use this mode to set the health of hogs, health crates, barrels and duds."),
  2730 				loc("Set Health: [Left Click]") .. "|" ..
  2742 				loc("Set Health: [Left Click]") .. "|" ..
  2731 				loc("[Left], [Right]: Change health value.") .. "|" ..
  2743 				loc("[Left], [Right]: Change health value.") .. "|" ..
  2732 				" " .. "|" ..
  2744 				" " .. "|" ..
  2733 				loc("Change Placement Mode: [Up], [Down]") .. "|" ..
  2745 				loc("Change Placement Mode: [Up], [Down]") .. "|" ..
  2734 				loc("Toggle Help: Precise+1") .. "|" ..
  2746 				loc("Toggle Help: Precise+1") .. "|" ..