aboutsummaryrefslogtreecommitdiff
path: root/games/minimal/mods/default
diff options
context:
space:
mode:
Diffstat (limited to 'games/minimal/mods/default')
-rw-r--r--games/minimal/mods/default/init.lua63
1 files changed, 23 insertions, 40 deletions
diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua
index 428dfd9f4..fe7ab955e 100644
--- a/games/minimal/mods/default/init.lua
+++ b/games/minimal/mods/default/init.lua
@@ -1150,7 +1150,7 @@ minetest.register_node("default:chest", {
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
- "invsize[8,9;]"..
+ "size[8,9]"..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Chest")
@@ -1162,25 +1162,6 @@ minetest.register_node("default:chest", {
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
- on_metadata_inventory_move = function(pos, from_list, from_index,
- to_list, to_index, count, player)
- minetest.log("action", player:get_player_name()..
- " moves stuff in chest at "..minetest.pos_to_string(pos))
- return minetest.node_metadata_inventory_move_allow_all(
- pos, from_list, from_index, to_list, to_index, count, player)
- end,
- on_metadata_inventory_offer = function(pos, listname, index, stack, player)
- minetest.log("action", player:get_player_name()..
- " moves stuff to chest at "..minetest.pos_to_string(pos))
- return minetest.node_metadata_inventory_offer_allow_all(
- pos, listname, index, stack, player)
- end,
- on_metadata_inventory_take = function(pos, listname, index, count, player)
- minetest.log("action", player:get_player_name()..
- " takes stuff from chest at "..minetest.pos_to_string(pos))
- return minetest.node_metadata_inventory_take_allow_all(
- pos, listname, index, count, player)
- end,
})
local function has_locked_chest_privilege(meta, player)
@@ -1207,7 +1188,7 @@ minetest.register_node("default:chest_locked", {
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
- "invsize[8,9;]"..
+ "size[8,9]"..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Locked Chest")
@@ -1220,53 +1201,55 @@ minetest.register_node("default:chest_locked", {
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
- on_metadata_inventory_move = function(pos, from_list, from_index,
- to_list, to_index, count, player)
+ allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.env: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 "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
- return
+ return 0
end
- minetest.log("action", player:get_player_name()..
- " moves stuff in locked chest at "..minetest.pos_to_string(pos))
- return minetest.node_metadata_inventory_move_allow_all(
- pos, from_list, from_index, to_list, to_index, count, player)
+ return count
end,
- on_metadata_inventory_offer = function(pos, listname, index, stack, player)
+ allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.env: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 "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
- return stack
+ return 0
end
- minetest.log("action", player:get_player_name()..
- " moves stuff to locked chest at "..minetest.pos_to_string(pos))
- return minetest.node_metadata_inventory_offer_allow_all(
- pos, listname, index, stack, player)
+ return stack:get_count()
end,
- on_metadata_inventory_take = function(pos, listname, index, count, player)
+ allow_metadata_inventory_take = function(pos, listname, index, count, player)
local meta = minetest.env: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 "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
- return
+ return 0
end
+ return count
+ end,
+ on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
+ minetest.log("action", player:get_player_name()..
+ " moves stuff in locked chest at "..minetest.pos_to_string(pos))
+ end,
+ on_metadata_inventory_put = function(pos, listname, index, stack, player)
+ minetest.log("action", player:get_player_name()..
+ " moves stuff to locked chest at "..minetest.pos_to_string(pos))
+ end,
+ on_metadata_inventory_take = function(pos, listname, index, count, player)
minetest.log("action", player:get_player_name()..
" takes stuff from locked chest at "..minetest.pos_to_string(pos))
- return minetest.node_metadata_inventory_take_allow_all(
- pos, listname, index, count, player)
end,
})
default.furnace_inactive_formspec =
- "invsize[8,9;]"..
+ "size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
@@ -1405,7 +1388,7 @@ minetest.register_abm({
meta:set_string("infotext","Furnace active: "..percent.."%")
hacky_swap_node(pos,"default:furnace_active")
meta:set_string("formspec",
- "invsize[8,9;]"..
+ "size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100-percent)..":default_furnace_fire_fg.png]"..
"list[current_name;fuel;2,3;1,1;]"..