use string.format() to create the standard_inv variables

do it just once, after the lite mode settings are applied
(if applicable)
This commit is contained in:
Vanessa Dannenberg 2021-03-07 05:33:25 -05:00
parent 7e27f584eb
commit 8056bdf966
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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