Something with UI's images got borked.

Also, using custom image_button background images is not necessary.
This commit is contained in:
Vanessa Dannenberg 2021-02-25 14:10:23 -05:00
parent c8489300be
commit bbb7a2d8cd
22 changed files with 36 additions and 30 deletions

View File

@ -20,9 +20,9 @@ minetest.register_on_joinplayer(function(player)
listcolors[#FFFFFF30;#B0B0B0;#606060;#A0A0A0;#FFF]
style_type[button;bgcolor=#B0B0B0FF]
style_type[button_exit;bgcolor=#B0B0B0FF]
style_type[image_button;bgcolor=#B0B0B0FF]
style_type[image_button_exit;bgcolor=#B0B0B0FF]
style_type[item_image_button;bgcolor=#B0B0B0FF]
style_type[image_button;bgcolor=#B0B0B0FF;border=false]
style_type[image_button_exit;bgcolor=#B0B0B0FF;border=false]
style_type[item_image_button;bgcolor=#B0B0B0FF;border=false]
style_type[scrollbar;bgimg=#808080FF;fgimg=#606060FF;border=true]
]]
local name = player:get_player_name()

View File

@ -248,9 +248,9 @@ sed -i 's/"field\[.*")/ \
sed -i "s/listcolors\[.*\]/listcolors[#FFFFFF30;#B0B0B0;#606060;#A0A0A0;#FFF] \
\n\t\t\tstyle_type[button;bgcolor="$btn_color"] \
\n\t\t\tstyle_type[button_exit;bgcolor="$btn_color"] \
\n\t\t\tstyle_type[image_button;bgcolor="$btn_color"] \
\n\t\t\tstyle_type[image_button_exit;bgcolor="$btn_color"] \
\n\t\t\tstyle_type[item_image_button;bgcolor="$btn_color"] \
\n\t\t\tstyle_type[image_button;bgcolor="$btn_color";border=false] \
\n\t\t\tstyle_type[image_button_exit;bgcolor="$btn_color";border=false] \
\n\t\t\tstyle_type[item_image_button;bgcolor="$btn_color";border=false] \
\n\t\t\tstyle_type[scrollbar;bgimg="$scrollbar_color";fgimg="$scrollbar_handle_color";border=true] \
\n\t ]]/" \
$workdir"/mods/default/init.lua"
@ -260,7 +260,7 @@ sed -i 's/"style_type\[.*\]"/"style_type[label,textarea;font=mono]" \
\t\t.."bgcolor['"$form_bgcolor"';false]"/' \
$workdir"/mods/mesecons_luacontroller/init.lua"
sed -i 's/local n = 4/formspec[4]="style_type[image_button;bgimg=standard_image_button.png;bgimg_hovered=standard_image_button_brighter.png]" \
sed -i 's/local n = 4/formspec[4]="style_type[image_button;bgcolor='"$btn_color"']" \
\tlocal n = 5/' \
$workdir"/mods/unified_inventory/internal.lua"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -7,22 +7,24 @@ License: GPLv3
local S = minetest.get_translator("unified_inventory")
local F = minetest.formspec_escape
local bags_inv_bg_prefix = "image[-0.1,1.0;10.05,"
unified_inventory.register_page("bags", {
get_formspec = function(player)
local player_name = player:get_player_name()
return { formspec = table.concat({
"background[0.06,0.99;7.92,7.52;ui_bags_main_form.png]",
string.gsub(unified_inventory.standard_inv_bg, "YYY", "4.4"),
bags_inv_bg_prefix.."1.175;ui_bags_header.png]",
"label[0,0;" .. F(S("Bags")) .. "]",
"button[0,2;2,0.5;bag1;" .. F(S("Bag @1", 1)) .. "]",
"button[2,2;2,0.5;bag2;" .. F(S("Bag @1", 2)) .. "]",
"button[4,2;2,0.5;bag3;" .. F(S("Bag @1", 3)) .. "]",
"button[6,2;2,0.5;bag4;" .. F(S("Bag @1", 4)) .. "]",
"button[0,2.2;2,0.5;bag1;" .. F(S("Bag @1", 1)) .. "]",
"button[2,2.2;2,0.5;bag2;" .. F(S("Bag @1", 2)) .. "]",
"button[4,2.2;2,0.5;bag3;" .. F(S("Bag @1", 3)) .. "]",
"button[6,2.2;2,0.5;bag4;" .. F(S("Bag @1", 4)) .. "]",
"listcolors[#00000000;#00000000]",
"list[detached:" .. F(player_name) .. "_bags;bag1;0.5,1;1,1;]",
"list[detached:" .. F(player_name) .. "_bags;bag2;2.5,1;1,1;]",
"list[detached:" .. F(player_name) .. "_bags;bag3;4.5,1;1,1;]",
"list[detached:" .. F(player_name) .. "_bags;bag4;6.5,1;1,1;]"
"list[detached:" .. F(player_name) .. "_bags;bag1;0.5,1.1;1,1;]",
"list[detached:" .. F(player_name) .. "_bags;bag2;2.5,1.1;1,1;]",
"list[detached:" .. F(player_name) .. "_bags;bag3;4.5,1.1;1,1;]",
"list[detached:" .. F(player_name) .. "_bags;bag4;6.5,1.1;1,1;]"
}) }
end,
})
@ -47,26 +49,27 @@ for bag_i = 1, 4 do
local stack = get_player_bag_stack(player, bag_i)
local image = stack:get_definition().inventory_image
local fs = {
string.gsub(unified_inventory.standard_inv_bg, "YYY", "4.4"),
"image[7,0;1,1;" .. image .. "]",
"label[0,0;" .. F(S("Bag @1", bag_i)) .. "]",
"listcolors[#00000000;#00000000]",
"list[current_player;bag" .. bag_i .. "contents;0,1;8,3;]",
"list[current_player;bag" .. bag_i .. "contents;0,1.1;8,3;]",
"listring[current_name;bag" .. bag_i .. "contents]",
"listring[current_player;main]"
"listring[current_player;main]",
}
local slots = stack:get_definition().groups.bagslots
if slots == 8 then
fs[#fs + 1] = "background[0.06,0.99;7.92,7.52;ui_bags_sm_form.png]"
fs[#fs + 1] = bags_inv_bg_prefix.."1.175;ui_bags_inv_small.png]"
elseif slots == 16 then
fs[#fs + 1] = "background[0.06,0.99;7.92,7.52;ui_bags_med_form.png]"
fs[#fs + 1] = bags_inv_bg_prefix.."2.35;ui_bags_inv_medium.png]"
elseif slots == 24 then
fs[#fs + 1] = "background[0.06,0.99;7.92,7.52;ui_bags_lg_form.png]"
fs[#fs + 1] = bags_inv_bg_prefix.."3.525;ui_bags_inv_large.png]"
end
local player_name = player:get_player_name() -- For if statement.
if unified_inventory.trash_enabled
or unified_inventory.is_creative(player_name)
or minetest.get_player_privs(player_name).give then
fs[#fs + 1] = "background[6.06,0;0.92,0.92;ui_bags_trash.png]"
fs[#fs + 1] = "image[5.91,-0.06;1.21,1.15;ui_bags_trash.png]"
.. "list[detached:trash;main;6,0.1;1,1;]"
end
local inv = player:get_inventory()

View File

@ -44,7 +44,10 @@ unified_inventory = {
main_button_y = 9,
craft_result_x = 0.3,
craft_result_y = 0.5,
form_header_y = 0
form_header_y = 0,
standard_background = "background[-0.2,-0.2;1,1;ui_form_bg.png;true]", -- the 'true' scales to fill, overrides the 1,1
standard_inv = "list[current_player;main;0,YYY;8,4;]", -- the YYY's are placeholders which get
standard_inv_bg = "image[-0.1,YYY;10.05,4.70;ui_main_inventory.png]", -- replaced later by string.gsub()
}
-- Disable default creative inventory

View File

@ -65,14 +65,14 @@ function unified_inventory.get_formspec(player, page)
local formspec = {
"size[14,10]",
pagedef.formspec_prepend and "" or "no_prepend[]",
"background[-0.19,-0.25;14.4,10.75;ui_form_bg.png]" -- Background
unified_inventory.standard_background -- Background
}
formspec[4]="style_type[image_button;bgimg=standard_image_button.png;bgimg_hovered=standard_image_button_brighter.png]"
formspec[4]="style_type[image_button;bgcolor=#B0B0B0FF]"
local n = 5
if draw_lite_mode then
formspec[1] = "size[11,7.7]"
formspec[3] = "background[-0.19,-0.2;11.4,8.4;ui_form_bg.png]"
formspec[3] = unified_inventory.standard_background
end
if unified_inventory.is_creative(player_name)
@ -131,7 +131,7 @@ function unified_inventory.get_formspec(player, page)
if fsdata.draw_inventory ~= false then
-- Player inventory
formspec[n] = "listcolors[#00000000;#00000000]"
formspec[n+1] = "list[current_player;main;0,"..(ui_peruser.formspec_y + 3.5)..";8,4;]"
formspec[n+1] = string.gsub(unified_inventory.standard_inv, "YYY", ui_peruser.formspec_y + 3.5)
n = n+2
end

View File

@ -171,7 +171,7 @@ unified_inventory.register_page("craft", {
local player_name = player:get_player_name()
local formspec = "background[2,"..formspecy..";6,3;ui_crafting_form.png]"
formspec = formspec.."background[0,"..(formspecy + 3.5)..";8,4;ui_main_inventory.png]"
formspec = formspec..string.gsub(unified_inventory.standard_inv_bg, "YYY", (formspecy + 3.4))
formspec = formspec.."label[0,"..formheadery..";" ..F(S("Crafting")).."]"
formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;craftpreview;6,"..formspecy..";1,1;]"
@ -268,7 +268,7 @@ unified_inventory.register_page("craftguide", {
local player_name = player:get_player_name()
local player_privs = minetest.get_player_privs(player_name)
local fs = {
"background[0,"..(formspecy + 3.5)..";8,4;ui_main_inventory.png]",
string.gsub(unified_inventory.standard_inv_bg, "YYY", (formspecy + 3.4)),
"label[0,"..formheadery..";" .. F(S("Crafting Guide")) .. "]",
"listcolors[#00000000;#00000000]"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1003 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -23,7 +23,7 @@ unified_inventory.register_page("waypoints", {
if not waypoints_temp[player_name] then waypoints_temp[player_name] = {hud = 1} end
local waypoints = datastorage.get(player_name, "waypoints")
local formspec = "background[0,4.5;8,4;ui_main_inventory.png]" ..
local formspec = string.gsub(unified_inventory.standard_inv_bg, "YYY", "4.4") ..
"image[0,0;1,1;ui_waypoints_icon.png]" ..
"label[1,0;" .. F(S("Waypoints")) .. "]"