Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unified inventory positioning fix
diff --git a/mods/unified_inventory/internal.lua b/mods/unified_inventory/internal.lua
index 281653e..31fd35f 100644
--- a/mods/unified_inventory/internal.lua
+++ b/mods/unified_inventory/internal.lua
@@ -28,11 +28,11 @@ function unified_inventory.get_formspec(player, page)
unified_inventory.current_page[player_name] = page
local pagedef = unified_inventory.pages[page]
- local formspec = "size[14,10]"
+ local formspec = "size[13.5,9.5]"
local fsdata = nil
-- Background
- formspec = formspec .. "background[-0.19,-0.25;14.4,10.75;ui_form_bg.png]"
+ formspec = formspec .. "background[-0.25,-0.25;14,10;ui_form_bg.png]"
-- Current page
if unified_inventory.pages[page] then
fsdata = pagedef.get_formspec(player)
@@ -46,7 +46,7 @@ function unified_inventory.get_formspec(player, page)
local tooltip = def.tooltip or ""
if def.type == "image" then
formspec = formspec.."image_button["
- ..(0.65 * (i - 1))..",9;0.8,0.8;"
+ ..(0.65 * (i - 1))..",9;0.65,0.65;"
..minetest.formspec_escape(def.image)..";"
..minetest.formspec_escape(def.name)..";]"
.."tooltip["..minetest.formspec_escape(def.name)
@@ -66,35 +66,35 @@ function unified_inventory.get_formspec(player, page)
-- Controls to flip items pages
local start_x = 9.2
- formspec = formspec
+ formspec = formspec
.. "image_button[" .. (start_x + 0.6 * 0)
- .. ",9;.8,.8;ui_skip_backward_icon.png;start_list;]"
+ .. ",9;.6,.6;ui_skip_backward_icon.png;start_list;]"
.. "tooltip[start_list;" .. minetest.formspec_escape(S("First page")) .. "]"
.. "image_button[" .. (start_x + 0.6 * 1)
- .. ",9;.8,.8;ui_doubleleft_icon.png;rewind3;]"
+ .. ",9;.6,.6;ui_doubleleft_icon.png;rewind3;]"
.. "tooltip[rewind3;" .. minetest.formspec_escape(S("Back three pages")) .. "]"
.. "image_button[" .. (start_x + 0.6 * 2)
- .. ",9;.8,.8;ui_left_icon.png;rewind1;]"
+ .. ",9;.6,.6;ui_left_icon.png;rewind1;]"
.. "tooltip[rewind1;" .. minetest.formspec_escape(S("Back one page")) .. "]"
.. "image_button[" .. (start_x + 0.6 * 3)
- .. ",9;.8,.8;ui_right_icon.png;forward1;]"
+ .. ",9;.6,.6;ui_right_icon.png;forward1;]"
.. "tooltip[forward1;" .. minetest.formspec_escape(S("Forward one page")) .. "]"
.. "image_button[" .. (start_x + 0.6 * 4)
- .. ",9;.8,.8;ui_doubleright_icon.png;forward3;]"
+ .. ",9;.6,.6;ui_doubleright_icon.png;forward3;]"
.. "tooltip[forward3;" .. minetest.formspec_escape(S("Forward three pages")) .. "]"
.. "image_button[" .. (start_x + 0.6 * 5)
- .. ",9;.8,.8;ui_skip_forward_icon.png;end_list;]"
+ .. ",9;.6,.6;ui_skip_forward_icon.png;end_list;]"
.. "tooltip[end_list;" .. minetest.formspec_escape(S("Last page")) .. "]"
-- Search box
- formspec = formspec .. "field[9.5,8.325;3,1;searchbox;;"
+ formspec = formspec .. "field[9.25,8.1;3,0.75;searchbox;;"
.. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]"
- formspec = formspec .. "image_button[12.2,8.1;.8,.8;ui_search_icon.png;searchbutton;]"
+ formspec = formspec .. "image_button[12.25,8.1;.75,0.75;ui_search_icon.png;searchbutton;]"
.. "tooltip[searchbutton;" ..S("Search") .. "]"
-- Items list
@@ -113,8 +113,8 @@ function unified_inventory.get_formspec(player, page)
local name = unified_inventory.filtered_items_list[player_name][list_index]
if minetest.registered_items[name] then
formspec = formspec.."item_image_button["
- ..(8.2 + x * 0.7)..","
- ..(1 + y * 0.7)..";.81,.81;"
+ ..(8.2 + x * 0.65)..","
+ ..(1 + y * 0.65)..";.66,.66;"
..name..";item_button_"..dir.."_"
..unified_inventory.mangle_for_formspec(name)..";]"
list_index = list_index + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.