mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-22 16:09:33 +01:00
Document mcl_formspec
API
This commit is contained in:
parent
4055555ec1
commit
9831f2c25b
2 changed files with 42 additions and 0 deletions
|
@ -0,0 +1,40 @@
|
|||
# MineClone2 Formspec API
|
||||
|
||||
## `mcl_formspec.label_color`
|
||||
|
||||
Contains the color used for formspec labels, currently `#313131`.
|
||||
|
||||
## `mcl_formspec.get_itemslot_bg(x, y, w, h)`
|
||||
|
||||
Get the background of inventory slots (formspec version = 1)
|
||||
|
||||
ex:
|
||||
|
||||
```lua
|
||||
local formspec = table.concat({
|
||||
mcl_formspec.get_itemslot_bg(0, 0, 5, 2),
|
||||
"list[current_player;super_inventory;0,0;5,2;]",
|
||||
})
|
||||
```
|
||||
|
||||
## `mcl_formspec.get_itemslot_bg_v4(x, y, w, h, size, texture)`
|
||||
|
||||
Get the background of inventory slots (formspec version > 1)
|
||||
|
||||
Works basically the same as `mcl_formspec.get_itemslot_bg(x, y, w, h)` but have more customisation options:
|
||||
|
||||
- `size`: allow you to customize the size of the slot borders, default is 0.05
|
||||
- `texture`: allow you to specify a custom texture tu use instead of the default one
|
||||
|
||||
ex:
|
||||
|
||||
```lua
|
||||
local formspec = table.concat({
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 0.375, 5, 2, 0.1, "super_slot_background.png"),
|
||||
"list[current_player;super_inventory;0.375,0.375;5,2;]",
|
||||
})
|
||||
```
|
||||
|
||||
## `mcl_formspec.itemslot_border_size`
|
||||
|
||||
Contains the default item slot border size used by `mcl_formspec.get_itemslot_bg_v4`, currently 0.05
|
|
@ -2,6 +2,7 @@ mcl_formspec = {}
|
|||
|
||||
mcl_formspec.label_color = "#313131"
|
||||
|
||||
---Get the background of inventory slots (formspec version = 1)
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param w number
|
||||
|
@ -32,6 +33,7 @@ end
|
|||
|
||||
mcl_formspec.itemslot_border_size = 0.05
|
||||
|
||||
---Get the background of inventory slots (formspec version > 1)
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param w integer
|
||||
|
|
Loading…
Reference in a new issue