From 29314186b3902df75eae17318e2dbd8fe162a31f Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 23 Aug 2024 15:07:08 +0100 Subject: [PATCH] tweak damage --- api.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/api.lua b/api.lua index a4d5249..1225d8d 100644 --- a/api.lua +++ b/api.lua @@ -18,7 +18,7 @@ end mobs = { mod = "redo", - version = "20240810", + version = "20240823", spawning_mobs = {}, translate = S, invis = minetest.global_exists("invisibility") and invisibility or {}, @@ -1011,7 +1011,7 @@ function mob_class:do_env_damage() local py = {x = pos.x, y = pos.y + prop.collisionbox[5], z = pos.z} local nodef = minetest.registered_nodes[self.standing_in] - -- water + -- water damage if self.water_damage ~= 0 and nodef.groups.water then self.health = self.health - self.water_damage @@ -1020,9 +1020,10 @@ function mob_class:do_env_damage() if self:check_for_death({type = "environment", pos = pos, node = self.standing_in}) then return true end + end -- lava damage - elseif self.lava_damage ~= 0 and self:is_inside("group:lava") then + if self.lava_damage ~= 0 and nodef.groups.lava then self.health = self.health - self.lava_damage @@ -1030,9 +1031,10 @@ function mob_class:do_env_damage() if self:check_for_death({type = "environment", pos = pos, node = self.standing_in, hot = true}) then return true end + end -- fire damage - elseif self.fire_damage ~= 0 and self:is_inside("group:fire") then + if self.fire_damage ~= 0 and nodef.groups.fire then self.health = self.health - self.fire_damage @@ -1040,9 +1042,10 @@ function mob_class:do_env_damage() if self:check_for_death({type = "environment", pos = pos, node = self.standing_in, hot = true}) then return true end + end -- damage_per_second node check (not fire and lava) - elseif self.node_damage and nodef.damage_per_second and nodef.damage_per_second ~= 0 + if self.node_damage and nodef.damage_per_second and nodef.damage_per_second ~= 0 and nodef.groups.lava == nil and nodef.groups.fire == nil then self.health = self.health - nodef.damage_per_second