From 00e8ac0850ee4bcf1fdb284ee75e4e315574fedd Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Sat, 2 May 2020 19:28:13 +0100 Subject: [PATCH] added failsafe for suffocation value (true, false) instead of value --- api.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/api.lua b/api.lua index 816d20e..93025c6 100644 --- a/api.lua +++ b/api.lua @@ -6,7 +6,7 @@ local use_cmi = minetest.global_exists("cmi") mobs = { mod = "redo", - version = "20200501", + version = "20200502", intllib = S, invis = minetest.global_exists("invisibility") and invisibility or {} } @@ -1018,13 +1018,20 @@ function mob_class:do_env_damage() end --- suffocation inside solid node - if (self.suffocation ~= 0) + if (self.suffocation and self.suffocation ~= 0) and (nodef.walkable == nil or nodef.walkable == true) and (nodef.collision_box == nil or nodef.collision_box.type == "regular") and (nodef.node_box == nil or nodef.node_box.type == "regular") and (nodef.groups.disable_suffocation ~= 1) then - self.health = self.health - self.suffocation + local damage + if self.suffocation == true then + damage = 2 + else + damage = (self.suffocation or 2) + end + + self.health = self.health - damage if self:check_for_death({type = "suffocation", pos = pos, node = self.standing_in}) then return true end