Replace the horribly outdated minetest.env stuff

This commit is contained in:
Wuzzy 2017-01-11 18:21:46 +01:00
parent c13823bcfc
commit bc0879911f
35 changed files with 335 additions and 335 deletions

View file

@ -45,7 +45,7 @@ facedir[3] = {x=-1,y=0,z=0}
local flower_pot_remove_item = function(pos, node)
local objs = nil
if node and node.name == "flowers:pot" then
objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, .5)
objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, .5)
end
if objs then
for _, obj in ipairs(objs) do
@ -58,24 +58,24 @@ end
flower_pot_update_item = function(pos, node)
flower_pot_remove_item(pos, node)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if meta and meta:get_string("item") ~= "" then
if node.name == "flowers:pot" then
pos.y = pos.y
end
flower_tmp.nodename = node.name
flower_tmp.texture = ItemStack(meta:get_string("item")):get_name()
local e = minetest.env:add_entity(pos,"flowers:item")
local e = minetest.add_entity(pos,"flowers:item")
end
end
flower_pot_drop_item = function(pos, node)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if meta:get_string("item") ~= "" then
if node.name == "flowers:pot" then
minetest.env:add_item({x=pos.x,y=pos.y+1,z=pos.z}, meta:get_string("item"))
minetest.add_item({x=pos.x,y=pos.y+1,z=pos.z}, meta:get_string("item"))
end
meta:set_string("item","")
end
flower_pot_remove_item(pos, node)
end
end