summaryrefslogtreecommitdiff
path: root/internal.lua
diff options
context:
space:
mode:
authorShadowNinja <noreply@gmail.com>2013-10-02 23:25:07 -0400
committerShadowNinja <noreply@gmail.com>2013-10-02 23:25:07 -0400
commit04600f64d879f87f54d4dd7b9654a7a921149a44 (patch)
treec7077a3c40a58c5ca3489ec61ff13835310b13d8 /internal.lua
parentec328d8270796313e039d4f206d5791577e86475 (diff)
API tweaks
Diffstat (limited to 'internal.lua')
-rw-r--r--internal.lua17
1 files changed, 13 insertions, 4 deletions
diff --git a/internal.lua b/internal.lua
index cbd134f..76a242b 100644
--- a/internal.lua
+++ b/internal.lua
@@ -5,18 +5,18 @@ function unified_inventory.get_formspec(player, page)
end
local player_name = player:get_player_name()
unified_inventory.current_page[player_name] = page
+ local pagedef = unified_inventory.pages[page]
local formspec = "size[14,10]"
-
- -- Player inventory
- formspec = formspec .. "list[current_player;main;0,4.5;8,4;]"
+ local fsdata = nil
-- Background
formspec = formspec .. "background[-0.19,-0.2;14.38,10.55;ui_form_bg.png]"
-- Current page
if unified_inventory.pages[page] then
- formspec = unified_inventory.pages[page].get_formspec(player, formspec)
+ fsdata = pagedef.get_formspec(player)
+ formspec = formspec .. fsdata.formspec
else
return "" -- Invalid page name
end
@@ -31,6 +31,15 @@ function unified_inventory.get_formspec(player, page)
end
end
+ if fsdata.draw_inventory ~= false then
+ -- Player inventory
+ formspec = formspec .. "list[current_player;main;0,4.5;8,4;]"
+ end
+
+ if fsdata.draw_item_list == false then
+ return formspec
+ end
+
-- Controls to flip items pages
local start_x = 9.2
formspec = formspec .. "image_button["..(start_x + 0.6 * 0)..",9;.8,.8;ui_skip_backward_icon.png;start_list;]"