From 04600f64d879f87f54d4dd7b9654a7a921149a44 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Wed, 2 Oct 2013 23:25:07 -0400 Subject: API tweaks --- internal.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'internal.lua') 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;]" -- cgit v1.2.3