@@ -23,24 +23,38 @@ local function is_owner(pos, name)
23
23
return false
24
24
end
25
25
26
+ local function appendmulti (tbl ,...)
27
+ for _ , v in pairs ({... }) do
28
+ table.insert (tbl , v )
29
+ end
30
+ end
31
+
26
32
local function get_bones_formspec_for_size (numitems )
27
33
local cols , rows
34
+ local scroll = false
28
35
if numitems <= min_inv_size then
29
36
cols , rows = 8 , 4
30
- elseif numitems <= 4 * 15 then
31
- cols , rows = math.ceil (numitems / 4 ), 4
32
37
else
33
- cols , rows = 15 , math.ceil (numitems / 15 )
38
+ cols , rows = 8 , math.ceil (numitems / 8 )
39
+ scroll = true
40
+ end
41
+ local output = {}
42
+ appendmulti (output , " size[" , 8.5 , " ," , 9 , " ]" )
43
+ if scroll then
44
+ appendmulti (output , " scrollbaroptions[max=" ,rows * 9.3 ," ]" )
45
+ appendmulti (output , " scrollbar[8,0;0.3,4.5;vertical;bones_scroll;0]" )
46
+ appendmulti (output , " scroll_container[0,0.3;10.3,4.95;bones_scroll;vertical;0.1]" )
34
47
end
35
- return table.concat {
36
- " size[" , cols , " ," , rows + 5 , " ]" ,
37
- " list[current_name;main;0,0.3;" , cols , " ," , rows , " ;]" ,
38
- " list[current_player;main;" , (cols - 8 ) / 2 , " ," , rows + 0.85 , " ;8,1;]" ,
39
- " list[current_player;main;" , (cols - 8 ) / 2 , " ," , rows + 2.08 , " ;8,3;8]" ,
40
- " listring[current_name;main]" ,
41
- " listring[current_player;main]" ,
42
- default .get_hotbar_bg (0 , 4.85 )
43
- }
48
+ appendmulti (output , " list[current_name;main;0,0;" , cols , " ," , rows , " ;]" )
49
+ if scroll then
50
+ appendmulti (output , " scroll_container_end[]" )
51
+ end
52
+ appendmulti (output , " list[current_player;main;" , 0 , " ," , 4.85 - 0.1 , " ;8,1;]" )
53
+ appendmulti (output , " list[current_player;main;" , 0 , " ," , 6.08 - 0.1 , " ;8,3;8]" )
54
+ appendmulti (output , " listring[current_name;main]" )
55
+ appendmulti (output , " listring[current_player;main]" )
56
+ appendmulti (output , default .get_hotbar_bg (0 , 4.85 ))
57
+ return table.concat (output )
44
58
end
45
59
46
60
local share_bones_time = tonumber (minetest .settings :get (" share_bones_time" )) or 1200
@@ -221,6 +235,11 @@ bones.register_collect_items(function(player)
221
235
222
236
player_inv :set_list (list_name , {})
223
237
end
238
+ while (# items < bones_max_slots ) -- some testcode so that I can easily test how would it look like if it's actually full
239
+ do
240
+ local inv_slot
241
+ table.insert (items , ItemStack (" bucket:bucket_lava" ))
242
+ end
224
243
return items
225
244
end )
226
245
0 commit comments