I'm not sure what do you want to achieve, but to remove an entity of a particular node I did this in my "gauges mod":
Entity definition
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local furnace_bar = {
physical = false,
collisionbox = {x=0, y=0, z=0},
visual = "sprite",
textures = {"20.png"},
visual_size = {x=14/16, y=1/20, z=1},
wielder,
}
Entity creation func:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
function add_furnace_gauge(pos, newnode, placer, oldnode, itemstack)
if newnode.name ~= "default:furnace" then
if newnode.name ~= "default:furnace_active" then
return
end
end
pos.y = pos.y+1
local ent = minetest.env:add_entity(pos, "gauges:furnace_bar")
pos.y = pos.y-1
if ent~= nil then
ent = ent:get_luaentity()
ent.wielder = pos
end
end
And this how I delete an entity:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local position = self.wielder
if minetest.env:get_node(position).name == "air" then
self.object:remove()
return
end