From 3928e12634a7832e8f9b2112432704bdf23a0b58 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 14 Jun 2024 19:49:45 -0500 Subject: [PATCH] Fix two more crashes, stray space --- mods/ENTITIES/mcl_mobs/api.lua | 10 +++++----- mods/ENTITIES/mcl_mobs/init.lua | 7 ++++++- mods/ITEMS/mcl_mobspawners/init.lua | 2 -- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 8064c5511..1e49e8b4f 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -149,12 +149,12 @@ function mob_class:mob_activate(staticdata, def, dtime) local tmp = minetest.deserialize(staticdata) - -- Patch incorrectly converted mobs - if tmp.base_mesh ~= minetest.registered_entities[self.name].mesh then - mcl_mobs.strip_staticdata(tmp) - end - if tmp then + -- Patch incorrectly converted mobs + if tmp.base_mesh ~= minetest.registered_entities[self.name].mesh then + mcl_mobs.strip_staticdata(tmp) + end + for _,stat in pairs(tmp) do self[_] = stat end diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index 9518e9658..81b5fdfe7 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -592,7 +592,12 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg --minetest.log("min light: " .. mob_light_lvl[1]) --minetest.log("max light: " .. mob_light_lvl[2]) - mcl_mobspawners.setup_spawner(pointed_thing.under, itemstack:get_name(), mob_light_lvl[1], mob_light_lvl[2]) + -- Handle egg conversion + local mob_name = itemstack:get_name() + local convert_to = (minetest.registered_entities[mob_name] or {})._convert_to + if convert_to then mob_name = convert_to end + + mcl_mobspawners.setup_spawner(pointed_thing.under, mob_name, mob_light_lvl[1], mob_light_lvl[2]) if not minetest.is_creative_enabled(name) then itemstack:take_item() end diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index b500872ec..83c03804e 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -135,7 +135,6 @@ function mcl_mobspawners.setup_spawner(pos, Mob, MinLight, MaxLight, MaxMobsInAr end set_doll_properties(doll, Mob) - -- Start spawning very soon local t = minetest.get_node_timer(pos) t:start(2) @@ -172,7 +171,6 @@ local function spawn_mobs(pos, elapsed) local count = 0 local ent - local timer = minetest.get_node_timer(pos) -- spawn mob if player detected and in range