1
0
Fork 0

Utilize formspec prepend

This commit is contained in:
Wuzzy 2019-03-06 06:35:24 +01:00
parent 98b3003e07
commit ea0c2e9568
21 changed files with 9 additions and 31 deletions

View File

@ -0,0 +1,6 @@
minetest.register_on_joinplayer(function(player)
local bg = ""--"bgcolor[#080808BB;true]"
local slots = "listcolors[#9990;#FFF7;#FFF0;#000;#FFF]"
local prepend = bg .. slots
-- player:set_formspec_prepend(prepend)
end)

View File

@ -0,0 +1,2 @@
name = mcl_formspec_prepend
description = Set formspec prepend string for all players

View File

@ -1,13 +1,6 @@
-- Some global variables (don't overwrite them!) -- Some global variables (don't overwrite them!)
mcl_vars = {} mcl_vars = {}
--- GUI / inventory menu colors
mcl_vars.gui_slots = "listcolors[#9990;#FFF7;#FFF0;#000;#FFF]"
mcl_vars.gui_bg = "bgcolor[#080808BB;true]"
mcl_vars.gui_bg_img = ""
mcl_vars.inventory_header = mcl_vars.gui_slots .. mcl_vars.gui_bg
-- Mapgen variables -- Mapgen variables
local mg_name = minetest.get_mapgen_setting("mg_name") local mg_name = minetest.get_mapgen_setting("mg_name")
local minecraft_height_limit = 256 local minecraft_height_limit = 256

View File

@ -491,7 +491,6 @@ local function show_trade_formspec(playername, trader, tradenum)
"size[9,8.75]" "size[9,8.75]"
.."background[-0.19,-0.25;9.41,9.49;mobs_mc_trading_formspec_bg.png]" .."background[-0.19,-0.25;9.41,9.49;mobs_mc_trading_formspec_bg.png]"
..disabled_img ..disabled_img
..mcl_vars.inventory_header
.."label[4,0;"..minetest.formspec_escape(profession).."]" .."label[4,0;"..minetest.formspec_escape(profession).."]"
.."list[current_player;main;0,4.5;9,3;9]" .."list[current_player;main;0,4.5;9,3;9]"
.."list[current_player;main;0,7.74;9,1;]" .."list[current_player;main;0,7.74;9,1;]"

View File

