Draw the trash slot by overlaying the bare trash can icon

over the single slot image instead of baking it in.
This commit is contained in:
Vanessa Dannenberg 2021-03-08 09:53:25 -05:00
parent 8e94d86420
commit 60d7a6d213
5 changed files with 7 additions and 5 deletions

@ -74,9 +74,9 @@ for bag_i = 1, 4 do
if ui.trash_enabled if ui.trash_enabled
or ui.is_creative(player_name) or ui.is_creative(player_name)
or minetest.get_player_privs(player_name).give then or minetest.get_player_privs(player_name).give then
formspec[n] = "image[7.8,0.25;"..ui.imgscale..","..ui.imgscale..";ui_trash_slot.png]" formspec[n] = "image[7.8,0.25;"..ui.trash_slot_img.."]"
.. "list[detached:trash;main;7.95,0.25;1,1;]" formspec[n+1] = "list[detached:trash;main;7.95,0.25;1,1;]"
n = n + 1 n = n + 2
end end
local inv = player:get_inventory() local inv = player:get_inventory()
for i = 1, 4 do for i = 1, 4 do

@ -102,6 +102,9 @@ for _, style in ipairs({ui.style_full, ui.style_lite}) do
ui.imgscale*8, ui.imgscale*4) ui.imgscale*8, ui.imgscale*4)
end end
ui.trash_slot_img = string.format("%f,%f;ui_single_slot.png^(ui_trash_slot_icon.png^[opacity:95)",
ui.imgscale, ui.imgscale)
-- Disable default creative inventory -- Disable default creative inventory
local creative = rawget(_G, "creative") or rawget(_G, "creative_inventory") local creative = rawget(_G, "creative") or rawget(_G, "creative_inventory")
if creative then if creative then

@ -187,8 +187,7 @@ ui.register_page("craft", {
if ui.trash_enabled or ui.is_creative(player_name) or minetest.get_player_privs(player_name).give then if ui.trash_enabled or ui.is_creative(player_name) or minetest.get_player_privs(player_name).give then
formspec[n] = string.format("label[%f,%f;%s]", craftx + 6.45, crafty + 2.4, F(S("Trash:"))) formspec[n] = string.format("label[%f,%f;%s]", craftx + 6.45, crafty + 2.4, F(S("Trash:")))
formspec[n+1] = string.format("image[%f,%f;%f,%f;ui_trash_slot.png]", formspec[n+1] = string.format("image[%f,%f;%s]", craftx+6.25, crafty + 2.5, ui.trash_slot_img)
craftx+6.25, crafty + 2.5, ui.imgscale, ui.imgscale)
formspec[n+2] = string.format("list[detached:trash;main;%f,%f;1,1;]", craftx + 6.4, crafty + 2.65) formspec[n+2] = string.format("list[detached:trash;main;%f,%f;1,1;]", craftx + 6.4, crafty + 2.65)
n=n+3 n=n+3
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B