Clean up fire ABM parameters.

This commit is contained in:
Tim 2016-07-11 15:11:57 +02:00 committed by paramat
parent 30b0a155fb
commit 9524ff67a3

View File

@ -226,10 +226,10 @@ minetest.register_abm({
interval = 3, interval = 3,
chance = 1, chance = 1,
catch_up = false, catch_up = false,
action = function(p0, node, _, _) action = function(pos, node, active_object_count, active_object_count_wider)
minetest.remove_node(p0) minetest.remove_node(pos)
minetest.sound_play("fire_extinguish_flame", minetest.sound_play("fire_extinguish_flame",
{pos = p0, max_hear_distance = 16, gain = 0.25}) {pos = pos, max_hear_distance = 16, gain = 0.25})
end, end,
}) })
@ -245,9 +245,7 @@ if minetest.setting_getbool("disable_fire") then
interval = 7, interval = 7,
chance = 1, chance = 1,
catch_up = false, catch_up = false,
action = function(p0, node, _, _) action = minetest.remove_node,
minetest.remove_node(p0)
end,
}) })
else else
@ -260,12 +258,12 @@ else
interval = 7, interval = 7,
chance = 12, chance = 12,
catch_up = false, catch_up = false,
action = function(p0, node, _, _) action = function(pos, node, active_object_count, active_object_count_wider)
-- If there is water or stuff like that around node, don't ignite -- If there is water or stuff like that around node, don't ignite
if minetest.find_node_near(p0, 1, {"group:puts_out_fire"}) then if minetest.find_node_near(pos, 1, {"group:puts_out_fire"}) then
return return
end end
local p = minetest.find_node_near(p0, 1, {"air"}) local p = minetest.find_node_near(pos, 1, {"air"})
if p then if p then
minetest.set_node(p, {name = "fire:basic_flame"}) minetest.set_node(p, {name = "fire:basic_flame"})
end end
@ -280,8 +278,8 @@ else
interval = 5, interval = 5,
chance = 18, chance = 18,
catch_up = false, catch_up = false,
action = function(p0, node, _, _) action = function(pos, node, active_object_count, active_object_count_wider)
local p = minetest.find_node_near(p0, 1, {"group:flammable"}) local p = minetest.find_node_near(pos, 1, {"group:flammable"})
if p then if p then
-- remove flammable nodes around flame -- remove flammable nodes around flame
local flammable_node = minetest.get_node(p) local flammable_node = minetest.get_node(p)
@ -309,13 +307,13 @@ minetest.register_abm({
neighbors = {"air"}, neighbors = {"air"},
interval = 5, interval = 5,
chance = 10, chance = 10,
action = function(p0, node, _, _) action = function(pos, node, active_object_count, active_object_count_wider)
local reg = minetest.registered_nodes[node.name] local reg = minetest.registered_nodes[node.name]
if not reg or not reg.groups.igniter or reg.groups.igniter < 2 then if not reg or not reg.groups.igniter or reg.groups.igniter < 2 then
return return
end end
local d = reg.groups.igniter local d = reg.groups.igniter
local p = minetest.find_node_near(p0, d, {"group:flammable"}) local p = minetest.find_node_near(pos, d, {"group:flammable"})
if p then if p then
-- If there is water or stuff like that around flame, don't ignite -- If there is water or stuff like that around flame, don't ignite
if fire.flame_should_extinguish(p) then if fire.flame_should_extinguish(p) then