Fill cauldrons while raining

This commit is contained in:
Wuzzy 2017-03-01 19:06:16 +01:00
parent 8c14966e9f
commit df9f0d4c1c

@ -170,18 +170,36 @@ if weather.reg_weathers.rain == nil then
} }
end end
-- ABM for extinguish fire
if weather.allow_abm then if weather.allow_abm then
minetest.register_abm({ -- ABM for extinguish fire
nodenames = {"mcl_fire:fire"}, minetest.register_abm({
interval = 4.0, nodenames = {"mcl_fire:fire"},
chance = 2, interval = 4.0,
action = function(pos, node, active_object_count, active_object_count_wider) chance = 2,
if rain.raining and rain.extinguish_fire then action = function(pos, node, active_object_count, active_object_count_wider)
if weather.is_outdoor(pos) then if rain.raining and rain.extinguish_fire then
minetest.remove_node(pos) if weather.is_outdoor(pos) then
end minetest.remove_node(pos)
end end
end end
}) end
})
-- Slowly fill up cauldrons
minetest.register_abm({
nodenames = {"mcl_cauldrons:cauldron", "mcl_cauldrons:cauldron_1", "mcl_cauldrons:cauldron_2"},
interval = 56.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
if rain.raining and weather.is_outdoor(pos) then
if node.name == "mcl_cauldrons:cauldron" then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_1"})
elseif node.name == "mcl_cauldrons:cauldron_1" then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_2"})
elseif node.name == "mcl_cauldrons:cauldron_2" then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3"})
end
end
end
})
end end