Formspec: create Formspec:listNodeMetaLocation
This commit is contained in:
@@ -197,12 +197,30 @@ end
|
||||
---@return Formspec
|
||||
function Formspec:list(inventoryLocation, listName, x, y, w, h, startingItemIndex)
|
||||
local element = ('list[%s;%s;%s,%s;%s,%s;%s]'):format(
|
||||
inventoryLocation, listName, x, y, w, h,startingItemIndex or '')
|
||||
inventoryLocation, listName, x, y, w, h, startingItemIndex or '')
|
||||
|
||||
self:addElement(element)
|
||||
return self
|
||||
end
|
||||
|
||||
---A wrapper around `Formspec:list` that allows access to the inventory of a node,
|
||||
---specified by the coordinates of its position in the world.
|
||||
---@param nodePos MapPosition
|
||||
---@param listName string
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param w number Are in inventory slots, not in coordinates.
|
||||
---@param h number Are in inventory slots, not in coordinates.
|
||||
---@param startingItemIndex number? The index of the first (upper-left) item to draw. Indices start at `0`. Default is `0`.
|
||||
---@return Formspec
|
||||
function Formspec:listNodeMetaLocation(nodePos, listName, x, y, w, h, startingItemIndex)
|
||||
local inventoryLocation = ('nodemeta:%s,%s,%s'):format(nodePos.x, nodePos.y, nodePos.z)
|
||||
|
||||
self:list(inventoryLocation, listName, x, y, w, h, startingItemIndex)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
---Creates and appends a list of `listring[<inventory location>;<list name>]` items based on the passed inventory list.
|
||||
---
|
||||
---**Elements:** `listring[<inventory location>;<list name>]` or `listring[]`
|
||||
|
||||
Reference in New Issue
Block a user