improve quiver formspec and add default mod check
This commit is contained in:
parent
44e8cd63ee
commit
29ff5e1a6d
25
api.lua
25
api.lua
|
@ -1875,14 +1875,18 @@ function XBowsQuiver.get_formspec(self, name)
|
||||||
local list_w = 8
|
local list_w = 8
|
||||||
local list_pos_x = (list_w - width) / 2
|
local list_pos_x = (list_w - width) / 2
|
||||||
|
|
||||||
local formspec =
|
local formspec = {
|
||||||
'size['..list_w..',6]' ..
|
'size['..list_w..',6]' ,
|
||||||
'list[detached:'..name..';main;'..list_pos_x..',0.3;'..width..',1;]'..
|
'list[detached:'..name..';main;'..list_pos_x..',0.3;'..width..',1;]',
|
||||||
'list[current_player;main;0,'..(height + 0.85)..';'..list_w..',1;]'..
|
'list[current_player;main;0,'..(height + 0.85)..';'..list_w..',1;]',
|
||||||
'list[current_player;main;0,'..(height + 2.08)..';'..list_w..',3;8]'..
|
'list[current_player;main;0,'..(height + 2.08)..';'..list_w..',3;8]',
|
||||||
'listring[detached:'..name..';main]'..
|
'listring[detached:'..name..';main]',
|
||||||
'listring[current_player;main]'..
|
'listring[current_player;main]'
|
||||||
default.get_hotbar_bg(0, height + 0.85)
|
}
|
||||||
|
|
||||||
|
if minetest.global_exists('default') then
|
||||||
|
formspec[#formspec + 1] = default.get_hotbar_bg(0, height + 0.85)
|
||||||
|
end
|
||||||
|
|
||||||
--update formspec
|
--update formspec
|
||||||
local inv = minetest.get_inventory({type='detached', name=name})
|
local inv = minetest.get_inventory({type='detached', name=name})
|
||||||
|
@ -1893,13 +1897,14 @@ function XBowsQuiver.get_formspec(self, name)
|
||||||
|
|
||||||
for i = 1, 3 do
|
for i = 1, 3 do
|
||||||
if not invlist or invlist[i]:is_empty() then
|
if not invlist or invlist[i]:is_empty() then
|
||||||
formspec = formspec ..
|
formspec[#formspec + 1] = 'image[' .. px .. ',' .. py .. ';1,1;x_bows_arrow_slot.png]'
|
||||||
'image[' .. px .. ',' .. py .. ';1,1;x_bows_arrow_slot.png]'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
px = px + 1
|
px = px + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
formspec = table.concat(formspec, '')
|
||||||
|
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Ŝarĝante…
Reference in New Issue