From a7450751436a95505ddda969e4ec4e70463e2f16 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 16 Oct 2022 11:28:21 +0200 Subject: [PATCH 1/4] Allow mobs to still fall when out of range --- mods/ENTITIES/mcl_mobs/api.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index ff1b6411b..ebbfa1c4b 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3875,6 +3875,7 @@ local mob_step = function(self, dtime) if not player_in_active_range(self) then set_animation(self, "stand", true) self.object:set_velocity(vector.new(0,0,0)) + falling(self, pos) return end check_item_pickup(self) From 6f6dac02e85a5923eb7edd78aa9a038c3d05b3f7 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 16 Oct 2022 11:37:38 +0200 Subject: [PATCH 2/4] don't damage falling mobs landing on air or ignore --- mods/ENTITIES/mcl_mobs/api.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index ebbfa1c4b..c4ef046ea 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3278,11 +3278,10 @@ local falling = function(self, pos) -- fall damage onto solid ground if self.fall_damage == 1 and self.object:get_velocity().y == 0 then - + local n = node_ok(vector.offset(pos,0,-1,0)).name local d = (self.old_y or 0) - self.object:get_pos().y - if d > 5 then - + if d > 5 and n ~= "air" and n ~= "ignore" then local add = minetest.get_item_group(self.standing_on, "fall_damage_add_percent") local damage = d - 5 if add ~= 0 then From 2e01180fc87026b844418275dceb40751d35f71d Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 16 Oct 2022 23:59:39 +0200 Subject: [PATCH 3/4] Fix "hibernating" mobs flying upwards --- mods/ENTITIES/mcl_mobs/api.lua | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index c4ef046ea..23b3b4997 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3865,18 +3865,25 @@ local mob_step = function(self, dtime) self.object:set_rotation(rot) end + if not player_in_active_range(self) then + set_animation(self, "stand", true) + local node_under = node_ok(vector.offset(pos,0,-1,0)).name + local acc = self.object:get_acceleration() + if acc.y > 0 or node_under ~= "air" then + self.object:set_acceleration(vector.new(0,0,0)) + self.object:set_velocity(vector.new(0,0,0)) + end + if acc.y == 0 and node_under == "air" then + falling(self, pos) + end + return + end + if v then --diffuse object velocity self.object:set_velocity({x = v.x*d, y = v.y, z = v.z*d}) end - - if not player_in_active_range(self) then - set_animation(self, "stand", true) - self.object:set_velocity(vector.new(0,0,0)) - falling(self, pos) - return - end check_item_pickup(self) check_aggro(self,dtime) particlespawner_check(self,dtime) From 7c15b929fa952479684091fcc04e219a28fb3d24 Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 17 Oct 2022 11:27:36 +0200 Subject: [PATCH 4/4] Fix possible crash --- mods/ENTITIES/mcl_mobs/api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 23b3b4997..962f1340f 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -2058,7 +2058,7 @@ local monster_attack = function(self) player = obj.object name = obj.name or "" end - if obj.type == self.type and obj.passive == false and obj.state == "attack" and obj.attack then + if obj and obj.type == self.type and obj.passive == false and obj.state == "attack" and obj.attack then table.insert(blacklist_attack, obj.attack) end end