1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 00:20:17 +01:00

minetest.env:* --> minetest.*

This commit is contained in:
Vanessa Ezekowitz 2014-11-30 12:21:28 -05:00
parent 4b148c416b
commit 4de58abc31
6 changed files with 83 additions and 83 deletions

View File

@ -30,7 +30,7 @@ computer.register = function ( name, def )
if (def.on_turn_off(pos, node, clicker, itemstack)) then return; end
end
node.name = OFFSTATE;
minetest.env:set_node(pos, node);
minetest.set_node(pos, node);
nodeupdate(pos);
end;
});
@ -55,7 +55,7 @@ computer.register = function ( name, def )
if (def.on_turn_on(pos, node, clicker, itemstack)) then return; end
end
node.name = ONSTATE;
minetest.env:set_node(pos, node);
minetest.set_node(pos, node);
nodeupdate(pos);
end;
drop = ONSTATE;

View File

@ -47,9 +47,9 @@ facedir[3] = {x=-1,y=0,z=0}
local remove_item = function(pos, node)
local objs = nil
if node.name == "itemframes:frame" then
objs = minetest.env:get_objects_inside_radius(pos, .5)
objs = minetest.get_objects_inside_radius(pos, .5)
elseif node.name == "itemframes:pedestal" then
objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y+1,z=pos.z}, .5)
objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y+1,z=pos.z}, .5)
end
if objs then
for _, obj in ipairs(objs) do
@ -62,7 +62,7 @@ end
local update_item = function(pos, node)
remove_item(pos, node)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if meta:get_string("item") ~= "" then
if node.name == "itemframes:frame" then
local posad = facedir[node.param2]
@ -75,7 +75,7 @@ local update_item = function(pos, node)
end
tmp.nodename = node.name
tmp.texture = ItemStack(meta:get_string("item")):get_name()
local e = minetest.env:add_entity(pos,"itemframes:item")
local e = minetest.add_entity(pos,"itemframes:item")
if node.name == "itemframes:frame" then
local yaw = math.pi*2 - node.param2 * math.pi/2
e:setyaw(yaw)
@ -84,12 +84,12 @@ local update_item = function(pos, node)
end
local 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 == "itemframes:frame" then
minetest.env:add_item(pos, meta:get_string("item"))
minetest.add_item(pos, meta:get_string("item"))
elseif node.name == "itemframes:pedestal" 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
@ -111,13 +111,13 @@ minetest.register_node("itemframes:frame",{
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
after_place_node = function(pos, placer, itemstack)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("owner",placer:get_player_name())
meta:set_string("infotext","Item frame (owned by "..placer:get_player_name()..")")
end,
on_rightclick = function(pos, node, clicker, itemstack)
if not itemstack then return end
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if clicker:get_player_name() == meta:get_string("owner") then
drop_item(pos,node)
local s = itemstack:take_item()
@ -127,14 +127,14 @@ minetest.register_node("itemframes:frame",{
return itemstack
end,
on_punch = function(pos,node,puncher)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if puncher:get_player_name() == meta:get_string("owner") then
drop_item(pos, node)
end
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
return player:get_player_name() == meta:get_string("owner")
end,
})
@ -155,13 +155,13 @@ minetest.register_node("itemframes:pedestal",{
groups = { cracky=3 },
sounds = default.node_sound_defaults(),
after_place_node = function(pos, placer, itemstack)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("owner",placer:get_player_name())
meta:set_string("infotext","Pedestal (owned by "..placer:get_player_name()..")")
end,
on_rightclick = function(pos, node, clicker, itemstack)
if not itemstack then return end
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if clicker:get_player_name() == meta:get_string("owner") then
drop_item(pos,node)
local s = itemstack:take_item()
@ -171,14 +171,14 @@ minetest.register_node("itemframes:pedestal",{
return itemstack
end,
on_punch = function(pos,node,puncher)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if puncher:get_player_name() == meta:get_string("owner") then
drop_item(pos,node)
end
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
return player:get_player_name() == meta:get_string("owner")
end,
})

View File

@ -26,7 +26,7 @@ minetest.register_node("lrfurn:coffeetable_back", {
},
on_construct = function(pos)
local node = minetest.env:get_node(pos)
local node = minetest.get_node(pos)
local param2 = node.param2
node.name = "lrfurn:coffeetable_front"
if param2 == 0 then
@ -38,13 +38,13 @@ minetest.register_node("lrfurn:coffeetable_back", {
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.env:set_node(pos, node)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.set_node(pos, node)
end
end,
on_destruct = function(pos)
local node = minetest.env:get_node(pos)
local node = minetest.get_node(pos)
local param2 = node.param2
if param2 == 0 then
pos.z = pos.z+1
@ -55,9 +55,9 @@ minetest.register_node("lrfurn:coffeetable_back", {
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:coffeetable_front" ) then
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.env:remove_node(pos)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:coffeetable_front" ) then
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.remove_node(pos)
end
end
end,

View File

@ -48,7 +48,7 @@ for i in ipairs(longsofas_list) do
},
on_construct = function(pos)
local node = minetest.env:get_node(pos)
local node = minetest.get_node(pos)
local param2 = node.param2
node.name = "lrfurn:longsofa_middle_"..colour
if param2 == 0 then
@ -60,8 +60,8 @@ for i in ipairs(longsofas_list) do
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.env:set_node(pos, node)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.set_node(pos, node)
node.name = "lrfurn:longsofa_left_"..colour
if param2 == 0 then
pos.z = pos.z+1
@ -72,14 +72,14 @@ for i in ipairs(longsofas_list) do
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.env:set_node(pos, node)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.set_node(pos, node)
end
end
end,
on_destruct = function(pos)
local node = minetest.env:get_node(pos)
local node = minetest.get_node(pos)
local param2 = node.param2
if param2 == 0 then
pos.z = pos.z+1
@ -90,9 +90,9 @@ for i in ipairs(longsofas_list) do
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:longsofa_middle_"..colour ) then
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.env:remove_node(pos)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:longsofa_middle_"..colour ) then
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.remove_node(pos)
if param2 == 0 then
pos.z = pos.z+1
elseif param2 == 1 then
@ -102,9 +102,9 @@ for i in ipairs(longsofas_list) do
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:longsofa_left_"..colour ) then
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.env:remove_node(pos)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:longsofa_left_"..colour ) then
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.remove_node(pos)
end
end
end

View File

@ -48,7 +48,7 @@ for i in ipairs(sofas_list) do
},
on_construct = function(pos)
local node = minetest.env:get_node(pos)
local node = minetest.get_node(pos)
local param2 = node.param2
node.name = "lrfurn:sofa_left_"..colour
if param2 == 0 then
@ -60,13 +60,13 @@ for i in ipairs(sofas_list) do
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.env:set_node(pos, node)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.set_node(pos, node)
end
end,
on_destruct = function(pos)
local node = minetest.env:get_node(pos)
local node = minetest.get_node(pos)
local param2 = node.param2
if param2 == 0 then
pos.z = pos.z+1
@ -77,9 +77,9 @@ for i in ipairs(sofas_list) do
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:sofa_left_"..colour ) then
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.env:remove_node(pos)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:sofa_left_"..colour ) then
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.remove_node(pos)
end
end
end,

View File

@ -215,146 +215,146 @@ after_place_node = function(pos,placer,itemstack)
local p = {x=pos.x, y=pos.y, z=pos.z}
if param2 == 0 then
pos.x = pos.x-1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen4", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.x = pos.x+2
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen6", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.y = pos.y+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen3", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.x = pos.x-1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen2", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.x = pos.x-1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen1", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
elseif param2 == 1 then
pos.z = pos.z+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen4", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.z = pos.z-2
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen6", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.y = pos.y+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen3", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.z = pos.z+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen2", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.z = pos.z+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen1", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
elseif param2 == 2 then
pos.x = pos.x+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen4", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.x = pos.x-2
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen6", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.y = pos.y+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen3", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.x = pos.x+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen2", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.x = pos.x+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen1", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
elseif param2 == 3 then
pos.z = pos.z-1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen4", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.z = pos.z+2
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen6", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.y = pos.y+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen3", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.z = pos.z-1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen2", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.z = pos.z-1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen1", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
end