From c277590fc2159a6a3599272e8320f600879a75ec Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sun, 30 Jun 2013 23:55:07 -0400 Subject: [PATCH] Phased out all deprecated minetest.env:* uses in favor of minetest.* --- init.lua | 36 ++++++++++++++++++------------------ leafdecay.lua | 20 ++++++++++---------- node_defs.lua | 4 ++-- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/init.lua b/init.lua index 3f31a3b..c0a2aaa 100644 --- a/init.lua +++ b/init.lua @@ -115,22 +115,22 @@ end -- Code to spawn a birch tree function moretrees:grow_birch(pos) - minetest.env:remove_node(pos) + minetest.remove_node(pos) if math.random(1,2) == 1 then - minetest.env:spawn_tree(pos, moretrees.birch_model1) + minetest.spawn_tree(pos, moretrees.birch_model1) else - minetest.env:spawn_tree(pos, moretrees.birch_model2) + minetest.spawn_tree(pos, moretrees.birch_model2) end end -- Code to spawn a spruce tree function moretrees:grow_spruce(pos) - minetest.env:remove_node(pos) + minetest.remove_node(pos) if math.random(1,2) == 1 then - minetest.env:spawn_tree(pos, moretrees.spruce_model1) + minetest.spawn_tree(pos, moretrees.spruce_model1) else - minetest.env:spawn_tree(pos, moretrees.spruce_model2) + minetest.spawn_tree(pos, moretrees.spruce_model2) end end @@ -180,12 +180,12 @@ function moretrees:grow_jungletree(pos) moretrees.jungletree_model.rules_b = moretrees.jt_rules_b2 end - minetest.env:remove_node(pos) - local leaves = minetest.env:find_nodes_in_area({x = pos.x-1, y = pos.y, z = pos.z-1}, {x = pos.x+1, y = pos.y+10, z = pos.z+1}, "default:leaves") + minetest.remove_node(pos) + local leaves = minetest.find_nodes_in_area({x = pos.x-1, y = pos.y, z = pos.z-1}, {x = pos.x+1, y = pos.y+10, z = pos.z+1}, "default:leaves") for leaf in ipairs(leaves) do - minetest.env:remove_node(leaves[leaf]) + minetest.remove_node(leaves[leaf]) end - minetest.env:spawn_tree(pos, moretrees.jungletree_model) + minetest.spawn_tree(pos, moretrees.jungletree_model) end -- code to spawn fir trees @@ -207,12 +207,12 @@ function moretrees:grow_fir(pos) moretrees.fir_model.iterations = 7 moretrees.fir_model.random_level = 5 - minetest.env:remove_node(pos) - local leaves = minetest.env:find_nodes_in_area({x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, "default:leaves") + minetest.remove_node(pos) + local leaves = minetest.find_nodes_in_area({x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, "default:leaves") for leaf in ipairs(leaves) do - minetest.env:remove_node(leaves[leaf]) + minetest.remove_node(leaves[leaf]) end - minetest.env:spawn_tree(pos,moretrees.fir_model) + minetest.spawn_tree(pos,moretrees.fir_model) end -- same thing, but a smaller version that grows only in snow biomes @@ -234,12 +234,12 @@ function moretrees:grow_fir_snow(pos) moretrees.fir_model.iterations = 2 moretrees.fir_model.random_level = 2 - minetest.env:remove_node(pos) - local leaves = minetest.env:find_nodes_in_area({x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, "default:leaves") + minetest.remove_node(pos) + local leaves = minetest.find_nodes_in_area({x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, "default:leaves") for leaf in ipairs(leaves) do - minetest.env:remove_node(leaves[leaf]) + minetest.remove_node(leaves[leaf]) end - minetest.env:spawn_tree(pos,moretrees.fir_model) + minetest.spawn_tree(pos,moretrees.fir_model) end print("[Moretrees] Loaded (2013-02-11)") diff --git a/leafdecay.lua b/leafdecay.lua index 7c75f11..be22ba4 100644 --- a/leafdecay.lua +++ b/leafdecay.lua @@ -9,8 +9,8 @@ if moretrees.enable_leafdecay then interval = moretrees.leafdecay_delay, chance = moretrees.leafdecay_chance, action = function(pos, node, active_object_count, active_object_count_wider) - if not minetest.env:find_node_near(pos, moretrees.leafdecay_radius, "moretrees:"..treename.."_trunk") then - minetest.env:remove_node(pos) + if not minetest.find_node_near(pos, moretrees.leafdecay_radius, "moretrees:"..treename.."_trunk") then + minetest.remove_node(pos) nodeupdate(pos) end end @@ -23,8 +23,8 @@ if moretrees.enable_leafdecay then interval = moretrees.leafdecay_delay, chance = moretrees.leafdecay_chance, action = function(pos, node, active_object_count, active_object_count_wider) - if not minetest.env:find_node_near(pos, moretrees.leafdecay_radius, {"default:jungletree", "moretrees:jungletree_trunk"}) then - minetest.env:remove_node(pos) + if not minetest.find_node_near(pos, moretrees.leafdecay_radius, {"default:jungletree", "moretrees:jungletree_trunk"}) then + minetest.remove_node(pos) nodeupdate(pos) end end @@ -35,8 +35,8 @@ if moretrees.enable_leafdecay then interval = moretrees.leafdecay_delay, chance = moretrees.leafdecay_chance, action = function(pos, node, active_object_count, active_object_count_wider) - if not minetest.env:find_node_near(pos, moretrees.leafdecay_radius, "moretrees:fir_trunk") then - minetest.env:remove_node(pos) + if not minetest.find_node_near(pos, moretrees.leafdecay_radius, "moretrees:fir_trunk") then + minetest.remove_node(pos) nodeupdate(pos) end end @@ -47,8 +47,8 @@ if moretrees.enable_leafdecay then interval = moretrees.leafdecay_delay, chance = moretrees.leafdecay_chance, action = function(pos, node, active_object_count, active_object_count_wider) - if not minetest.env:find_node_near(pos, moretrees.palm_leafdecay_radius, "moretrees:palm_trunk") then - minetest.env:remove_node(pos) + if not minetest.find_node_near(pos, moretrees.palm_leafdecay_radius, "moretrees:palm_trunk") then + minetest.remove_node(pos) nodeupdate(pos) end end @@ -61,8 +61,8 @@ if moretrees.enable_default_leafdecay then interval = moretrees.default_leafdecay_delay, chance = moretrees.default_leafdecay_chance, action = function(pos, node, active_object_count, active_object_count_wider) - if not minetest.env:find_node_near(pos, moretrees.default_leafdecay_radius, {"default:tree"}) then - minetest.env:remove_node(pos) + if not minetest.find_node_near(pos, moretrees.default_leafdecay_radius, {"default:tree"}) then + minetest.remove_node(pos) nodeupdate(pos) end end diff --git a/node_defs.lua b/node_defs.lua index 651e0cf..281a71f 100644 --- a/node_defs.lua +++ b/node_defs.lua @@ -143,7 +143,7 @@ for i in ipairs(moretrees.treelist) do action = function(pos, node, active_object_count, active_object_count_wider) local fdir = node.param2 or 0 nfdir = dirs2[fdir+1] - minetest.env:add_node(pos, {name = "moretrees:"..treename.."_trunk", param2 = nfdir}) + minetest.add_node(pos, {name = "moretrees:"..treename.."_trunk", param2 = nfdir}) end, }) @@ -239,7 +239,7 @@ minetest.register_abm({ action = function(pos, node, active_object_count, active_object_count_wider) local fdir = node.param2 or 0 nfdir = dirs2[fdir+1] - minetest.env:add_node(pos, {name = "moretrees:rubber_tree_trunk_empty", param2 = nfdir}) + minetest.add_node(pos, {name = "moretrees:rubber_tree_trunk_empty", param2 = nfdir}) end, }) -- 2.30.2