make a walking light bug killer abm

This commit is contained in:
Elkien3 2018-11-03 20:10:48 -05:00
parent 2a65c834f1
commit 7e00ebbd8e

View File

@ -119,4 +119,23 @@ minetest.register_node("walking_light:light", {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0},
},
})
minetest.register_abm({
nodenames = {"walking_light:light"},
interval = 10,
chance = 1,
catch_up = false,
action = function(p0, node, _, _)
local killlight = true
local objs = minetest.get_objects_inside_radius(p0, 2)
for _, obj in pairs(objs) do
if obj:is_player() then
killlight = false
end
end
if killlight then
minetest.remove_node(p0)
end
end,
})