About
Hi, 5.0.0 adds a feature which allows you to prepend a formspec string to every formspec on an opt-out basis. This can be used to theme formspecs - you can make every formspec have the same background and such by default, among other things.Here is the code used in Minetest Game to set the default theme:
Code: Select all
minetest.register_on_joinplayer(function(player)
player:set_formspec_prepend([[
bgcolor[#080808BB;true]
background[5,5;1,1;gui_formbg.png;true]
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] ]])
end)
Action needed on existing mods
This will cause a minor breaking change in formspecs which don't currently use the default.gui* variables, so you'll either need to accept the consistent background or use the no_prepend[] element to disable the string being prepended to your formspec. You could instead override or modify the string set by Minetest Game's default if you wish it to be game-wideIf you have a node formspec which you'd like to modify to, eg: add no_prepend, then you will need to use an LBM:
Code: Select all
minetest.register_lbm({
name = "mymod:formspecfix",
nodenames = { "mymod:node" },
action = function(pos, node)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", mymod.get_formspec())
end,
})