From 345f40ded642b17694c8af6aa3e662f41141d57e Mon Sep 17 00:00:00 2001 From: Glaucos Ginez Date: Sun, 22 Aug 2021 14:44:01 -0300 Subject: [PATCH 1/3] Fix issue 26 --- mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua | 5 ++--- .../ENTITIES/mcl_mobs/api/mob_functions/set_up.lua | 14 ++++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua index af006d1cc..cdcffd81c 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua @@ -821,9 +821,8 @@ function mobs.mob_step(self, dtime) self.lifetimer = self.lifetimer - dtime if self.lifetimer <= 0 then self.lifetimer = self.lifetimer_reset - if not mobs.check_for_player_within_area(self, 64) then - --print("removing in MAIN LOGIC!") - self.object:remove() + if mobs.can_despawn(self) then + self.object:remove() return end end diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/set_up.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/set_up.lua index 65ba764f6..b9cf2f669 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/set_up.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/set_up.lua @@ -5,16 +5,18 @@ local minetest_settings = minetest.settings -- CMI support check local use_cmi = minetest.global_exists("cmi") +mobs.can_despawn = function(self) + return (not self.tamed and not self.bred and not self.nametag and + not mobs.check_for_player_within_area(self, 64)); +end + -- get entity staticdata mobs.mob_staticdata = function(self) --despawn mechanism --don't despawned tamed or bred mobs - if not self.tamed and not self.bred then - if not mobs.check_for_player_within_area(self, 64) then - --print("removing SERIALIZED!") - self.object:remove() - return - end + if mobs.can_despawn(self) then + self.object:remove() + return end self.remove_ok = true From 7ae73bcf474b4c2c05c86f7fc214b1d743ad5dab Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 10 Sep 2021 21:41:15 +0200 Subject: [PATCH 2/3] fix crash and netherite hoes The item registration in mcl_farming for diamond hoes contains the wrong upgrade_item id (mcl_tools:hoe_netherite, should me mcl_farming:). This commit changes that. --- mods/ITEMS/mcl_farming/hoes.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_farming/hoes.lua b/mods/ITEMS/mcl_farming/hoes.lua index dd635006f..ddd1b5a93 100644 --- a/mods/ITEMS/mcl_farming/hoes.lua +++ b/mods/ITEMS/mcl_farming/hoes.lua @@ -257,7 +257,7 @@ minetest.register_tool("mcl_farming:hoe_diamond", { hoey = { speed = 8, level = 5, uses = 1562 } }, _mcl_upgradable = true, - _mcl_upgrade_item = "mcl_tools:hoe_netherite" + _mcl_upgrade_item = "mcl_farming:hoe_netherite" }) minetest.register_craft({ From 91d0dc38e5be40e2c8c4674f562e658cf74c0072 Mon Sep 17 00:00:00 2001 From: Artem Arbatsky Date: Fri, 24 Sep 2021 16:50:54 +0500 Subject: [PATCH 3/3] Add missing call for on_die function --- mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua index 45e46d3db..03e6789ed 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua @@ -122,7 +122,10 @@ mobs.death_logic = function(self, dtime) if self.death_animation_timer >= 1.25 then item_drop(self,false,1) mobs.death_effect(self) - mcl_experience.throw_experience(self.object:get_pos(), math_random(self.xp_min, self.xp_max)) + mcl_experience.throw_experience(self.object:get_pos(), math_random(self.xp_min, self.xp_max)) + if self.on_die then + self.on_die(self, self.object:get_pos()) + end self.object:remove() return end @@ -155,4 +158,4 @@ mobs.death_logic = function(self, dtime) if self.pause_timer <= 0 then mobs.set_velocity(self,0) end -end \ No newline at end of file +end