You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE] Add item-slot lock state and lifecycle events #295
Extend S1API.Items.ItemSlotInstance with managed lock state and slot lifecycle events.
The initial API should expose:
IsLocked, IsAddLocked, and IsRemovalLocked;
a managed snapshot of the active lock reason without exposing its native FishNet owner;
locked and unlocked events;
item-instance, item-data, and filter-change events where those native callbacks are available.
Why would this help?
ItemSlotInstance currently exposes quantity, item, and quantity mutation, while the native slot has explicit lock states and callbacks used by stations, storage, employee tasks, and multiplayer ownership. Inventory UI and automation mods otherwise have to inspect ItemSlot, ItemSlotLock, and native delegates directly.
Extra Context (Optional)
Keep applying/removing network-owned locks and exposing native NetworkObject instances out of the first version. If authoritative lock mutation is needed later, it should use an S1API-owned handle with explicit lifecycle and ownership rules.
Validate event subscription cleanup, slot reuse, save reload, and host/client lock replication separately on Mono and IL2CPP.
Issue #295 supports an additive, read-only wrapper extension. The smallest scope is direct lock-state forwarding, a reason-only immutable lock snapshot, and managed adapters for the five native callbacks; lock mutation and FishNet owner exposure remain excluded. IL2CPP generated-wrapper shape still needs verification before implementation.
Recommended next steps
Forward the three lock booleans directly. Expose ActiveLock as null or a fresh immutable S1API-owned value containing only the reason; do not expose the native lock or its FishNet owner.
Use managed Action events named Locked, Unlocked, ItemInstanceChanged, ItemDataChanged, and FilterChanged. Register one stored native adapter per managed add and remove exactly that adapter on -= so other native listeners remain intact.
Keep state non-persistent and read-only. The API observes the state delivered to the current peer and makes no replication-order, authority, or lock-mutation promise.
Open questions
Does the target IL2CPP import expose all five native callback fields and the lock members with directly usable generated types? If not, the affected surface should wait for a compatible game target rather than gain reflection fallback behavior.
Evidence and validation
Evidence inspected
The current S1API ItemSlotInstance wraps a native slot but exposes only quantity, item instance, and quantity mutation. It has no existing lock state or lifecycle event surface.
Regular and beta Mono source declare the same ItemSlot seam: IsLocked, IsAddLocked, IsRemovalLocked, ActiveLock, and onLocked, onUnlocked, onItemInstanceChanged, onItemDataChanged, and onFilterChange. The native lock carries a LockReason plus a FishNet owner.
Native IItemSlotOwner and StorageEntity declare server/observer lock and filter RPC routes. That supports observation of locally delivered native callbacks, but does not prove callback timing or host/client behavior.
S1API already bridges native callbacks with runtime-specific delegates and ManagedEventRegistrationTracker in TemperatureEmitter and TrashContainer. The tracker preserves duplicate add/remove semantics and supports cleanup without replacing native delegate lists.
Compared regular and beta Mono declarations for ItemSlot, ItemSlotLock, IItemSlotOwner, StorageEntity, and ItemSlotUI.
Inspected S1API's existing managed native-event registration and cleanup pattern.
Ran git diff --check; the checkout has no local changes.
Runtime validation remaining
Inspect the generated IL2CPP ItemSlot wrapper and compile both target graphs before implementing.
After implementation, run the full MonoMelon and Il2CppMelon build and contract-test commands.
Human runtime validation on both runtimes: subscribe/unsubscribe and duplicate handlers, acquire new wrappers for a reused slot, save reload, and host/client lock and filter replication. No in-game or end-to-end validation was run.
Create a pull request to implement this plan and close this issue when merged.
Activity
ifBars commentedon Sep 6, 2026
@Diffuin Research this accordingly and create an implementation plan
diffuin commentedon Sep 6, 2026
Issue investigation
Confidence: Medium
Issue #295 supports an additive, read-only wrapper extension. The smallest scope is direct lock-state forwarding, a reason-only immutable lock snapshot, and managed adapters for the five native callbacks; lock mutation and FishNet owner exposure remain excluded. IL2CPP generated-wrapper shape still needs verification before implementation.
Recommended next steps
ActiveLockasnullor a fresh immutable S1API-owned value containing only the reason; do not expose the native lock or its FishNet owner.Actionevents namedLocked,Unlocked,ItemInstanceChanged,ItemDataChanged, andFilterChanged. Register one stored native adapter per managed add and remove exactly that adapter on-=so other native listeners remain intact.Open questions
Evidence and validation
Evidence inspected
ItemSlotInstancewraps a native slot but exposes only quantity, item instance, and quantity mutation. It has no existing lock state or lifecycle event surface.ItemSlotseam:IsLocked,IsAddLocked,IsRemovalLocked,ActiveLock, andonLocked,onUnlocked,onItemInstanceChanged,onItemDataChanged, andonFilterChange. The native lock carries aLockReasonplus a FishNet owner.IItemSlotOwnerandStorageEntitydeclare server/observer lock and filter RPC routes. That supports observation of locally delivered native callbacks, but does not prove callback timing or host/client behavior.ManagedEventRegistrationTrackerinTemperatureEmitterandTrashContainer. The tracker preserves duplicate add/remove semantics and supports cleanup without replacing native delegate lists.Validation performed
ItemSlotInstancematches the checkout.ItemSlot,ItemSlotLock,IItemSlotOwner,StorageEntity, andItemSlotUI.git diff --check; the checkout has no local changes.Runtime validation remaining
ItemSlotwrapper and compile both target graphs before implementing.Diffuin run details
codexgpt-5.6-terraxhigh(Luna advisor: complexity (high); baseline coupled source-backed request)01a0740d-2709-7022-915e-2f10edd76418AI notice: Generated with AI assistance and not guaranteed accurate. Verify findings and plans against the current source and runtime.
diffuin commentedon Oct 15, 2026
I opened #365