Generate item slot images on the fly
|
@ -0,0 +1,11 @@
|
|||
mcl_formspec = {}
|
||||
|
||||
function mcl_formspec.get_itemslot_bg(x, y, w, h)
|
||||
local out = ""
|
||||
for i = 0, w - 1, 1 do
|
||||
for j = 0, h - 1, 1 do
|
||||
out = out .."image["..x+i..","..y+j..";1,1;mcl_formspec_itemslot.png]"
|
||||
end
|
||||
end
|
||||
return out
|
||||
end
|
|
@ -0,0 +1 @@
|
|||
description = Helper mod to simplify creation of formspecs a little bit
|
After Width: | Height: | Size: 231 B |
|
@ -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
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
mcl_init
|
||||
mcl_formspec
|
||||
mcl_player?
|
||||
_mcl_autogroup?
|
||||
mcl_armor?
|
||||
|
|
|
@ -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")).."]"..
|
||||
|
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 861 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
|
@ -1,4 +1,5 @@
|
|||
mcl_init
|
||||
mcl_formspec
|
||||
mesecons
|
||||
mcl_sounds
|
||||
mcl_tnt
|
||||
|
|
|
@ -13,7 +13,6 @@ local S = minetest.get_translator("mcl_dispensers")
|
|||
local setup_dispenser = function(pos)
|
||||
-- Set formspec and inventory
|
||||
local form = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_inventory_9_slots.png]"..
|
||||
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
mcl_init
|
||||
mcl_formspec
|
||||
mesecons
|
||||
mcl_util
|
||||
doc?
|
||||
|
|
|
@ -14,7 +14,6 @@ local S = minetest.get_translator("mcl_droppers")
|
|||
local setup_dropper = function(pos)
|
||||
-- Set formspec and inventory
|
||||
local form = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_inventory_9_slots.png]"..
|
||||
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
mcl_init
|
||||
mcl_formspec
|
||||
mcl_sounds
|
||||
mcl_core?
|
||||
screwdriver?
|
||||
|
|
|
@ -19,10 +19,15 @@ local function get_anvil_formspec(set_name)
|
|||
"background[-0.19,-0.25;9.41,9.49;mcl_anvils_inventory.png]"..
|
||||
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
||||
"list[context;input;1,2.5;1,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(1,2.5,1,1)..
|
||||
"list[context;input;4,2.5;1,1;1]"..
|
||||
mcl_formspec.get_itemslot_bg(4,2.5,1,1)..
|
||||
"list[context;output;8,2.5;1,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(8,2.5,1,1)..
|
||||
"label[3,0.1;"..minetest.formspec_escape(minetest.colorize("#313131", S("Repair and Name"))).."]"..
|
||||
"field[3.25,1;4,1;name;;"..minetest.formspec_escape(set_name).."]"..
|
||||
"field_close_on_enter[name;false]"..
|
||||
|
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 699 B |
|
@ -1,4 +1,5 @@
|
|||
mcl_init
|
||||
mcl_formspec
|
||||
mcl_core
|
||||
mcl_sounds
|
||||
mcl_end
|
||||
|
|
|
@ -183,12 +183,14 @@ minetest.register_node("mcl_chests:"..basename, {
|
|||
minetest.show_formspec(clicker:get_player_name(),
|
||||
"mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
|
||||
"size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,10.48;mcl_chests_inventory_chest.png]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Chest"))).."]"..
|
||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
||||
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
||||
"listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main]"..
|
||||
"listring[current_player;main]")
|
||||
|
||||
|
@ -317,13 +319,16 @@ minetest.register_node("mcl_chests:"..basename.."_left", {
|
|||
minetest.show_formspec(clicker:get_player_name(),
|
||||
"mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
|
||||
"size[9,11.5]"..
|
||||
"background[-0.19,-0.25;9.41,12.5;mcl_chests_inventory_chest_large.png]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Large Chest"))).."]"..
|
||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
||||
"list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,3.5;9,3;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,3.5,9,3)..
|
||||
"label[0,7;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,7.5;9,3;9]"..
|
||||
mcl_formspec.get_itemslot_bg(0,7.5,9,3)..
|
||||
"list[current_player;main;0,10.75;9,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,10.75,9,1)..
|
||||
-- BEGIN OF LISTRING WORKAROUND
|
||||
"listring[current_player;main]"..
|
||||
"listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";input]"..
|
||||
|
@ -452,13 +457,16 @@ minetest.register_node("mcl_chests:"..basename.."_right", {
|
|||
"mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
|
||||
|
||||
"size[9,11.5]"..
|
||||
"background[-0.19,-0.25;9.41,12.5;mcl_chests_inventory_chest_large.png]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Large Chest"))).."]"..
|
||||
"list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,0.5;9,3;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,3.5;9,3;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,3.5,9,3)..
|
||||
"label[0,7;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,7.5;9,3;9]"..
|
||||
mcl_formspec.get_itemslot_bg(0,7.5,9,3)..
|
||||
"list[current_player;main;0,10.75;9,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,10.75,9,1)..
|
||||
-- BEGIN OF LISTRING WORKAROUND
|
||||
"listring[current_player;main]"..
|
||||
"listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";input]"..
|
||||
|
@ -662,12 +670,14 @@ minetest.register_node("mcl_chests:ender_chest", {
|
|||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec",
|
||||
"size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,10.48;mcl_chests_inventory_chest.png]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Ender Chest"))).."]"..
|
||||
"list[current_player;enderchest;0,0.5;9,3;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
||||
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
||||
"listring[current_player;enderchest]"..
|
||||
"listring[current_player;main]")
|
||||
end,
|
||||
|
@ -783,12 +793,14 @@ for color, desc in pairs(boxtypes) do
|
|||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec",
|
||||
"size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,10.48;mcl_chests_inventory_chest.png]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Shulker Box"))).."]"..
|
||||
"list[current_name;main;0,0.5;9,3;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
||||
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
||||
"listring[current_name;main]"..
|
||||
"listring[current_player;main]")
|
||||
local inv = meta:get_inventory()
|
||||
|
|
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB |
|
@ -1,2 +1,3 @@
|
|||
mcl_init
|
||||
mcl_formspec
|
||||
mcl_sounds
|
||||
|
|
|
@ -16,13 +16,17 @@ minetest.register_node("mcl_crafting_table:crafting_table", {
|
|||
player:get_inventory():set_size("craft", 9)
|
||||
|
||||
local form = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg2.png^crafting_inventory_workbench.png]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_inventory_workbench.png]"..
|
||||
"label[0,4;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
||||
"label[1.75,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Crafting"))).."]"..
|
||||
"list[current_player;craft;1.75,0.5;3,3;]"..
|
||||
mcl_formspec.get_itemslot_bg(1.75,0.5,3,3)..
|
||||
"list[current_player;craftpreview;6.1,1.5;1,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(6.1,1.5,1,1)..
|
||||
"image_button[0.75,1.5;1,1;craftguide_book.png;__mcl_craftguide;]"..
|
||||
"tooltip[__mcl_craftguide;"..minetest.formspec_escape(S("Recipe book")).."]"..
|
||||
"listring[current_player;main]"..
|
||||
|
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 281 B |
|
@ -1,4 +1,5 @@
|
|||
mcl_init
|
||||
mcl_formspec
|
||||
mcl_core
|
||||
mcl_sounds
|
||||
mcl_craftguide
|
||||
|
|
|
@ -7,14 +7,18 @@ local S = minetest.get_translator("mcl_furnaces")
|
|||
|
||||
local function active_formspec(fuel_percent, item_percent)
|
||||
return "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_inventory_furnace.png]"..
|
||||
"label[0,4;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
||||
"label[2.75,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Furnace"))).."]"..
|
||||
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(2.75,0.5,1,1)..
|
||||
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(2.75,2.5,1,1)..
|
||||
"list[current_name;dst;5.75,1.5;1,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(5.75,2.5,1,1)..
|
||||
"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||
(100-fuel_percent)..":default_furnace_fire_fg.png]"..
|
||||
"image[4.1,1.5;1.5,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
||||
|
@ -30,14 +34,18 @@ local function active_formspec(fuel_percent, item_percent)
|
|||
end
|
||||
|
||||
local inactive_formspec = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_inventory_furnace.png]"..
|
||||
"label[0,4;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
||||
"label[2.75,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Furnace"))).."]"..
|
||||
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(2.75,0.5,1,1)..
|
||||
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(2.75,2.5,1,1)..
|
||||
"list[current_name;dst;5.75,1.5;1,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(5.75,1.5,1,1)..
|
||||
"image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..
|
||||
"image[4.1,1.5;1.5,1;gui_furnace_arrow_bg.png^[transformR270]"..
|
||||
"image_button[8,0;1,1;craftguide_book.png;craftguide;]"..
|
||||
|
|
Before Width: | Height: | Size: 1.1 KiB |
|
@ -1,4 +1,5 @@
|
|||
mcl_core
|
||||
mcl_formspec
|
||||
mcl_sounds
|
||||
mcl_util
|
||||
doc?
|
||||
|
|
|
@ -4,12 +4,14 @@ local S = minetest.get_translator("mcl_hoppers")
|
|||
|
||||
local mcl_hoppers_formspec =
|
||||
"size[9,7]"..
|
||||
"background[-0.19,-0.25;9.41,10.48;mcl_hoppers_inventory.png]"..
|
||||
"label[2,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Hopper"))).."]"..
|
||||
"list[current_name;main;2,0.5;5,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(2,0.5,5,1)..
|
||||
"label[0,2;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,2.5;9,3;9]"..
|
||||
mcl_formspec.get_itemslot_bg(0,2.5,9,3)..
|
||||
"list[current_player;main;0,5.74;9,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,5.74,9,1)..
|
||||
"listring[current_name;main]"..
|
||||
"listring[current_player;main]"
|
||||
|
||||
|
|
Before Width: | Height: | Size: 992 B |