forked from mtcontrib/3d_armor
		
	Fix regression with heal_multiplier config
This commit is contained in:
		@@ -59,10 +59,6 @@ armor_level_multiplier = 1
 | 
				
			|||||||
-- eg: armor_heal_multiplier = 0 will disable healing altogether.
 | 
					-- eg: armor_heal_multiplier = 0 will disable healing altogether.
 | 
				
			||||||
armor_heal_multiplier = 1
 | 
					armor_heal_multiplier = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- You can use this to increase or decrease overall armor radiation protection,
 | 
					 | 
				
			||||||
-- eg: armor_radiation_multiplier = 0 will completely disable radiation protection.
 | 
					 | 
				
			||||||
armor_radiation_multiplier = 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Enable water protection (periodically restores breath when activated)
 | 
					-- Enable water protection (periodically restores breath when activated)
 | 
				
			||||||
armor_water_protect = true
 | 
					armor_water_protect = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -111,7 +107,7 @@ armor:register_armor("mod_name:speed_boots", {
 | 
				
			|||||||
	armor_groups = {fleshy=10, radiation=10},
 | 
						armor_groups = {fleshy=10, radiation=10},
 | 
				
			||||||
	damage_groups = {cracky=3, snappy=3, choppy=3, crumbly=3, level=1},
 | 
						damage_groups = {cracky=3, snappy=3, choppy=3, crumbly=3, level=1},
 | 
				
			||||||
	reciprocate_damage = true,
 | 
						reciprocate_damage = true,
 | 
				
			||||||
	on_destroy = function(player, item_name)
 | 
						on_destroy = function(player, stack)
 | 
				
			||||||
		local pos = player:getpos()
 | 
							local pos = player:getpos()
 | 
				
			||||||
		if pos then
 | 
							if pos then
 | 
				
			||||||
			minetest.sound_play({
 | 
								minetest.sound_play({
 | 
				
			||||||
@@ -150,7 +146,9 @@ on_destroy = func(player, stack)
 | 
				
			|||||||
on_damage = func(player, stack)
 | 
					on_damage = func(player, stack)
 | 
				
			||||||
on_punch = func(player, hitter, time_from_last_punch, tool_capabilities)
 | 
					on_punch = func(player, hitter, time_from_last_punch, tool_capabilities)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Notes: on_punch is called every time the player takes damage, `hitter`,
 | 
					Notes:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`on_punch` is called every time a player is punched or takes damage, `hitter`,
 | 
				
			||||||
`time_from_last_punch` and `tool_capabilities` can be `nil` and will be in the
 | 
					`time_from_last_punch` and `tool_capabilities` can be `nil` and will be in the
 | 
				
			||||||
case of fall damage, etc. Return `false` to override armor damage effects.
 | 
					case of fall damage, etc. Return `false` to override armor damage effects.
 | 
				
			||||||
When armor is destroyed `stack` will contain a copy of the previous stack.
 | 
					When armor is destroyed `stack` will contain a copy of the previous stack.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,7 +58,6 @@ armor.config = {
 | 
				
			|||||||
	destroy = false,
 | 
						destroy = false,
 | 
				
			||||||
	level_multiplier = 1,
 | 
						level_multiplier = 1,
 | 
				
			||||||
	heal_multiplier = 1,
 | 
						heal_multiplier = 1,
 | 
				
			||||||
	radiation_multiplier = 1,
 | 
					 | 
				
			||||||
	material_wood = true,
 | 
						material_wood = true,
 | 
				
			||||||
	material_cactus = true,
 | 
						material_cactus = true,
 | 
				
			||||||
	material_steel = true,
 | 
						material_steel = true,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -295,6 +295,7 @@ minetest.register_on_player_hpchange(function(player, hp_change)
 | 
				
			|||||||
		local name = player:get_player_name()
 | 
							local name = player:get_player_name()
 | 
				
			||||||
		if name and armor.def[name] then
 | 
							if name and armor.def[name] then
 | 
				
			||||||
			local heal = armor.def[name].heal or 0
 | 
								local heal = armor.def[name].heal or 0
 | 
				
			||||||
 | 
								heal = heal * armor.config.heal_multiplier
 | 
				
			||||||
			if heal >= math.random(100) then
 | 
								if heal >= math.random(100) then
 | 
				
			||||||
				hp_change = 0
 | 
									hp_change = 0
 | 
				
			||||||
			end
 | 
								end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user