📦 Authority¶
Runtime, netcode-agnostic authority hooks that determine who may mutate an inventory.
This folder defines authority contracts and resolution logic used by the inventory service to gate write operations.
🎯 Purpose¶
Provide a consistent way to determine whether a caller may mutate inventory state.
🧩 What Lives Here¶
IInventoryAuthority¶
Minimal policy interface:
public interface IInventoryAuthority
{
bool HasAuthority(UnityEngine.GameObject owner);
}
Implemented by components that determine whether mutation is allowed for a given owner.
InventoryAuthority (resolver)¶
Static resolver and cache for locating an authority provider.
Resolves authority using a defined search order and caches the result for reuse.
Key methods:
IInventoryAuthority Resolve(MonoBehaviour ctx);
IInventoryAuthority Resolve(Component c);
IInventoryAuthority Resolve(GameObject go);
void Invalidate();
⚠️ Important Notes¶
- This folder defines authority contracts and resolution only
- It does not provide replication, prediction, or rollback systems
- It does not enforce networking behaviour
If no authority provider is found, the default runtime behaviour may allow mutations.
🧠 Usage Guidance¶
Service integration¶
Inventory services consult authority before executing mutation operations.
If denied, operations return InvOpCode.NoAuthority.
Read operations are not gated.
Resolution behaviour¶
Authority is resolved from:
- Cached instance (if valid)
- Same GameObject
- Parent hierarchy
- Scene roots
- Global scan fallback
The first valid provider is used.
Runtime updates¶
Call InventoryAuthority.Invalidate() if authority providers are added or removed at runtime.
🚫 Not for Production Use¶
This folder does not:
- Implement multiplayer systems
- Replicate inventory state
- Provide prediction or rollback
- Guarantee a specific authority model
These concerns must be handled by the host project or networking layer.