From 82bc2d3f959ff18b7ef7beed7bb9ee3c0f261c0a Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Sun, 7 Mar 2021 05:33:25 -0500 Subject: [PATCH] use string.format() to create the standard_inv variables do it just once, after the lite mode settings are applied (if applicable) --- init.lua | 4 ---- internal.lua | 10 +++++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/init.lua b/init.lua index d534209..1538d65 100644 --- a/init.lua +++ b/init.lua @@ -61,10 +61,6 @@ unified_inventory = { standard_background = "background9[0,0;1,1;ui_formbg_9_sliced.png;true;16]", } -unified_inventory.standard_inv = "list[current_player;main;"..(unified_inventory.std_inv_x+0.15)..","..(unified_inventory.std_inv_y+0.15)..";8,4;]" -unified_inventory.standard_inv_bg = "image["..unified_inventory.std_inv_x..","..unified_inventory.std_inv_y..";"..(unified_inventory.imgscale*8).. - ","..(unified_inventory.imgscale*4)..";ui_main_inventory.png]" - -- Disable default creative inventory local creative = rawget(_G, "creative") or rawget(_G, "creative_inventory") if creative then diff --git a/internal.lua b/internal.lua index d8b736c..e1a24fd 100644 --- a/internal.lua +++ b/internal.lua @@ -69,12 +69,16 @@ function unified_inventory.get_per_player_formspec(player_name) ui.btn_size = 0.7 ui.std_inv_x = 0.1 ui.std_inv_y = 4.6 - ui.standard_inv = "list[current_player;main;"..(ui.std_inv_x+0.15)..","..(ui.std_inv_y+0.15)..";8,4;]" - ui.standard_inv_bg = "image["..ui.std_inv_x..","..ui.std_inv_y..";"..(unified_inventory.imgscale*8).. - ","..(unified_inventory.imgscale*4)..";ui_main_inventory.png]" + end ui.items_per_page = ui.pagecols * ui.pagerows + ui.standard_inv = string.format("list[current_player;main;%f,%f;8,4;]", + ui.std_inv_x+0.15, ui.std_inv_y+0.15) + + ui.standard_inv_bg = string.format("image[%f,%f;%f,%f;ui_main_inventory.png]", + ui.std_inv_x, ui.std_inv_y, + unified_inventory.imgscale*8, unified_inventory.imgscale*4) return ui, lite end