Generate item slot images on the fly

This commit is contained in:
Wuzzy 2020-03-24 18:48:14 +01:00
parent 3cf32c38c5
commit 7243a25fe6
31 changed files with 76 additions and 11 deletions

View file

@ -325,11 +325,16 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
-- Survival inventory slots
main_list = "list[current_player;main;0,3.75;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,3.75,9,3)..
-- armor
"list[detached:"..playername.."_armor;armor;2.5,1.3;1,1;1]"..
"list[detached:"..playername.."_armor;armor;2.5,2.75;1,1;2]"..
"list[detached:"..playername.."_armor;armor;5.5,1.3;1,1;3]"..
"list[detached:"..playername.."_armor;armor;5.5,2.75;1,1;4]"..
mcl_formspec.get_itemslot_bg(2.5,1.3,1,1)..
mcl_formspec.get_itemslot_bg(2.5,2.75,1,1)..
mcl_formspec.get_itemslot_bg(5.5,1.3,1,1)..
mcl_formspec.get_itemslot_bg(5.5,2.75,1,1)..
armor_slot_imgs..
-- player preview
player_preview..
@ -354,6 +359,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
else
-- Creative inventory slots
main_list = "list[detached:creative_"..playername..";main;0,1.75;9,5;"..tostring(start_i).."]"..
mcl_formspec.get_itemslot_bg(0,1.75,9,5)..
-- Page buttons
"label[9.0,5.5;"..F(S("@1/@2", pagenum, pagemax)).."]"..
"image_button[9.0,6.0;0.7,0.7;crafting_creative_prev.png;creative_prev;]"..
@ -412,6 +418,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
"tooltip[nix;"..F(filtername["nix"]).."]"..
caption..
"list[current_player;main;0,7;9,1;]"..
mcl_formspec.get_itemslot_bg(0,7,9,1)..
main_list..
tab(name, "food") ..
"tooltip[food;"..F(filtername["food"]).."]"..
@ -429,6 +436,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
tab(name, "inv") ..
"tooltip[inv;"..F(filtername["inv"]).."]"..
"list[detached:trash;main;9,7;1,1;]"..
mcl_formspec.get_itemslot_bg(9,7,1,1)..
"image[9,7;1,1;crafting_creative_trash.png]"..
listrings

View file

@ -1,4 +1,5 @@
mcl_init
mcl_formspec
mcl_player?
_mcl_autogroup?
mcl_armor?

View file

@ -96,6 +96,10 @@ local function set_inventory(player, armor_change_only)
"list[detached:"..player_name.."_armor;armor;0,1;1,1;2]"..
"list[detached:"..player_name.."_armor;armor;0,2;1,1;3]"..
"list[detached:"..player_name.."_armor;armor;0,3;1,1;4]"..
mcl_formspec.get_itemslot_bg(0,0,1,1)..
mcl_formspec.get_itemslot_bg(0,1,1,1)..
mcl_formspec.get_itemslot_bg(0,2,1,1)..
mcl_formspec.get_itemslot_bg(0,3,1,1)..
armor_slot_imgs..
-- craft and inventory
"label[0,4;"..F(minetest.colorize("#313131", S("Inventory"))).."]"..
@ -104,6 +108,10 @@ local function set_inventory(player, armor_change_only)
"label[4,0.5;"..F(minetest.colorize("#313131", S("Crafting"))).."]"..
"list[current_player;craft;4,1;2,2]"..
"list[current_player;craftpreview;7,1.5;1,1;]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
mcl_formspec.get_itemslot_bg(4,1,2,2)..
mcl_formspec.get_itemslot_bg(7,1.5,1,1)..
-- crafting guide button
"image_button[4.5,3;1,1;craftguide_book.png;__mcl_craftguide;]"..
"tooltip[__mcl_craftguide;"..F(S("Recipe book")).."]"..

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before After
Before After