From a4cf246fce9f7be8ec91892a3ad32ef90739cda5 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Tue, 8 Aug 2023 08:31:52 -0400 Subject: [PATCH] autodetect ":" to beginning of entity registration and auto added if not present * improves the commit commit b1ad4451a7 that really helps to registered external mobs but this could break others already implemented.. i mean.. what happened if someone already add the ":" prefix? This commit addressed that! * this close https://notabug.org/TenPlus1/mobs_redo/issues/154 fixed in good way --- api.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api.lua b/api.lua index ebb5f93..7c25dfd 100644 --- a/api.lua +++ b/api.lua @@ -3665,10 +3665,10 @@ function mobs:register_mob(name, def) collisionbox[5] = collisionbox[2] + 0.99 end -minetest.register_entity(":" .. name, setmetatable({ +minetest.register_entity(name, setmetatable({ stepheight = def.stepheight, - name = name, + name = (name:find(":") and name or ":"..name), type = def.type, attack_type = def.attack_type, fly = def.fly, @@ -4238,7 +4238,7 @@ function mobs:register_arrow(name, def) if not name or not def then return end -- errorcheck - minetest.register_entity(":" .. name, { + minetest.register_entity( (name:find(":") and name or ":"..name) , { physical = def.physical or false, collide_with_objects = def.collide_with_objects or false, @@ -4910,7 +4910,7 @@ function mobs:alias_mob(old_name, new_name) minetest.register_alias(old_name, new_name) -- entity - minetest.register_entity(":" .. old_name, { + minetest.register_entity( (old_name:find(":") and old_name or ":"..old_name) , { physical = false, static_save = false,