Skip to content

Commit 5b1d581

Browse files
bell07paramat
authored andcommittedJul 10, 2019
Unify hotbar formspec for sfinv and creative
sfinv: Add lists above the content to support listrings in content. Reuse sfinv inventory lists for creative.
1 parent 3d530e0 commit 5b1d581

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed
 

‎mods/creative/inventory.lua

+1-3
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ function creative.register_tab(name, title, items)
108108
[[
109109
image[4.06,3.4;0.8,0.8;creative_trash_icon.png]
110110
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]
111-
list[current_player;main;0,4.7;8,1;]
112-
list[current_player;main;0,5.85;8,3;8]
113111
list[detached:creative_trash;main;4,3.3;1,1;]
114112
listring[]
115113
image_button[5.4,3.25;0.8,0.8;creative_prev_icon.png;creative_prev;]
@@ -126,7 +124,7 @@ function creative.register_tab(name, title, items)
126124
"field[0.3,3.5;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" ..
127125
"listring[detached:creative_" .. player_name .. ";main]" ..
128126
"list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" ..
129-
default.get_hotbar_bg(0,4.7) .. creative.formspec_add, false)
127+
creative.formspec_add, true)
130128
end,
131129
on_enter = function(self, player, context)
132130
local player_name = player:get_player_name()

‎mods/sfinv/api.lua

+9-3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ function sfinv.get_nav_fs(player, context, nav, current_idx)
3737
end
3838

3939
local theme_inv = [[
40+
image[0,4.7;1,1;gui_hb_bg.png]
41+
image[1,4.7;1,1;gui_hb_bg.png]
42+
image[2,4.7;1,1;gui_hb_bg.png]
43+
image[3,4.7;1,1;gui_hb_bg.png]
44+
image[4,4.7;1,1;gui_hb_bg.png]
45+
image[5,4.7;1,1;gui_hb_bg.png]
46+
image[6,4.7;1,1;gui_hb_bg.png]
47+
image[7,4.7;1,1;gui_hb_bg.png]
4048
list[current_player;main;0,4.7;8,1;]
4149
list[current_player;main;0,5.85;8,3;8]
4250
]]
@@ -45,11 +53,9 @@ function sfinv.make_formspec(player, context, content, show_inv, size)
4553
local tmp = {
4654
size or "size[8,8.6]",
4755
sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx),
56+
show_inv and theme_inv or "",
4857
content
4958
}
50-
if show_inv then
51-
tmp[#tmp + 1] = theme_inv
52-
end
5359
return table.concat(tmp, "")
5460
end
5561

‎mods/sfinv/init.lua

-8
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ sfinv.register_page("sfinv:crafting", {
99
image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]
1010
listring[current_player;main]
1111
listring[current_player;craft]
12-
image[0,4.7;1,1;gui_hb_bg.png]
13-
image[1,4.7;1,1;gui_hb_bg.png]
14-
image[2,4.7;1,1;gui_hb_bg.png]
15-
image[3,4.7;1,1;gui_hb_bg.png]
16-
image[4,4.7;1,1;gui_hb_bg.png]
17-
image[5,4.7;1,1;gui_hb_bg.png]
18-
image[6,4.7;1,1;gui_hb_bg.png]
19-
image[7,4.7;1,1;gui_hb_bg.png]
2012
]], true)
2113
end
2214
})

0 commit comments

Comments
 (0)
Please sign in to comment.