luvcraft/inventory.lisp
One material in an inventory. A NIL quantity means unlimited supply.
The ordered materials available to one player.
Make an inventory containing blocks in display and number-key order.
quantity is the initial count of every material, or NIL for creative-mode
unlimited supply.
Return inventory's materials in stable display and selection order.
Return the first ten entries addressable by number keys, 1-9 then 0.
Return inventory's number-key materials in stable order.
Return inventory's entry for block, or NIL when it is unavailable.
Add quantity of block to finite inventory storage and return its entry.
Adding to an unlimited entry leaves it unlimited. A previously unavailable block is appended, preserving the stable order of existing number keys.
Consume quantity of block and report success.
Unlimited entries always succeed. Finite entries remain present at zero so the view and number-key ordering do not jump as blocks are used.
Whether block is a thing a player picks up and carries, rather than a
material the palette gives without limit. A film is; stone is not.
Return the carried blocks inventory actually holds, in order.
Toggle session's inventory view, returning true when one is available.
LUVCRAFT/CORE has no UI dependency. LUVCRAFT/MCCLIM supplies the session method.
One material in an inventory. A NIL quantity means unlimited supply.
Construct a meaningful literal.
The ordered materials available to one player.
(&key (blocks (placeable-block-kinds)) (quantity nil))Make an inventory containing BLOCKS in display and number-key order. QUANTITY is the initial count of every material, or NIL for creative-mode unlimited supply.
(inventory)(inventory)The minimum of compatible quantities.
(inventory)(inventory block)(inventory block &optional (quantity 1))Add QUANTITY of BLOCK to finite INVENTORY storage and return its entry. Adding to an unlimited entry leaves it unlimited. A previously unavailable block is appended, preserving the stable order of existing number keys.
(inventory block &optional (quantity 1))Consume QUANTITY of BLOCK and report success. Unlimited entries always succeed. Finite entries remain present at zero so the view and number-key ordering do not jump as blocks are used.
Logical disjunction of tests and raw truth values.
Test whether one compatible scalar is at most another.
(block)Whether BLOCK is a thing a player picks up and carries, rather than a material the palette gives without limit. A film is; stone is not.
(inventory)Test whether two compatible scalars are equal.
Logical conjunction of tests and raw truth values.
(session)Toggle SESSION's inventory view, returning true when one is available. LUVCRAFT/CORE has no UI dependency. LUVCRAFT/MCCLIM supplies the session method.
Player-owned block inventory state, independent of any presentation system.