Compare commits
5 Commits
417813282f
...
19a4faf09e
Author | SHA1 | Date |
---|---|---|
Zeg9 | 19a4faf09e | |
Zeg9 | dc16637d32 | |
Zeg9 | 7b806d6ee7 | |
Zeg9 | cb84f79e50 | |
Zeg9 | b99c0f6dc7 |
|
@ -11,9 +11,8 @@ License: GPLv3
|
|||
|
||||
--[[
|
||||
TODO:
|
||||
* Include a few button textures, especially for "abandoned" mods
|
||||
* Limit the number of buttons displayed, and then:
|
||||
* Multiple button pages (inventory can only display 9 buttons, and creative 6)
|
||||
* Multiple button pages (inventory can only display 6 buttons)
|
||||
* Fallback to text if no image is present ?
|
||||
]]--
|
||||
|
||||
|
@ -22,7 +21,7 @@ TODO:
|
|||
inventory_plus = {}
|
||||
|
||||
-- tell that we are inventory++, not inventory_plus
|
||||
-- ...so mods know if they can use our functions
|
||||
-- ...so mods know if they can use our functions like remove_button
|
||||
inventory_plus.plusplus = true
|
||||
|
||||
-- define buttons
|
||||
|
@ -74,7 +73,7 @@ end
|
|||
|
||||
-- get_formspec
|
||||
inventory_plus.get_formspec = function(player,page)
|
||||
local get_buttons = function(ox,oy)
|
||||
local get_buttons = function(ox,oy,mx) -- origin x, origin y, max x
|
||||
if not inventory_plus.buttons[player:get_player_name()] then
|
||||
return ""
|
||||
end
|
||||
|
@ -83,7 +82,7 @@ inventory_plus.get_formspec = function(player,page)
|
|||
for _, i in ipairs(inventory_plus.buttons[player:get_player_name()]) do
|
||||
formspec = formspec .. "image_button["..x..","..y..";1,1;inventory_plus_"..i..".png;"..i..";]"
|
||||
x=x+1
|
||||
if x >= ox+3 then
|
||||
if x >= ox+mx then
|
||||
y = y+1
|
||||
x = ox
|
||||
end
|
||||
|
@ -94,10 +93,10 @@ inventory_plus.get_formspec = function(player,page)
|
|||
if page=="main" then
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
return player:get_inventory_formspec()
|
||||
.. get_buttons(5,0)
|
||||
.. get_buttons(6,0,2)
|
||||
else
|
||||
return inventory_plus.inventory[player:get_player_name()]
|
||||
.. get_buttons(0,0)
|
||||
.. get_buttons(0,.5,2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 648 B |
Loading…
Reference in New Issue