2021-05-29 17:12:33 +03:00
|
|
|
local S = minetest.get_translator(minetest.get_current_modname())
|
2021-03-05 10:47:48 +02:00
|
|
|
|
|
|
|
local orig_func = minetest.registered_chatcommands["spawnentity"].func
|
|
|
|
local cmd = table.copy(minetest.registered_chatcommands["spawnentity"])
|
|
|
|
cmd.func = function(name, param)
|
|
|
|
local ent = minetest.registered_entities[param]
|
2022-05-25 15:02:10 +03:00
|
|
|
if minetest.settings:get_bool("only_peaceful_mobs", false) and ent and ent.is_mob and ent.type == "monster" then
|
2021-03-05 10:47:48 +02:00
|
|
|
return false, S("Only peaceful mobs allowed!")
|
|
|
|
else
|
|
|
|
local bool, msg = orig_func(name, param)
|
|
|
|
return bool, msg
|
|
|
|
end
|
|
|
|
end
|
|
|
|
minetest.unregister_chatcommand("spawnentity")
|
|
|
|
minetest.register_chatcommand("summon", cmd)
|