From 628686ce79c317efad5723031dd53a5aab4ec0c7 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 5 Apr 2022 22:43:37 +0200 Subject: [PATCH] Add a command to safely remove all mob objects --- mods/ENTITIES/mcl_mobs/api.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index ea9235391..914a919a1 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -101,6 +101,16 @@ local mod_worlds = minetest.get_modpath("mcl_worlds") ~= nil local mod_armor = minetest.get_modpath("mcl_armor") ~= nil local mod_experience = minetest.get_modpath("mcl_experience") ~= nil +--Helper function to clear all mobs because /clearobjects removes too much +minetest.register_chatcommand("clearmobs",{ + privs={maphack=true}, + description=S("Removes all spawned mobs"), + func=function() + for k,o in pairs(minetest.luaentities) do + if o.type == "ambient" or o.type == "animal" or o.type == "monster" or o.type == "npc" then o.object:remove() end + end +end}) + ----For Water Flowing: local enable_physics = function(object, luaentity, ignore_check) if luaentity.physical_state == false or ignore_check == true then