@ -315,8 +315,6 @@ function craftguide:get_formspec(player_name, is_fuel)
data.pagemax = max(1, ceil(#data.items / ipp)) data.pagemax = max(1, ceil(#data.items / ipp))
local formspec = "size["..data.iX..","..(iY+3)..".6;]".. local formspec = "size["..data.iX..","..(iY+3)..".6;]"..
mcl_vars.gui_slots ..
mcl_vars.gui_bg ..
[=[background[1,1;1,1;craftguide_bg.png;true] [=[background[1,1;1,1;craftguide_bg.png;true]
button[2.4,0.21;0.8,0.5;search;?] button[2.4,0.21;0.8,0.5;search;?]
button[3.05,0.21;0.8,0.5;clear;X] button[3.05,0.21;0.8,0.5;clear;X]

View File

@ -378,7 +378,6 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
end end
formspec = "size[10,9.3]".. formspec = "size[10,9.3]"..
mcl_vars.inventory_header..
"background[-0.19,-0.25;10.5,9.87;"..inv_bg.."]".. "background[-0.19,-0.25;10.5,9.87;"..inv_bg.."]"..
"label[-5,-5;"..name.."]".. "label[-5,-5;"..name.."]"..
tab(name, "blocks") .. tab(name, "blocks") ..

View File

@ -86,7 +86,6 @@ local function set_inventory(player, armor_change_only)
local form = "size[9,8.75]".. local form = "size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]".. "background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]"..
mcl_vars.inventory_header..
player_preview.. player_preview..
--armor --armor
"list[detached:"..player_name.."_armor;armor;0,0;1,1;1]".. "list[detached:"..player_name.."_armor;armor;0,0;1,1;1]"..

View File

@ -1,4 +1,3 @@
mcl_init
mesecons mesecons
mcl_sounds mcl_sounds
mcl_tnt mcl_tnt

View File

@ -13,7 +13,6 @@ local setup_dispenser = function(pos)
-- Set formspec and inventory -- Set formspec and inventory
local form = "size[9,8.75]".. local form = "size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;crafting_inventory_9_slots.png]".. "background[-0.19,-0.25;9.41,9.49;crafting_inventory_9_slots.png]"..
mcl_vars.inventory_header..
"image[3,-0.2;5,0.75;mcl_dispensers_fnt_dispenser.png]".. "image[3,-0.2;5,0.75;mcl_dispensers_fnt_dispenser.png]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..

View File

@ -1,4 +1,3 @@
mcl_init
mesecons mesecons
mcl_util mcl_util
doc? doc?

View File

@ -13,7 +13,6 @@ local setup_dropper = function(pos)
-- Set formspec and inventory -- Set formspec and inventory
local form = "size[9,8.75]".. local form = "size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;crafting_inventory_9_slots.png]".. "background[-0.19,-0.25;9.41,9.49;crafting_inventory_9_slots.png]"..
mcl_vars.inventory_header..
"image[3,-0.2;5,0.75;mcl_droppers_fnt_dropper.png]".. "image[3,-0.2;5,0.75;mcl_droppers_fnt_dropper.png]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..

View File

@ -1,4 +1,3 @@
mcl_init
mcl_sounds mcl_sounds
mcl_core? mcl_core?
screwdriver? screwdriver?

View File

@ -15,7 +15,6 @@ local function get_anvil_formspec(set_name)
end end
return "size[9,8.75]".. return "size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;mcl_anvils_inventory.png]".. "background[-0.19,-0.25;9.41,9.49;mcl_anvils_inventory.png]"..
mcl_vars.inventory_header..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
"list[context;input;1,2.5;1,1;]".. "list[context;input;1,2.5;1,1;]"..

View File

@ -196,7 +196,7 @@ end
local function update_formspecs(finished) local function update_formspecs(finished)
local ges = #minetest.get_connected_players() local ges = #minetest.get_connected_players()
local form_n = "size[8,15;true]" local form_n = "size[8,15;true]no_prepend[]"
local all_in_bed = ges == player_in_bed local all_in_bed = ges == player_in_bed
local night_skip = is_night_skip_enabled() local night_skip = is_night_skip_enabled()
local button_leave = "button_exit[2,12;4,0.75;leave;Leave bed]" local button_leave = "button_exit[2,12;4,0.75;leave;Leave bed]"

View File

@ -1,4 +1,3 @@
mcl_init
mcl_core mcl_core
mcl_sounds mcl_sounds
mcl_end mcl_end

View File

@ -170,7 +170,6 @@ minetest.register_node("mcl_chests:"..basename, {
minetest.show_formspec(clicker:get_player_name(), minetest.show_formspec(clicker:get_player_name(),
"mcl_chests:"..formspec_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z, "mcl_chests:"..formspec_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
"size[9,8.75]".. "size[9,8.75]"..
mcl_vars.inventory_header..
"background[-0.19,-0.25;9.41,10.48;mcl_chests_inventory_chest.png]".. "background[-0.19,-0.25;9.41,10.48;mcl_chests_inventory_chest.png]"..
"image[0,-0.2;5,0.75;mcl_chests_fnt_chest.png]".. "image[0,-0.2;5,0.75;mcl_chests_fnt_chest.png]"..
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]".. "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]"..
@ -293,7 +292,6 @@ minetest.register_node("mcl_chests:"..basename.."_left", {
"mcl_chests:"..formspec_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z, "mcl_chests:"..formspec_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
"size[9,11.5]".. "size[9,11.5]"..
"background[-0.19,-0.25;9.41,12.5;mcl_chests_inventory_chest_large.png]".. "background[-0.19,-0.25;9.41,12.5;mcl_chests_inventory_chest_large.png]"..
mcl_vars.inventory_header..
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]".. "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]"..
"list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,3.5;9,3;]".. "list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,3.5;9,3;]"..
"list[current_player;main;0,7.5;9,3;9]".. "list[current_player;main;0,7.5;9,3;9]"..
@ -415,7 +413,6 @@ minetest.register_node("mcl_chests:"..basename.."_right", {
"size[9,11.5]".. "size[9,11.5]"..
"background[-0.19,-0.25;9.41,12.5;mcl_chests_inventory_chest_large.png]".. "background[-0.19,-0.25;9.41,12.5;mcl_chests_inventory_chest_large.png]"..
mcl_vars.inventory_header..
"list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,0.5;9,3;]".. "list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,0.5;9,3;]"..
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,3.5;9,3;]".. "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,3.5;9,3;]"..
"list[current_player;main;0,7.5;9,3;9]".. "list[current_player;main;0,7.5;9,3;9]"..
@ -618,7 +615,6 @@ minetest.register_node("mcl_chests:ender_chest", {
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("formspec", meta:set_string("formspec",
"size[9,8.75]".. "size[9,8.75]"..
mcl_vars.inventory_header..
"background[-0.19,-0.25;9.41,10.48;mcl_chests_inventory_chest.png]".. "background[-0.19,-0.25;9.41,10.48;mcl_chests_inventory_chest.png]"..
"image[0,-0.2;5,0.75;mcl_chests_fnt_ender_chest.png]".. "image[0,-0.2;5,0.75;mcl_chests_fnt_ender_chest.png]"..
"list[current_player;enderchest;0,0.5;9,3;]".. "list[current_player;enderchest;0,0.5;9,3;]"..
@ -713,7 +709,6 @@ for color, desc in pairs(boxtypes) do
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("formspec", meta:set_string("formspec",
"size[9,8.75]".. "size[9,8.75]"..
mcl_vars.inventory_header..
"background[-0.19,-0.25;9.41,10.48;mcl_chests_inventory_chest.png]".. "background[-0.19,-0.25;9.41,10.48;mcl_chests_inventory_chest.png]"..
"image[0,-0.2;5,0.75;mcl_chests_fnt_shulker_box.png]".. "image[0,-0.2;5,0.75;mcl_chests_fnt_shulker_box.png]"..
"list[current_name;main;0,0.5;9,3;]".. "list[current_name;main;0,0.5;9,3;]"..

View File

@ -1,2 +1 @@
mcl_init
mcl_sounds mcl_sounds

View File

@ -14,7 +14,6 @@ minetest.register_node("mcl_crafting_table:crafting_table", {
local form = "size[9,8.75]".. local form = "size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_workbench.png]".. "background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_workbench.png]"..
mcl_vars.inventory_header..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
"list[current_player;craft;1.75,0.5;3,3;]".. "list[current_player;craft;1.75,0.5;3,3;]"..

View File

@ -1,4 +1,3 @@
mcl_init
mcl_core mcl_core
mcl_sounds mcl_sounds
mcl_craftguide mcl_craftguide

View File

@ -6,7 +6,6 @@
local function active_formspec(fuel_percent, item_percent) local function active_formspec(fuel_percent, item_percent)
return "size[9,8.75]".. return "size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;crafting_inventory_furnace.png]".. "background[-0.19,-0.25;9.41,9.49;crafting_inventory_furnace.png]"..
mcl_vars.inventory_header..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
"list[current_name;src;2.75,0.5;1,1;]".. "list[current_name;src;2.75,0.5;1,1;]"..
@ -29,7 +28,6 @@ end
local inactive_formspec = "size[9,8.75]".. local inactive_formspec = "size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;crafting_inventory_furnace.png]".. "background[-0.19,-0.25;9.41,9.49;crafting_inventory_furnace.png]"..
mcl_vars.inventory_header..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
"list[current_name;src;2.75,0.5;1,1;]".. "list[current_name;src;2.75,0.5;1,1;]"..

View File

@ -6,7 +6,6 @@ local chest = minetest.get_content_id("mcl_chests:chest")
local mcl_hoppers_formspec = local mcl_hoppers_formspec =
"size[9,7]".. "size[9,7]"..
"background[-0.19,-0.25;9.41,10.48;mcl_hoppers_inventory.png]".. "background[-0.19,-0.25;9.41,10.48;mcl_hoppers_inventory.png]"..
mcl_vars.inventory_header..
"list[current_name;main;2,0.5;5,1;]".. "list[current_name;main;2,0.5;5,1;]"..
"list[current_player;main;0,2.5;9,3;9]".. "list[current_player;main;0,2.5;9,3;9]"..
"list[current_player;main;0,5.74;9,1;]".. "list[current_player;main;0,5.74;9,1;]"..