From 4926f8d44337c9f307975e182a25abe7ed6b4cd9 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 19 Feb 2020 17:24:35 +0100 Subject: [PATCH] Mobs: Respect fall_damage_add_percent --- mods/ENTITIES/mcl_mobs/api.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 312604a2b..b0152f5c4 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -2518,12 +2518,20 @@ local falling = function(self, pos) if d > 5 then - self.health = self.health - floor(d - 5) + local add = minetest.get_item_group(self.standing_on, "fall_damage_add_percent") + local damage = d - 5 + if add ~= 0 then + damage = damage + damage * (add/100) + end + damage = floor(damage) + if damage > 0 then + self.health = self.health - damage - effect(pos, 5, "tnt_smoke.png", 1, 2, 2, nil) + effect(pos, 5, "tnt_smoke.png", 1, 2, 2, nil) - if check_for_death(self, "fall", {type = "fall"}) then - return + if check_for_death(self, "fall", {type = "fall"}) then + return + end end end