add listring support to homedecor inventories

This commit is contained in:
Tim 2016-08-27 21:10:43 +02:00
parent a12d20abfc
commit 9e7ddd4a40
4 changed files with 25 additions and 12 deletions

View File

@ -9,37 +9,46 @@ local background = default.gui_bg .. default.gui_bg_img .. default.gui_slots
local default_inventory_formspecs = { local default_inventory_formspecs = {
["4"]="size[8,6]".. background .. ["4"]="size[8,6]".. background ..
"list[context;main;2,0;4,1;]" .. "list[context;main;2,0;4,1;]" ..
"list[current_player;main;0,2;8,4;]", "list[current_player;main;0,2;8,4;]" ..
"listring[]",
["6"]="size[8,6]".. background .. ["6"]="size[8,6]".. background ..
"list[context;main;1,0;6,1;]".. "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 .. ["8"]="size[8,6]".. background ..
"list[context;main;0,0;8,1;]".. "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 .. ["12"]="size[8,7]".. background ..
"list[context;main;1,0;6,2;]".. "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 .. ["16"]="size[8,7]".. background ..
"list[context;main;0,0;8,2;]".. "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 .. ["24"]="size[8,8]".. background ..
"list[context;main;0,0;8,3;]".. "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 .. ["32"]="size[8,9]".. background ..
"list[context;main;0,0.3;8,4;]".. "list[context;main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]".. "list[current_player;main;0,4.85;8,1;]"..
"list[current_player;main;0,6.08;8,3;8]".. "list[current_player;main;0,6.08;8,3;8]"..
"listring[context;main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85), default.get_hotbar_bg(0,4.85),
["50"]="size[10,10]".. background .. ["50"]="size[10,10]".. background ..
"list[context;main;0,0;10,5;]".. "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) local function get_formspec_by_size(size)

View File

@ -36,7 +36,8 @@ homedecor.register("trash_can_green_open", {
formspec = "size[8,9]" .. default.gui_bg .. default.gui_bg_img .. default.gui_slots .. formspec = "size[8,9]" .. default.gui_bg .. default.gui_bg_img .. default.gui_slots ..
"button[2.5,3.8;3,1;empty;Empty Trash]".. "button[2.5,3.8;3,1;empty;Empty Trash]"..
"list[context;main;2.5,0.5;3,3;]".. "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) on_receive_fields = function(pos, formname, fields, sender)
if fields.empty then if fields.empty then

View File

@ -39,7 +39,8 @@ homedecor.register("wardrobe", {
clothes_strings.. clothes_strings..
"vertlabel[0,5.2;STORAGE]".. "vertlabel[0,5.2;STORAGE]"..
"list[current_name;main;0.5,4.5;5,2;]".. "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, end,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View File

@ -95,7 +95,8 @@ function inbox.get_inbox_formspec(pos)
local formspec = local formspec =
"size[8,9]".. "size[8,9]"..
"list[nodemeta:".. spos .. ";main;0,0;8,4;]".. "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 return formspec
end end
@ -104,6 +105,7 @@ function inbox.get_inbox_insert_formspec(pos)
local formspec = local formspec =
"size[8,9]".. "size[8,9]"..
"list[nodemeta:".. spos .. ";drop;3.5,2;1,1;]".. "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 return formspec
end end