Added Formspec Image to Smithing Table and Fixed some whitespace issues.

This commit is contained in:
PrairieAstronomer 2022-06-29 09:12:14 -06:00 committed by cora
parent 6543d819da
commit 074f1df354

View File

@ -37,22 +37,23 @@ end
-- ToDo: Make better formspec -- ToDo: Make better formspec
local formspec = "size[9,9]" .. local formspec = "size[9,9]" ..
"label[0,4.0;" .. minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))) .. "]" .. "background[-0.19,-0.25;9.41,9.49;mcl_smithing_table_inventory.png]"..
"list[current_player;main;0,4.5;9,3;9]" .. "label[0,4.0;" .. minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))) .. "]" ..
mcl_formspec.get_itemslot_bg(0,4.5,9,3) .. "list[current_player;main;0,4.5;9,3;9]" ..
"list[current_player;main;0,7.74;9,1;]" .. mcl_formspec.get_itemslot_bg(0,4.5,9,3) ..
mcl_formspec.get_itemslot_bg(0,7.74,9,1) .. "list[current_player;main;0,7.74;9,1;]" ..
"list[context;diamond_item;1,2.5;1,1;]" .. mcl_formspec.get_itemslot_bg(0,7.74,9,1) ..
mcl_formspec.get_itemslot_bg(1,2.5,1,1) .. "list[context;diamond_item;1,2.5;1,1;]" ..
"list[context;netherite;4,2.5;1,1;]" .. mcl_formspec.get_itemslot_bg(1,2.5,1,1) ..
mcl_formspec.get_itemslot_bg(4,2.5,1,1) .. "list[context;netherite;4,2.5;1,1;]" ..
"list[context;upgraded_item;8,2.5;1,1;]" .. mcl_formspec.get_itemslot_bg(4,2.5,1,1) ..
mcl_formspec.get_itemslot_bg(8,2.5,1,1) .. "list[context;upgraded_item;8,2.5;1,1;]" ..
"label[3,0.1;" .. minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Upgrade Gear"))) .. "]" .. mcl_formspec.get_itemslot_bg(8,2.5,1,1) ..
"listring[context;output]".. "label[3,0.1;" .. minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Upgrade Gear"))) .. "]" ..
"listring[current_player;main]".. "listring[context;output]"..
"listring[context;input]".. "listring[current_player;main]"..
"listring[current_player;main]" "listring[context;input]"..
"listring[current_player;main]"
local function reset_upgraded_item(pos) local function reset_upgraded_item(pos)
local inv = minetest.get_meta(pos):get_inventory() local inv = minetest.get_meta(pos):get_inventory()
@ -80,15 +81,15 @@ minetest.register_node("mcl_smithing_table:table", {
sounds = mcl_sounds.node_sound_metal_defaults(), sounds = mcl_sounds.node_sound_metal_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("diamond_item", 1) inv:set_size("diamond_item", 1)
inv:set_size("netherite", 1) inv:set_size("netherite", 1)
inv:set_size("upgraded_item", 1) inv:set_size("upgraded_item", 1)
end, end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player) allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if listname == "diamond_item" and mcl_smithing_table.upgrade_item(stack) or listname == "netherite" and stack:get_name() == "mcl_nether:netherite_ingot" then if listname == "diamond_item" and mcl_smithing_table.upgrade_item(stack) or listname == "netherite" and stack:get_name() == "mcl_nether:netherite_ingot" then