From b56ae38939bd1389cd4227aade573d608fad4b7b Mon Sep 17 00:00:00 2001 From: MysticTempest Date: Tue, 22 Dec 2020 08:29:24 -0600 Subject: [PATCH] Make lava/fire wait 2 seconds before destroying items to allow chance for pickup, fix dogs following when sitting, and add some rotation so mobs don't idle at cliffs. --- mods/ENTITIES/mcl_item_entity/init.lua | 13 ++++++++----- mods/ENTITIES/mcl_mobs/api.lua | 10 ++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 6413481320..214ee55042 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -632,12 +632,15 @@ minetest.register_entity(":__builtin:item", { local fg = minetest.get_item_group(nn, "fire") local dg = minetest.get_item_group(nn, "destroys_items") if (def and (lg ~= 0 or fg ~= 0 or dg == 1)) then - if dg ~= 2 then - minetest.sound_play("builtin_item_lava", {pos = self.object:get_pos(), gain = 0.5}, true) + --Wait 2 seconds to allow mob drops to be cooked, & picked up instead of instantly destroyed. + if self.age > 2 then + if dg ~= 2 then + minetest.sound_play("builtin_item_lava", {pos = self.object:get_pos(), gain = 0.5}) + end + self._removed = true + self.object:remove() + return end - self._removed = true - self.object:remove() - return end -- Push item out when stuck inside solid opaque node diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 596843ac6a..dffbd8b397 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -2059,6 +2059,7 @@ local follow_flop = function(self) or self.order == "follow") and not self.following and self.state ~= "attack" + and self.order ~= "sit" and self.state ~= "runaway" then local s = self.object:get_pos() @@ -2079,6 +2080,7 @@ local follow_flop = function(self) if self.type == "npc" and self.order == "follow" and self.state ~= "attack" + and self.order ~= "sit" and self.owner ~= "" then -- npc stop following player if not owner @@ -2364,6 +2366,8 @@ local do_states = function(self, dtime) set_velocity(self, 0) self.state = "stand" set_animation(self, "stand") + local yaw = self.object:get_yaw() or 0 + yaw = set_yaw(self, yaw + 0.78, 8) else set_velocity(self, self.walk_velocity) @@ -2390,6 +2394,8 @@ local do_states = function(self, dtime) set_velocity(self, 0) self.state = "stand" set_animation(self, "stand") + local yaw = self.object:get_yaw() or 0 + yaw = set_yaw(self, yaw + 0.78, 8) else set_velocity(self, self.run_velocity) set_animation(self, "run") @@ -2622,6 +2628,8 @@ local do_states = function(self, dtime) set_velocity(self, 0) set_animation(self, "stand") + local yaw = self.object:get_yaw() or 0 + yaw = set_yaw(self, yaw + 0.78, 8) else if self.path.stuck then @@ -3516,6 +3524,8 @@ local mob_step = function(self, dtime) set_velocity(self, 0) self.state = "stand" set_animation(self, "stand") + local yaw = self.object:get_yaw() or 0 + yaw = set_yaw(self, yaw + 0.78, 8) end -- Despawning: when lifetimer expires, remove mob