Skip to content
Snippets Groups Projects
Commit 5adbd3f0 authored by Vanessa Ezekowitz's avatar Vanessa Ezekowitz
Browse files

minetest.env:* is deprecated, use minetest.*

parent 9032385b
No related branches found
No related tags found
No related merge requests found
......@@ -13,8 +13,8 @@ local function spawn_apple_under(pos)
y = pos.y - 1,
z = pos.z,
}
if minetest.env:get_node(below).name == "air" then
minetest.env:add_node(below, { name = "default:apple" })
if minetest.get_node(below).name == "air" then
minetest.add_node(below, { name = "default:apple" })
end
end
......
......@@ -3,19 +3,19 @@ local NODE_YOUNG = "young"
nature = {}
local function set_young_node(pos)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string(NODE_YOUNG, "true")
minetest.after(5,
function(pos)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string(NODE_YOUNG, "false")
end,
pos)
end
local function is_not_young(pos)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
local young = meta:get_string(NODE_YOUNG)
return young ~= "true"
......@@ -23,12 +23,12 @@ end
function nature:grow_node(pos, nodename)
if pos ~= nil then
local light_enough = minetest.env:get_node_light(pos, nil)
local light_enough = minetest.get_node_light(pos, nil)
>= MINIMUM_GROWTH_LIGHT
if is_not_young(pos) and light_enough then
minetest.env:remove_node(pos)
minetest.env:add_node(pos, { name = nodename })
minetest.remove_node(pos)
minetest.add_node(pos, { name = nodename })
set_young_node(pos)
minetest.log("info", nodename .. " has grown at " .. pos.x .. ","
......@@ -38,6 +38,6 @@ function nature:grow_node(pos, nodename)
end
function nature:is_near_water(pos)
return minetest.env:find_node_near(pos, DISTANCE_FROM_WATER,
return minetest.find_node_near(pos, DISTANCE_FROM_WATER,
{ "default:water_source" }) ~= nil or DISTANCE_FROM_WATER == -1
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment