Skip to content

Commit

Permalink
Clean up fire ABM parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
t4im authored and paramat committed Jul 15, 2016
1 parent 30b0a15 commit 9524ff6
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions mods/fire/init.lua
Expand Up @@ -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,
})

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9524ff6

Please sign in to comment.