🛡️ Crafting — Authority¶
📦 Folder Overview¶
This folder provides authority hooks and helpers for the Crafting system.
It defines a small, netcode-agnostic contract (ICraftingAuthority) that callers
or services can consult to decide whether a crafting mutation should be allowed.
This is not a networking system. Replication, prediction, reconciliation, and job state synchronization are the responsibility of your chosen netcode.
🧩 What Lives Here¶
ICraftingAuthority— mutation gating contractCraftingAuthorityResolver— framework-internal resolverCraftingAuthorityBinder— default local implementation
🎯 Purpose¶
Authority provides a consistent way to:
- gate crafting mutations (create, cancel, pause, resume)
- integrate with external authority or permission systems
- keep Crafting independent from networking or ownership models
🧠 Usage Guidance¶
ICraftingAuthority¶
Minimal interface used to allow or deny a crafting mutation.
public interface ICraftingAuthority
{
bool CanMutate(GameObject owner, out CraftFailReason denyReason);
}
Contract notes:
ownermay benull- implementations must tolerate
owner == null - the interface does not define when it is called or how results are interpreted
CraftingAuthorityResolver (internal)¶
Resolves an ICraftingAuthority relative to a context.
Resolution order (first usable):
- Local component on the context GameObject
- Parents of the context transform
- Scene roots (active and enabled)
- Global scan (active and enabled)
Inactive or disabled binders are not returned.
CraftingAuthorityBinder¶
Default permissive implementation for local or single-player setups.
[SerializeField] private bool alwaysTrue = true;
Behaviour:
true→ allows mutationsfalse→ denies mutations withUnauthorized
This binder does not perform networking checks.
⚙️ How Authority Is Intended to Be Used¶
Authority provides the decision hook, not the policy.
The caller or service determines:
- which operations are gated
- when authority is consulted
- how denial reasons are handled
Typical pattern:
authority.CanMutate(owner, out var reason);
If denied, return or emit a failure result.
⚠️ Important Notes¶
- Authority behaviour depends on the implementation provided by the project
- Crafting does not enforce a specific authority model
- Missing or permissive implementations may allow all mutations
🚫 Not for Production Use¶
- The default binder is intended for local testing and simple setups
- Multiplayer projects should provide their own authority implementation
🔗 Related Documentation¶
- Crafting Core (mutation flow and service behaviour)
- Integrations (authority adapters and examples)