Remove item spawner node after item was spawned

master
Wuzzy 2018-10-19 16:33:29 +02:00
parent cf42d92cc0
commit 69f703616c
1 changed files with 9 additions and 1 deletions

View File

@ -1180,7 +1180,15 @@ minetest.register_node("tutorial:itemspawner", {
local ent = objs[o]:get_luaentity()
if ent then
if ent.name == "__builtin:item" and ent.itemstring == itemstring then
meta:set_int("spawned", 1)
if not edit_item_spawners then
-- Remove node when item was spawned successfully.
-- So it doesn't get in the way.
minetest.remove_node(pos)
return
else
-- Keep node in editing mode
meta:set_int("spawned", 1)
end
end
end
end