Skip to content

Commit b0e55c5

Browse files
authoredMar 28, 2018
Add formspec theming, remove sfinv's dependency on default
1 parent f3ce25f commit b0e55c5

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed
 

Diff for: ‎game_api.txt

+6-3
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,9 @@ set a players home position and teleport a player to home position.
548548
Sfinv API
549549
---------
550550

551+
It is recommended that you read this link for a good introduction to the
552+
sfinv API by its author: https://rubenwardy.com/minetest_modding_book/en/chapters/sfinv.html
553+
551554
### sfinv Methods
552555

553556
**Pages**
@@ -752,15 +755,15 @@ GUI and formspecs
752755

753756
`default.gui_bg`
754757

755-
* Background color formspec element
758+
* Deprecated, remove from mods.
756759

757760
`default.gui_bg_img`
758761

759-
* Image overlay formspec element for the background to use in formspecs
762+
* Deprecated, remove from mods.
760763

761764
`default.gui_slots`
762765

763-
* `listcolors` formspec element that is used to format the slots in formspecs
766+
* Deprecated, remove from mods.
764767

765768
`default.gui_survival_form`
766769

Diff for: ‎mods/default/init.lua

+10-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@ default = {}
99
default.LIGHT_MAX = 14
1010

1111
-- GUI related stuff
12-
default.gui_bg = "bgcolor[#080808BB;true]"
13-
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
14-
default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
12+
default.gui_bg = ""
13+
default.gui_bg_img = ""
14+
default.gui_slots = ""
15+
16+
minetest.register_on_joinplayer(function(player)
17+
player:set_formspec_prepend([[
18+
bgcolor[#080808BB;true]
19+
background[5,5;1,1;gui_formbg.png;true]
20+
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] ]])
21+
end)
1522

1623
function default.get_hotbar_bg(x,y)
1724
local out = ""

Diff for: ‎mods/sfinv/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Simple Fast Inventory
55

66
A cleaner, simpler, solution to having an advanced inventory in Minetest.
77

8+
Available for use outside of MTG here: <https://forum.minetest.net/viewtopic.php?t=19765>
9+
810
Written by rubenwardy.
911
License: MIT
1012

Diff for: ‎mods/sfinv/api.lua

+1-5
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,14 @@ function sfinv.get_nav_fs(player, context, nav, current_idx)
3636
end
3737
end
3838

39-
local theme_main = "bgcolor[#080808BB;true]" .. default.gui_bg ..
40-
default.gui_bg_img
41-
42-
local theme_inv = default.gui_slots .. [[
39+
local theme_inv = [[
4340
list[current_player;main;0,4.7;8,1;]
4441
list[current_player;main;0,5.85;8,3;8]
4542
]]
4643

4744
function sfinv.make_formspec(player, context, content, show_inv, size)
4845
local tmp = {
4946
size or "size[8,8.6]",
50-
theme_main,
5147
sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx),
5248
content
5349
}

Diff for: ‎mods/sfinv/depends.txt

-1
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.