From c1691e65a8c5d4e3cf44b5a2b02663569975d9c8 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 15 Nov 2024 18:19:41 -0600 Subject: [PATCH] Implement mcl_util.remove_entity() and convert projectile code to use it --- mods/CORE/mcl_util/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index b9c510390..507f10b19 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -753,3 +753,12 @@ function mcl_util.remove_entity(luaentity) luaentity.object:remove() end +function mcl_util.remove_entity(luaentity) + if luaentity._removed then return end + luaentity._removed = true + + local hook = luaentity._on_remove + if hook then hook(luaentity) end + + luaentity.object:remove() +end