Fix spawning of infinite rocks
This commit is contained in:
parent
cb1cee225c
commit
27edb029ca
@ -1181,9 +1181,13 @@ minetest.register_node("tutorial:itemspawner", {
|
||||
|
||||
local offset = minetest.string_to_pos(meta:get_string("offset"))
|
||||
local itemstring = meta:get_string("itemstring")
|
||||
local alias = minetest.registered_aliases[itemstring]
|
||||
local test_item = ItemStack(itemstring)
|
||||
local test_itemname = test_item:get_name()
|
||||
local alias = minetest.registered_aliases[test_itemname]
|
||||
local itemname
|
||||
if alias then
|
||||
itemstring = alias
|
||||
test_item:set_name(alias)
|
||||
itemstring = test_item:to_string()
|
||||
end
|
||||
local x, y, z = offset.x, offset.y, offset.z
|
||||
local spawnpos = {x=pos.x+x, y=pos.y+y, z=pos.z+z}
|
||||
@ -1191,7 +1195,9 @@ minetest.register_node("tutorial:itemspawner", {
|
||||
for o=1, #objs do
|
||||
local ent = objs[o]:get_luaentity()
|
||||
if ent then
|
||||
if ent.name == "__builtin:item" and ent.itemstring == itemstring then
|
||||
local ent_itemstack = ItemStack(ent.itemstring)
|
||||
local itemstack = ItemStack(itemstring)
|
||||
if ent.name == "__builtin:item" and ent_itemstack:get_name() == itemstack:get_name() then
|
||||
-- Remove node when item was spawned successfully.
|
||||
-- So it doesn't get in the way.
|
||||
minetest.remove_node(pos)
|
||||
|
Loading…
x
Reference in New Issue
Block a user