Replace minetest.env: with minetest.

This commit is contained in:
PilzAdam
2013-05-25 00:40:03 +02:00
parent dfad095884
commit 31a74ede18
13 changed files with 169 additions and 169 deletions

View File

@ -47,7 +47,7 @@ end
function fire.update_sounds_around(pos)
local p0, p1 = fire.get_area_p0p1(pos)
local cp = {x=(p0.x+p1.x)/2, y=(p0.y+p1.y)/2, z=(p0.z+p1.z)/2}
local flames_p = minetest.env:find_nodes_in_area(p0, p1, {"fire:basic_flame"})
local flames_p = minetest.find_nodes_in_area(p0, p1, {"fire:basic_flame"})
--print("number of flames at "..minetest.pos_to_string(p0).."/"
-- ..minetest.pos_to_string(p1)..": "..#flames_p)
local should_have_sound = (#flames_p > 0)
@ -91,15 +91,15 @@ function fire.on_flame_remove_at(pos)
end
function fire.find_pos_for_flame_around(pos)
return minetest.env:find_node_near(pos, 1, {"air"})
return minetest.find_node_near(pos, 1, {"air"})
end
function fire.flame_should_extinguish(pos)
if minetest.setting_getbool("disable_fire") then return true end
--return minetest.env:find_node_near(pos, 1, {"group:puts_out_fire"})
--return minetest.find_node_near(pos, 1, {"group:puts_out_fire"})
local p0 = {x=pos.x-2, y=pos.y, z=pos.z-2}
local p1 = {x=pos.x+2, y=pos.y, z=pos.z+2}
local ps = minetest.env:find_nodes_in_area(p0, p1, {"group:puts_out_fire"})
local ps = minetest.find_nodes_in_area(p0, p1, {"group:puts_out_fire"})
return (#ps ~= 0)
end
@ -116,7 +116,7 @@ minetest.register_abm({
end
local p = fire.find_pos_for_flame_around(p0)
if p then
minetest.env:set_node(p, {name="fire:basic_flame"})
minetest.set_node(p, {name="fire:basic_flame"})
fire.on_flame_add_at(p)
end
end,
@ -134,7 +134,7 @@ minetest.register_abm({
return
end
local d = reg.groups.igniter
local p = minetest.env:find_node_near(p0, d, {"group:flammable"})
local p = minetest.find_node_near(p0, 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
@ -142,7 +142,7 @@ minetest.register_abm({
end
local p2 = fire.find_pos_for_flame_around(p)
if p2 then
minetest.env:set_node(p2, {name="fire:basic_flame"})
minetest.set_node(p2, {name="fire:basic_flame"})
fire.on_flame_add_at(p2)
end
end
@ -157,7 +157,7 @@ minetest.register_abm({
action = function(p0, node, _, _)
-- If there is water or stuff like that around flame, remove flame
if fire.flame_should_extinguish(p0) then
minetest.env:remove_node(p0)
minetest.remove_node(p0)
fire.on_flame_remove_at(p0)
return
end
@ -166,25 +166,25 @@ minetest.register_abm({
return
end
-- If there are no flammable nodes around flame, remove flame
if not minetest.env:find_node_near(p0, 1, {"group:flammable"}) then
minetest.env:remove_node(p0)
if not minetest.find_node_near(p0, 1, {"group:flammable"}) then
minetest.remove_node(p0)
fire.on_flame_remove_at(p0)
return
end
if math.random(1,4) == 1 then
-- remove a flammable node around flame
local p = minetest.env:find_node_near(p0, 1, {"group:flammable"})
local p = minetest.find_node_near(p0, 1, {"group:flammable"})
if p then
-- If there is water or stuff like that around flame, don't remove
if fire.flame_should_extinguish(p0) then
return
end
minetest.env:remove_node(p)
minetest.remove_node(p)
nodeupdate(p)
end
else
-- remove flame
minetest.env:remove_node(p0)
minetest.remove_node(p0)
fire.on_flame_remove_at(p0)
end
end,