add debugs for unknown entities

This commit is contained in:
tai 2016-09-01 13:43:26 +01:00
parent 3f4c0521a3
commit 7fbb7f9821

View File

@ -23,7 +23,7 @@ minetest.register_tool("petting:mobtamer", {
-- here get the mob to the left
local inventory = user:get_inventory()
local eggname = ''
local eggname = nil
for idx,x in pairs(inventory:get_list("main") ) do
if x:get_name() == "petting:mobtamer" then
break
@ -31,6 +31,15 @@ minetest.register_tool("petting:mobtamer", {
eggname = x:get_name()
end
if eggname == nil then
minetest.chat_send_player(user:get_player_name(), ".... what. Report Mob Tamer failure to DuCake with screenshot of your inventory.")
return
end
if eggname:sub(1,1) == ":" then
minetest.chat_send_player(user:get_player_name(), "Your monster is ill-defined. Please let DuCake know")
return
end
local luaobj = minetest.add_entity(pos,eggname )
local luae = luaobj:get_luaentity()