forked from minetest-mods/more_chests
Remove .env: old API usage.
Original title: 🐈
This commit is contained in:
parent
4890dc8c7e
commit
a8183cfbd3
12
cobble.lua
12
cobble.lua
@ -29,12 +29,12 @@ minetest.register_node("more_chests:cobble", {
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec",
|
||||
"size[8,9]"..
|
||||
"list[current_name;main;0,0;8,4;]"..
|
||||
@ -44,12 +44,12 @@ minetest.register_node("more_chests:cobble", {
|
||||
inv:set_size("main", 8*4)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not has_locked_chest_privilege(meta, player) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a locked chest belonging to "..
|
||||
@ -60,7 +60,7 @@ minetest.register_node("more_chests:cobble", {
|
||||
return count
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not has_locked_chest_privilege(meta, player) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a locked chest belonging to "..
|
||||
@ -71,7 +71,7 @@ minetest.register_node("more_chests:cobble", {
|
||||
return stack:get_count()
|
||||
end,
|
||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not has_locked_chest_privilege(meta, player) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a locked chest belonging to "..
|
||||
|
14
secret.lua
14
secret.lua
@ -36,13 +36,13 @@ minetest.register_node("more_chests:secret", {
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
meta:set_string("infotext", "Secret Chest (owned by "..
|
||||
meta:get_string("owner")..")")
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", open)
|
||||
meta:set_string("infotext", "Secret Chest")
|
||||
meta:set_string("owner", "")
|
||||
@ -50,12 +50,12 @@ minetest.register_node("more_chests:secret", {
|
||||
inv:set_size("main", 8*4)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not has_locked_chest_privilege(meta, player) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a secret chest belonging to "..
|
||||
@ -66,7 +66,7 @@ minetest.register_node("more_chests:secret", {
|
||||
return count
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not has_locked_chest_privilege(meta, player) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a secret chest belonging to "..
|
||||
@ -77,7 +77,7 @@ minetest.register_node("more_chests:secret", {
|
||||
return stack:get_count()
|
||||
end,
|
||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not has_locked_chest_privilege(meta, player) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a secret chest belonging to "..
|
||||
@ -100,7 +100,7 @@ minetest.register_node("more_chests:secret", {
|
||||
" takes stuff from secret chest at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if has_locked_chest_privilege(meta, sender) then
|
||||
if fields.open == "open" then
|
||||
meta:set_string("formspec", open)
|
||||
|
14
shared.lua
14
shared.lua
@ -43,13 +43,13 @@ minetest.register_node("more_chests:shared", {
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
meta:set_string("infotext", "Shared Chest (owned by "..
|
||||
meta:get_string("owner")..")")
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", get_formspec(""))
|
||||
meta:set_string("infotext", "Shared Chest")
|
||||
meta:set_string("owner", "")
|
||||
@ -57,12 +57,12 @@ minetest.register_node("more_chests:shared", {
|
||||
inv:set_size("main", 8*4)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not has_locked_chest_privilege(meta, player) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a shared chest belonging to "..
|
||||
@ -73,7 +73,7 @@ minetest.register_node("more_chests:shared", {
|
||||
return count
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not has_locked_chest_privilege(meta, player) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a shared chest belonging to "..
|
||||
@ -84,7 +84,7 @@ minetest.register_node("more_chests:shared", {
|
||||
return stack:get_count()
|
||||
end,
|
||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not has_locked_chest_privilege(meta, player) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a shared chest belonging to "..
|
||||
@ -107,7 +107,7 @@ minetest.register_node("more_chests:shared", {
|
||||
" takes stuff from shared chest at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_receive_fields = function(pos, formspec, fields, sender)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
if fields.shared then
|
||||
if meta:get_string("owner") == sender:get_player_name() then
|
||||
meta:set_string("shared", fields.shared);
|
||||
|
2
wifi.lua
2
wifi.lua
@ -9,7 +9,7 @@ minetest.register_node("more_chests:wifi", {
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec",
|
||||
"size[8,9]"..
|
||||
"list[current_player;more_chests:wifi;0,0;8,4;]"..
|
||||
|
Loading…
Reference in New Issue
Block a user