From 9e7ddd4a40f5b727ca54f4fe99407833124e893a Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 27 Aug 2016 21:10:43 +0200 Subject: [PATCH 1/2] add listring support to homedecor inventories --- homedecor/handlers/inventory.lua | 25 +++++++++++++++++-------- homedecor/trash_cans.lua | 3 ++- homedecor/wardrobe.lua | 3 ++- inbox/init.lua | 6 ++++-- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/homedecor/handlers/inventory.lua b/homedecor/handlers/inventory.lua index 44b6945..dc4b740 100644 --- a/homedecor/handlers/inventory.lua +++ b/homedecor/handlers/inventory.lua @@ -8,38 +8,47 @@ end local background = default.gui_bg .. default.gui_bg_img .. default.gui_slots local default_inventory_formspecs = { ["4"]="size[8,6]".. background .. - "list[context;main;2,0;4,1;]".. - "list[current_player;main;0,2;8,4;]", + "list[context;main;2,0;4,1;]" .. + "list[current_player;main;0,2;8,4;]" .. + "listring[]", ["6"]="size[8,6]".. background .. "list[context;main;1,0;6,1;]".. - "list[current_player;main;0,2;8,4;]", + "list[current_player;main;0,2;8,4;]" .. + "listring[]", ["8"]="size[8,6]".. background .. "list[context;main;0,0;8,1;]".. - "list[current_player;main;0,2;8,4;]", + "list[current_player;main;0,2;8,4;]" .. + "listring[]", ["12"]="size[8,7]".. background .. "list[context;main;1,0;6,2;]".. - "list[current_player;main;0,3;8,4;]", + "list[current_player;main;0,3;8,4;]" .. + "listring[]", ["16"]="size[8,7]".. background .. "list[context;main;0,0;8,2;]".. - "list[current_player;main;0,3;8,4;]", + "list[current_player;main;0,3;8,4;]" .. + "listring[]", ["24"]="size[8,8]".. background .. "list[context;main;0,0;8,3;]".. - "list[current_player;main;0,4;8,4;]", + "list[current_player;main;0,4;8,4;]" .. + "listring[]", ["32"]="size[8,9]".. background .. "list[context;main;0,0.3;8,4;]".. "list[current_player;main;0,4.85;8,1;]".. "list[current_player;main;0,6.08;8,3;8]".. + "listring[context;main]" .. + "listring[current_player;main]" .. default.get_hotbar_bg(0,4.85), ["50"]="size[10,10]".. background .. "list[context;main;0,0;10,5;]".. - "list[current_player;main;1,6;8,4;]", + "list[current_player;main;1,6;8,4;]" .. + "listring[]", } local function get_formspec_by_size(size) diff --git a/homedecor/trash_cans.lua b/homedecor/trash_cans.lua index a7aa5d3..70c45d8 100644 --- a/homedecor/trash_cans.lua +++ b/homedecor/trash_cans.lua @@ -36,7 +36,8 @@ homedecor.register("trash_can_green_open", { formspec = "size[8,9]" .. default.gui_bg .. default.gui_bg_img .. default.gui_slots .. "button[2.5,3.8;3,1;empty;Empty Trash]".. "list[context;main;2.5,0.5;3,3;]".. - "list[current_player;main;0,5;8,4;]", + "list[current_player;main;0,5;8,4;]" .. + "listring[]", }, on_receive_fields = function(pos, formname, fields, sender) if fields.empty then diff --git a/homedecor/wardrobe.lua b/homedecor/wardrobe.lua index 86b29ef..c7dde42 100644 --- a/homedecor/wardrobe.lua +++ b/homedecor/wardrobe.lua @@ -39,7 +39,8 @@ homedecor.register("wardrobe", { clothes_strings.. "vertlabel[0,5.2;STORAGE]".. "list[current_name;main;0.5,4.5;5,2;]".. - "list[current_player;main;0.5,6.8;5,2;]") + "list[current_player;main;0.5,6.8;5,2;]" .. + "listring[]") end, on_receive_fields = function(pos, formname, fields, sender) local meta = minetest.get_meta(pos) diff --git a/inbox/init.lua b/inbox/init.lua index 6189784..26969a6 100644 --- a/inbox/init.lua +++ b/inbox/init.lua @@ -95,7 +95,8 @@ function inbox.get_inbox_formspec(pos) local formspec = "size[8,9]".. "list[nodemeta:".. spos .. ";main;0,0;8,4;]".. - "list[current_player;main;0,5;8,4;]" + "list[current_player;main;0,5;8,4;]" .. + "listring[]" return formspec end @@ -104,6 +105,7 @@ function inbox.get_inbox_insert_formspec(pos) local formspec = "size[8,9]".. "list[nodemeta:".. spos .. ";drop;3.5,2;1,1;]".. - "list[current_player;main;0,5;8,4;]" + "list[current_player;main;0,5;8,4;]".. + "listring[]" return formspec end From 32ef2377d4e7fc75166d4cb0525dbbf0aeeff92c Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 27 Aug 2016 21:11:16 +0200 Subject: [PATCH 2/2] fix wrong reference introduced in 436fdfac causing can_dig for mailboxes always to fail --- inbox/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inbox/init.lua b/inbox/init.lua index 26969a6..d188f0d 100644 --- a/inbox/init.lua +++ b/inbox/init.lua @@ -64,7 +64,7 @@ minetest.register_node("inbox:empty", { local name = player and player:get_player_name() local owner = meta:get_string("owner") local inv = meta:get_inventory() - return player == owner and inv:is_empty("main") + return name == owner and inv:is_empty("main") end, on_metadata_inventory_put = function(pos, listname, index, stack, player) local meta = minetest.get_meta(pos)