Add formspec theming, remove sfinv's dependency on default
This commit is contained in:
parent
f3ce25fc72
commit
b0e55c52c8
|
@ -548,6 +548,9 @@ set a players home position and teleport a player to home position.
|
||||||
Sfinv API
|
Sfinv API
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
It is recommended that you read this link for a good introduction to the
|
||||||
|
sfinv API by its author: https://rubenwardy.com/minetest_modding_book/en/chapters/sfinv.html
|
||||||
|
|
||||||
### sfinv Methods
|
### sfinv Methods
|
||||||
|
|
||||||
**Pages**
|
**Pages**
|
||||||
|
@ -752,15 +755,15 @@ GUI and formspecs
|
||||||
|
|
||||||
`default.gui_bg`
|
`default.gui_bg`
|
||||||
|
|
||||||
* Background color formspec element
|
* Deprecated, remove from mods.
|
||||||
|
|
||||||
`default.gui_bg_img`
|
`default.gui_bg_img`
|
||||||
|
|
||||||
* Image overlay formspec element for the background to use in formspecs
|
* Deprecated, remove from mods.
|
||||||
|
|
||||||
`default.gui_slots`
|
`default.gui_slots`
|
||||||
|
|
||||||
* `listcolors` formspec element that is used to format the slots in formspecs
|
* Deprecated, remove from mods.
|
||||||
|
|
||||||
`default.gui_survival_form`
|
`default.gui_survival_form`
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,16 @@ default = {}
|
||||||
default.LIGHT_MAX = 14
|
default.LIGHT_MAX = 14
|
||||||
|
|
||||||
-- GUI related stuff
|
-- GUI related stuff
|
||||||
default.gui_bg = "bgcolor[#080808BB;true]"
|
default.gui_bg = ""
|
||||||
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
|
default.gui_bg_img = ""
|
||||||
default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
|
default.gui_slots = ""
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
function default.get_hotbar_bg(x,y)
|
function default.get_hotbar_bg(x,y)
|
||||||
local out = ""
|
local out = ""
|
||||||
|
|
|
@ -5,6 +5,8 @@ Simple Fast Inventory
|
||||||
|
|
||||||
A cleaner, simpler, solution to having an advanced inventory in Minetest.
|
A cleaner, simpler, solution to having an advanced inventory in Minetest.
|
||||||
|
|
||||||
|
Available for use outside of MTG here: <https://forum.minetest.net/viewtopic.php?t=19765>
|
||||||
|
|
||||||
Written by rubenwardy.
|
Written by rubenwardy.
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,7 @@ function sfinv.get_nav_fs(player, context, nav, current_idx)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local theme_main = "bgcolor[#080808BB;true]" .. default.gui_bg ..
|
local theme_inv = [[
|
||||||
default.gui_bg_img
|
|
||||||
|
|
||||||
local theme_inv = default.gui_slots .. [[
|
|
||||||
list[current_player;main;0,4.7;8,1;]
|
list[current_player;main;0,4.7;8,1;]
|
||||||
list[current_player;main;0,5.85;8,3;8]
|
list[current_player;main;0,5.85;8,3;8]
|
||||||
]]
|
]]
|
||||||
|
@ -47,7 +44,6 @@ local theme_inv = default.gui_slots .. [[
|
||||||
function sfinv.make_formspec(player, context, content, show_inv, size)
|
function sfinv.make_formspec(player, context, content, show_inv, size)
|
||||||
local tmp = {
|
local tmp = {
|
||||||
size or "size[8,8.6]",
|
size or "size[8,8.6]",
|
||||||
theme_main,
|
|
||||||
sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx),
|
sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx),
|
||||||
content
|
content
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
default
|
|
Loading…
Reference in New Issue