Docs · Engineering reference
Inventory / Quantity
docs/features/inventory-quantity.mdEdit on GitHub
LF_QuantityComponent — Feature/Quantity/LF_QuantityComponent.c
- ✅ Virtual stack system:
AddQuantity/RemoveQuantityclamp to[0, max](0 = unlimited),SetQuantity(0)deletes the entity,CanCombine/Combine(conservation: source decrease == dest increase == transferred),CombineQuantities(2 and 3 yield 5),Split,QuantityRemainingAfterSplit(5 into 2 leaves 3),SortByQuantity(descending),GetRemainingCapacity(verified 2026-10-11). - ✅ In-inventory split mint closed (verified 2026-11-07): the
split stack is sized and marked keep-separate before
TryInsertItemInStorage, soHandleOnItemAddedno longer merges the spawned init quantity (100 for MoneyStack) into the source. Split 1 used to add 99. Pin testsecurity/inventory-split-no-mint. - ✅ Stack tier meshes hold their
Resourcewhile applied, so a tier swap no longer logsUsage of released BaseResourceObject(2026-11-08,quantity/operationsvisual path). - ✅ Transfer intent lifetime (2026-11-08, test
robustness/lifetime):OnDeleteremoves the entity's intent (no dead keys); an intent older thanINTENT_TTL_MS(5 s) belonged to a failed move and is ignored by the next add.LF_DefaultLoadoutItemQuantityComponentlogsLF_Debug.Errorinstead of crashing on a prefab withoutLF_QuantityComponent. - ✅ Storage panel refresh joins vanilla batching (#977, 2026-11-14): the quantity menu's three
direct
Refresh()calls now callRequestRefresh(), so a split or merge rebuilds each panel once; on gamepad the focused source panel consumes the request itself. The 10 ms debounce stays. - ⚠️
SplitwithsplitSize0 spawns an item then deletes it viaSetQuantity(0);ExtractQuantityComponentsinserts null components with no check;HandleOnItemAddedmay refresh UI on a just-deleted entity.
LF_InventoryUtils (Quantity) — Feature/Quantity/LF_InventoryUtils.c
- ✅ Quantity-aware
GetAmount/AddAmount/RemoveAmountreturning actual amounts; AddAmount fills stacks then spawns; RemoveAmount drains smallest stacks first (ascending sort). - ✅
AddAmount(..., dropOverflow=true)leaves what did not fit at the owner's feet, logs[LFDebug:Quantity] inventory refused ...and tells a player "No room on you: X x1 is on the ground at your feet." (#LF-Inventory_DroppedAtFeet). A pocketable item sets its ownItemPhysAttributes(SizeSetupStrategy Volume); without them the engine sizes it from the mesh, and a 26 cm bottle fits no backpack (Veshmeshok takes 20 cm), only the hands (0.2.1 N1, AppleJuice). Test:everon/outputs-fit-pack. - ⚠️
AddAmountfills largest stacks first (descending) while Remove drains smallest — asymmetric by design, untested. Non-quantityRemoveAmountpermanently deletes entities.GetAmountreturns −1 on null target.
ScriptedInventoryStorageManagerComponent (Quantity) — Feature/Quantity/ScriptedInventoryStorageManagerComponent.c
- ✅ RPC endpoints for split/transfer/intent (
RPC_LF_RequestQuantitySplit,RPC_LF_QuantityTransfer,RPC_LF_SetTransferIntent), all server-side, range-gated. - ✅ Ownership gate added (verified 2026-08-30):
LF_CanManipulateOwnedrejects another living player's carried items (only your own storage or unowned containers/ground loot); the old range-only anti-cheat is closed. - ✅ Locked owners refused (verified 2026-11-07):
LF_CanManipulateOwnedalso refuses a storage whose owner has a lockedLF_VehicleLockComponentorLF_LockComponent(LF_IsStorageOwnerLocked). Pin testsecurity/locked-storage-refused. A living character stops the owner climb, so a player seated in a locked car still splits and merges their own items; the check honours theVehicleLockswitch (#2411). - ✅ Restricted storages apply their own rule (#2585, merged, in-dev): a split or transfer changes a stack in place, so a storage's
CanStoreItemandHandleAccessValidationnever run.LF_CanManipulateOwnedasksLF_AllowsRestrictedStorage(declared inCore/LF_RestrictedStorageGate.c) for every container around the stack: a hideout stash takes members only (Hideouts/LF_HideoutStashQuantityGate.c, logs[LFDebug:Hideout] stash <id> kept ...), a trader crate refuses everyone (Trader/LF_TraderCrateGuard.c), and a downed or logout body followsm_bDownedCanBeSearched(Medic/LF_Downed.c). Pin testhideout/stash-quantity.
Hand-Carry — Feature/Character/Inventory/HandCarry/
- ✅
LF_HandInventoryStorageComponentstate machine (NONE→READY→AWAIT_HOLSTER→ACTIVE→AWAIT_SWAP→NONE), hands-only storage, modded vanilla SCR inventory/gadget wiring. - ✅ (#1846) The courier parcel left this system: it is a core hand tool (
LF_HandToolComponent, weapon quick slot), soLF_HandCarryComponentno longer forwards slot changes to it;ShouldGadgetBeDroppedstill keeps a living carrier's parcel in the hands (sprint, stance). The money bag and contraband crate are the hand-carry users. - ✅ Missing
CharacterControllerComponent, weapon manager, or inventory manager logsLF_Debug.Error("HandCarry", ...)and skips that step instead of a null dereference (2026-11-07). - ⚠️ Weapon-holster flow is client-only (server never sees the transition);
OnGadgetModeSetlacks theHasLocalControlguard its siblings have;SCR_CharacterControllerComponentdestructor touchesGetOwner()at teardown.