false when a capacity is set and this would exceed it - nothing is added
Finds the first item of a kind, or the matching instance when instanceId is supplied.
OptionalinstanceId: stringremoves up to quantity (default: the whole stack); the slot disappears once empty
Optionalquantity: numberOptionalinstanceId: stringTakes up to quantity from one stack and returns an item snapshot suitable for adding to
another inventory. All instance state travels with it; only the quantity is split.
OptionalinstanceId: stringWhat a save has to remember about one slot: its id, how many, and every field that can diverge between two items sharing that id.
The split is the whole design question here. stackable and weight describe the kind
of item and live in a game's own item table, so they are supplied fresh on load like
every other definition in this framework, and a game that rebalances an item's weight
sees the new value on an old save rather than the stale one baked into it. Everything
else - an enchantment level, wear, a rolled affix, whether it has been identified, the
instanceId keeping two otherwise-identical swords apart - belongs to the individual
item and is exactly what would be lost if a save recorded only "3 x potion".
StaticfromRebuilds an inventory, taking each item's kind-level fields from defs.
Throws on an id defs does not know, rather than restoring a weightless unstackable
ghost of it: a save naming an item the game no longer has is a real problem, and finding
out at load is far cheaper than finding out when a carry-weight check silently disagrees.
Adds an item, merging into an existing stack when both are stackable.