Auto remove outdated turret entities

This commit is contained in:
stujones11 2018-01-03 20:24:36 +00:00
parent a310d0338a
commit 347a8807bf
2 changed files with 18 additions and 3 deletions

View file

@ -2,6 +2,10 @@ local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath.."/api.lua")
minetest.register_entity("shooter:turret_entity", {
visual = "sprite",
textures = {"blank.png"},
on_activate = function(self)
self.object:remove()
end,
})

View file

@ -253,6 +253,17 @@ minetest.register_node("shooter_turret:turret", {
},
})
minetest.register_abm({
nodenames = {"shooter_turret:turret"},
interval = 15,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
if not get_turret_entity(pos) then
minetest.add_entity(pos, "shooter_turret:turret_entity")
end
end
})
if SHOOTER_ENABLE_CRAFTING == true then
minetest.register_craft({
output = "shooter_turret:turret",