Clean up fire ABM parameters.

master
Tim 2016-07-11 15:11:57 +02:00 committed by tchncs
parent d7b337eae2
commit 23544869e3
1 changed files with 11 additions and 13 deletions

View File

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