Enchant Table / Item Frame : don't spawn entities if node get destructed shortly after joining
This commit is contained in:
parent
1fb9850e58
commit
0591b0ad76
@ -180,7 +180,15 @@ minetest.register_entity("xdecor:book_open", {
|
||||
visual_size = {x=0.75, y=0.75},
|
||||
collisionbox = {0},
|
||||
physical = false,
|
||||
textures = {"xdecor_book_open.png"}
|
||||
textures = {"xdecor_book_open.png"},
|
||||
on_activate = function(self)
|
||||
local pos = self.object:getpos()
|
||||
local pos_under = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
|
||||
if minetest.get_node(pos_under).name ~= "xdecor:enchantment_table" then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
local function cap(S) return S:gsub("^%l", string.upper) end
|
||||
|
@ -125,6 +125,11 @@ minetest.register_entity("xdecor:f_item", {
|
||||
physical = false,
|
||||
textures = {"air"},
|
||||
on_activate = function(self, staticdata)
|
||||
local pos = self.object:getpos()
|
||||
if minetest.get_node(pos).name ~= "xdecor:itemframe" then
|
||||
self.object:remove()
|
||||
end
|
||||
|
||||
if tmp.nodename and tmp.texture then
|
||||
self.nodename = tmp.nodename
|
||||
tmp.nodename = nil
|
||||
|
Loading…
Reference in New Issue
Block a user