mirror of
https://github.com/mt-mods/moretrees.git
synced 2025-01-12 10:50:24 +01:00
Phased out all deprecated minetest.env:* uses in favor of minetest.*
This commit is contained in:
parent
9e2c0485f4
commit
c277590fc2
36
init.lua
36
init.lua
@ -115,22 +115,22 @@ end
|
|||||||
-- Code to spawn a birch tree
|
-- Code to spawn a birch tree
|
||||||
|
|
||||||
function moretrees:grow_birch(pos)
|
function moretrees:grow_birch(pos)
|
||||||
minetest.env:remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
if math.random(1,2) == 1 then
|
if math.random(1,2) == 1 then
|
||||||
minetest.env:spawn_tree(pos, moretrees.birch_model1)
|
minetest.spawn_tree(pos, moretrees.birch_model1)
|
||||||
else
|
else
|
||||||
minetest.env:spawn_tree(pos, moretrees.birch_model2)
|
minetest.spawn_tree(pos, moretrees.birch_model2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Code to spawn a spruce tree
|
-- Code to spawn a spruce tree
|
||||||
|
|
||||||
function moretrees:grow_spruce(pos)
|
function moretrees:grow_spruce(pos)
|
||||||
minetest.env:remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
if math.random(1,2) == 1 then
|
if math.random(1,2) == 1 then
|
||||||
minetest.env:spawn_tree(pos, moretrees.spruce_model1)
|
minetest.spawn_tree(pos, moretrees.spruce_model1)
|
||||||
else
|
else
|
||||||
minetest.env:spawn_tree(pos, moretrees.spruce_model2)
|
minetest.spawn_tree(pos, moretrees.spruce_model2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -180,12 +180,12 @@ function moretrees:grow_jungletree(pos)
|
|||||||
moretrees.jungletree_model.rules_b = moretrees.jt_rules_b2
|
moretrees.jungletree_model.rules_b = moretrees.jt_rules_b2
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.env:remove_node(pos)
|
minetest.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")
|
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
|
for leaf in ipairs(leaves) do
|
||||||
minetest.env:remove_node(leaves[leaf])
|
minetest.remove_node(leaves[leaf])
|
||||||
end
|
end
|
||||||
minetest.env:spawn_tree(pos, moretrees.jungletree_model)
|
minetest.spawn_tree(pos, moretrees.jungletree_model)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- code to spawn fir trees
|
-- code to spawn fir trees
|
||||||
@ -207,12 +207,12 @@ function moretrees:grow_fir(pos)
|
|||||||
moretrees.fir_model.iterations = 7
|
moretrees.fir_model.iterations = 7
|
||||||
moretrees.fir_model.random_level = 5
|
moretrees.fir_model.random_level = 5
|
||||||
|
|
||||||
minetest.env:remove_node(pos)
|
minetest.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")
|
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
|
for leaf in ipairs(leaves) do
|
||||||
minetest.env:remove_node(leaves[leaf])
|
minetest.remove_node(leaves[leaf])
|
||||||
end
|
end
|
||||||
minetest.env:spawn_tree(pos,moretrees.fir_model)
|
minetest.spawn_tree(pos,moretrees.fir_model)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- same thing, but a smaller version that grows only in snow biomes
|
-- 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.iterations = 2
|
||||||
moretrees.fir_model.random_level = 2
|
moretrees.fir_model.random_level = 2
|
||||||
|
|
||||||
minetest.env:remove_node(pos)
|
minetest.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")
|
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
|
for leaf in ipairs(leaves) do
|
||||||
minetest.env:remove_node(leaves[leaf])
|
minetest.remove_node(leaves[leaf])
|
||||||
end
|
end
|
||||||
minetest.env:spawn_tree(pos,moretrees.fir_model)
|
minetest.spawn_tree(pos,moretrees.fir_model)
|
||||||
end
|
end
|
||||||
|
|
||||||
print("[Moretrees] Loaded (2013-02-11)")
|
print("[Moretrees] Loaded (2013-02-11)")
|
||||||
|
@ -9,8 +9,8 @@ if moretrees.enable_leafdecay then
|
|||||||
interval = moretrees.leafdecay_delay,
|
interval = moretrees.leafdecay_delay,
|
||||||
chance = moretrees.leafdecay_chance,
|
chance = moretrees.leafdecay_chance,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
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
|
if not minetest.find_node_near(pos, moretrees.leafdecay_radius, "moretrees:"..treename.."_trunk") then
|
||||||
minetest.env:remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
nodeupdate(pos)
|
nodeupdate(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -23,8 +23,8 @@ if moretrees.enable_leafdecay then
|
|||||||
interval = moretrees.leafdecay_delay,
|
interval = moretrees.leafdecay_delay,
|
||||||
chance = moretrees.leafdecay_chance,
|
chance = moretrees.leafdecay_chance,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
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
|
if not minetest.find_node_near(pos, moretrees.leafdecay_radius, {"default:jungletree", "moretrees:jungletree_trunk"}) then
|
||||||
minetest.env:remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
nodeupdate(pos)
|
nodeupdate(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -35,8 +35,8 @@ if moretrees.enable_leafdecay then
|
|||||||
interval = moretrees.leafdecay_delay,
|
interval = moretrees.leafdecay_delay,
|
||||||
chance = moretrees.leafdecay_chance,
|
chance = moretrees.leafdecay_chance,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
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
|
if not minetest.find_node_near(pos, moretrees.leafdecay_radius, "moretrees:fir_trunk") then
|
||||||
minetest.env:remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
nodeupdate(pos)
|
nodeupdate(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -47,8 +47,8 @@ if moretrees.enable_leafdecay then
|
|||||||
interval = moretrees.leafdecay_delay,
|
interval = moretrees.leafdecay_delay,
|
||||||
chance = moretrees.leafdecay_chance,
|
chance = moretrees.leafdecay_chance,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
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
|
if not minetest.find_node_near(pos, moretrees.palm_leafdecay_radius, "moretrees:palm_trunk") then
|
||||||
minetest.env:remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
nodeupdate(pos)
|
nodeupdate(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -61,8 +61,8 @@ if moretrees.enable_default_leafdecay then
|
|||||||
interval = moretrees.default_leafdecay_delay,
|
interval = moretrees.default_leafdecay_delay,
|
||||||
chance = moretrees.default_leafdecay_chance,
|
chance = moretrees.default_leafdecay_chance,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
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
|
if not minetest.find_node_near(pos, moretrees.default_leafdecay_radius, {"default:tree"}) then
|
||||||
minetest.env:remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
nodeupdate(pos)
|
nodeupdate(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -143,7 +143,7 @@ for i in ipairs(moretrees.treelist) do
|
|||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local fdir = node.param2 or 0
|
local fdir = node.param2 or 0
|
||||||
nfdir = dirs2[fdir+1]
|
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,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ minetest.register_abm({
|
|||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local fdir = node.param2 or 0
|
local fdir = node.param2 or 0
|
||||||
nfdir = dirs2[fdir+1]
|
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,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user