landrush/fire.lua
Foz c5af920590 Redo fire protection for claimed areas.
Take out the bugged attempt to override flame_should_extinguish
and override on_construct instead. In addition, an abm was added
to catch basic_flame set by voxelmanip (e.g. when TNT explodes).
2016-05-06 19:26:05 -04:00

29 lines
836 B
Lua

local def = minetest.registered_nodes["fire:basic_flame"]
if def then
-- Do not allow flames in or around protected areas
local default_on_construct = def.on_construct
def.on_construct = function(pos)
if landrush.can_interact_in_radius(pos, "", 1) then
return default_on_construct(pos)
end
minetest.remove_node(pos)
end
-- Extinguish flames in and around protected areas
-- this is needed because voxelmanip can set a node without
-- triggering the on_construct callback
minetest.register_abm({
nodenames = {"fire:basic_flame"},
interval = 3,
chance = 1,
catchup = true,
action = function(pos)
if not landrush.can_interact_in_radius(pos, "", 1) then
minetest.remove_node(pos)
minetest.sound_play("fire_extinguish_flame",
{pos = pos, max_hear_distance = 16, gain = 0.25})
end
end
})
end