forked from mtcontrib/locks
removed deprecated minetest.env calls
This commit is contained in:
parent
7846aa3894
commit
692608e1f4
15
init.lua
15
init.lua
@ -21,6 +21,7 @@
|
||||
-- Version 2.00
|
||||
|
||||
-- Changelog:
|
||||
-- 30.07.2018 * Removed deprecated minetest.env usage.
|
||||
-- 30.07.2018 * Front side of chest does not get pipeworks image anymore.
|
||||
-- Instead it always shows the locks texture as overlay.
|
||||
-- 30.07.2018 * Fixed bug with pipeworks.
|
||||
@ -63,7 +64,7 @@ function locks:lock_init( pos, default_formspec )
|
||||
return;
|
||||
end
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
if( meta == nil ) then
|
||||
print( "Error: [locks] lock_init: unable to get meta data");
|
||||
return;
|
||||
@ -92,7 +93,7 @@ function locks:get_lockdata( pos )
|
||||
return;
|
||||
end
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
if( meta == nil) then
|
||||
return;
|
||||
end
|
||||
@ -113,7 +114,7 @@ function locks:set_lockdata( pos, data )
|
||||
return;
|
||||
end
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
if( meta == nil) then
|
||||
return;
|
||||
end
|
||||
@ -141,7 +142,7 @@ function locks:lock_set_owner( pos, player_or_name, description )
|
||||
return false;
|
||||
end
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
if( meta == nil ) then
|
||||
print( "Error: [locks] lock_set_owner: unable to get meta data");
|
||||
return;
|
||||
@ -171,7 +172,7 @@ function locks:lock_allow_dig( pos, player )
|
||||
return false;
|
||||
end
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
local lock_owner = meta:get_string("owner");
|
||||
|
||||
-- locks who lost their owner can be opened/digged by anyone
|
||||
@ -211,7 +212,7 @@ function locks:lock_allow_use( pos, player )
|
||||
end
|
||||
|
||||
local name = player:get_player_name();
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
||||
-- pipeworks sends a special username
|
||||
if( player.is_fake_player) then
|
||||
@ -303,7 +304,7 @@ function locks:lock_handle_input( pos, formname, fields, player )
|
||||
return false;
|
||||
end
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
if( meta == nil ) then
|
||||
print( "Error: [locks] lock_handle_input: unable to get meta data");
|
||||
return;
|
||||
|
@ -21,12 +21,12 @@ if( locks.pipeworks_enabled ) then
|
||||
tubedevice = 1, tubedevice_receiver = 1 };
|
||||
locks.chest_add.tube = {
|
||||
insert_object = function(pos, node, stack, direction)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv:add_item("main", stack)
|
||||
end,
|
||||
can_insert = function(pos, node, stack, direction)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv:room_for_item("main", stack)
|
||||
end,
|
||||
@ -45,7 +45,7 @@ minetest.register_node("locks:shared_locked_chest", {
|
||||
legacy_facedir_simple = true,
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
-- prepare the lock of the chest
|
||||
locks:lock_init( pos,
|
||||
"size[8,10]"..
|
||||
@ -78,7 +78,7 @@ minetest.register_node("locks:shared_locked_chest", {
|
||||
if( not(locks:lock_allow_dig( pos, player ))) then
|
||||
return false;
|
||||
end
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end,
|
||||
|
@ -60,7 +60,7 @@ if( locks.pipeworks_enabled ) then
|
||||
tubedevice = 1, tubedevice_receiver = 1 };
|
||||
locks.furnace_add.tube = {
|
||||
insert_object = function(pos, node, stack, direction)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if direction.y == 1 then
|
||||
return inv:add_item("fuel",stack)
|
||||
@ -69,7 +69,7 @@ if( locks.pipeworks_enabled ) then
|
||||
end
|
||||
end,
|
||||
can_insert = function(pos, node, stack, direction)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if direction.y == 1 then
|
||||
return inv:room_for_item("fuel", stack)
|
||||
|
@ -23,7 +23,7 @@ minetest.register_node("locks:shared_locked_sign_wall", {
|
||||
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
-- prepare the lock of the sign
|
||||
locks:lock_init( pos,
|
||||
"size[8,4]"..
|
||||
@ -51,7 +51,7 @@ minetest.register_node("locks:shared_locked_sign_wall", {
|
||||
and locks:lock_allow_use( pos, sender )) then
|
||||
|
||||
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
fields.text = fields.text or "";
|
||||
print((sender:get_player_name() or "").." wrote \""..fields.text..
|
||||
"\" to sign at "..minetest.pos_to_string(pos));
|
||||
|
@ -40,8 +40,8 @@ local xdoors2_transform = function(pos, node, puncher)
|
||||
end
|
||||
|
||||
local olddata = locks:get_lockdata( pos );
|
||||
minetest.env:add_node(pos, {name = "locks:door_bottom_"..t, param2 = p2})
|
||||
minetest.env:add_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "locks:door_top_"..t, param2 = p2})
|
||||
minetest.add_node(pos, {name = "locks:door_bottom_"..t, param2 = p2})
|
||||
minetest.add_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "locks:door_top_"..t, param2 = p2})
|
||||
|
||||
-- remember who owns the door, what passwords are set etc.
|
||||
locks:set_lockdata( pos, olddata );
|
||||
@ -53,8 +53,8 @@ local xdoors2_destruct = function(pos, oldnode)
|
||||
if is_top(oldnode.name) then
|
||||
pos = {x = pos.x, y = pos.y - 1, z = pos.z}
|
||||
end
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
|
||||
minetest.remove_node(pos)
|
||||
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
|
||||
end
|
||||
|
||||
for i = 1, 2 do
|
||||
@ -149,7 +149,7 @@ minetest.register_node("locks:door", {
|
||||
return itemstack
|
||||
else
|
||||
-- there should be 2 empty nodes
|
||||
if minetest.env:get_node(above1).name ~= "air" then
|
||||
if minetest.get_node(above1).name ~= "air" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
@ -165,14 +165,14 @@ minetest.register_node("locks:door", {
|
||||
end
|
||||
|
||||
local t = 1
|
||||
local another_door = minetest.env:get_node({x = above.x + delta[fdir + 1].x, y = above.y, z = above.z + delta[fdir + 1].z})
|
||||
local another_door = minetest.get_node({x = above.x + delta[fdir + 1].x, y = above.y, z = above.z + delta[fdir + 1].z})
|
||||
if (another_door.name:sub(-1) == "1" and another_door.param2 == fdir)
|
||||
or (another_door.name:sub(-1) == "2" and another_door.param2 == (fdir + 1) % 4) then
|
||||
t = 2
|
||||
end
|
||||
|
||||
minetest.env:add_node(above, {name = "locks:door_bottom_"..t, param2 = fdir})
|
||||
minetest.env:add_node({x = above.x, y = above.y + 1, z = above.z}, {name = "locks:door_top_"..t, param2 = fdir})
|
||||
minetest.add_node(above, {name = "locks:door_bottom_"..t, param2 = fdir})
|
||||
minetest.add_node({x = above.x, y = above.y + 1, z = above.z}, {name = "locks:door_top_"..t, param2 = fdir})
|
||||
|
||||
-- store who owns the door; the other data can be default for now
|
||||
locks:lock_set_owner( above, placer:get_player_name() or "", "Shared locked door");
|
||||
|
Loading…
Reference in New Issue
Block a user