From 3edf8803015774e3712b63532d4fb3916d4d166f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 7 Mar 2019 13:05:26 +0100 Subject: [PATCH] Add minimal formspec prepend --- mods/CORE/mcl_init/init.lua | 8 ++++++-- mods/HELP/mcl_craftguide/init.lua | 3 +-- mods/HUD/mcl_formspec_prepend/depends.txt | 1 + mods/HUD/mcl_formspec_prepend/init.lua | 3 +++ mods/HUD/mcl_formspec_prepend/mod.conf | 1 + 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 mods/HUD/mcl_formspec_prepend/depends.txt create mode 100644 mods/HUD/mcl_formspec_prepend/init.lua create mode 100644 mods/HUD/mcl_formspec_prepend/mod.conf diff --git a/mods/CORE/mcl_init/init.lua b/mods/CORE/mcl_init/init.lua index de50bf00a..7f310b9a4 100644 --- a/mods/CORE/mcl_init/init.lua +++ b/mods/CORE/mcl_init/init.lua @@ -1,12 +1,16 @@ -- Some global variables (don't overwrite them!) mcl_vars = {} ---- GUI / inventory menu colors +--- GUI / inventory menu settings mcl_vars.gui_slots = "listcolors[#9990;#FFF7;#FFF0;#000;#FFF]" +-- nonbg is added as formspec prepend in mcl_formspec_prepend +mcl_vars.gui_nonbg = mcl_vars.gui_slots + +-- Background stuff must be manually added by mods (no formspec prepend) mcl_vars.gui_bg = "bgcolor[#080808BB;true]" mcl_vars.gui_bg_img = "" -mcl_vars.inventory_header = mcl_vars.gui_slots .. mcl_vars.gui_bg +mcl_vars.inventory_header = mcl_vars.gui_bg -- Mapgen variables local mg_name = minetest.get_mapgen_setting("mg_name") diff --git a/mods/HELP/mcl_craftguide/init.lua b/mods/HELP/mcl_craftguide/init.lua index 6b3d41328..3c8217063 100644 --- a/mods/HELP/mcl_craftguide/init.lua +++ b/mods/HELP/mcl_craftguide/init.lua @@ -315,8 +315,7 @@ function craftguide:get_formspec(player_name, is_fuel) data.pagemax = max(1, ceil(#data.items / ipp)) local formspec = "size["..data.iX..","..(iY+3)..".6;]".. - mcl_vars.gui_slots .. - mcl_vars.gui_bg .. + mcl_vars.inventory_header.. [=[background[1,1;1,1;craftguide_bg.png;true] button[2.4,0.21;0.8,0.5;search;?] button[3.05,0.21;0.8,0.5;clear;X] diff --git a/mods/HUD/mcl_formspec_prepend/depends.txt b/mods/HUD/mcl_formspec_prepend/depends.txt new file mode 100644 index 000000000..3b355984e --- /dev/null +++ b/mods/HUD/mcl_formspec_prepend/depends.txt @@ -0,0 +1 @@ +mcl_init diff --git a/mods/HUD/mcl_formspec_prepend/init.lua b/mods/HUD/mcl_formspec_prepend/init.lua new file mode 100644 index 000000000..0eb97de62 --- /dev/null +++ b/mods/HUD/mcl_formspec_prepend/init.lua @@ -0,0 +1,3 @@ +minetest.register_on_joinplayer(function(player) + player:set_formspec_prepend(mcl_vars.gui_nonbg) +end) diff --git a/mods/HUD/mcl_formspec_prepend/mod.conf b/mods/HUD/mcl_formspec_prepend/mod.conf new file mode 100644 index 000000000..c576d4493 --- /dev/null +++ b/mods/HUD/mcl_formspec_prepend/mod.conf @@ -0,0 +1 @@ +name = mcl_formspec_prepend