slow down fire spread

master
Martin Doege 2016-01-25 20:55:34 +01:00
parent 6c5f4e2540
commit 58e2deb4de
2 changed files with 9 additions and 12 deletions

View File

@ -106,8 +106,8 @@ end
minetest.register_abm({
nodenames = {"group:flammable"},
neighbors = {"group:igniter"},
interval = 5,
chance = 2,
interval = 7,
chance = 16,
action = function(p0, node, _, _)
-- If there is water or stuff like that around flame, don't ignite
if fire.flame_should_extinguish(p0) then
@ -124,8 +124,8 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"group:igniter"},
neighbors = {"air"},
interval = 5,
chance = 10,
interval = 15,
chance = 100,
action = function(p0, node, _, _)
local reg = minetest.registered_nodes[node.name]
if not reg or not reg.groups.igniter or reg.groups.igniter < 2 then
@ -149,24 +149,21 @@ minetest.register_abm({
-- Remove flammable nodes and flame
minetest.register_abm({
nodenames = {"fire:basic_flame"},
interval = 3,
chance = 2,
interval = 5,
chance = 16,
action = function(p0, node, _, _)
-- If there is water or stuff like that around flame, remove flame
if fire.flame_should_extinguish(p0) then
minetest.remove_node(p0)
return
end
-- Make the following things rarer
if math.random(1,3) == 1 then
return
end
-- If there are no flammable nodes around flame, remove flame
if not minetest.find_node_near(p0, 1, {"group:flammable"}) then
minetest.remove_node(p0)
return
end
if math.random(1,4) == 1 then
if math.random(1,2) == 1 then
-- remove a flammable node around flame
local p = minetest.find_node_near(p0, 1, {"group:flammable"})
if p then

View File

@ -61,7 +61,7 @@ end)
minetest.register_globalstep(function(dtime)
if weather == "rain" or weather == "snow" then
local time = minetest.get_timeofday()
if (time >= 0.23 and time <= 0.24) or (time >= 0.12 and time <= 0.13) or math.random(1, 100) == 1 then
if (time >= 0.23 and time <= 0.24) or (time >= 0.12 and time <= 0.13) or math.random(1, 1000) == 1 then
weather = "none"
save_weather()
end