Health Authority¶
Folder Overview¶
This folder defines how mutation permission is determined for Health.
Purpose¶
Authority acts as a gate for mutation.
It answers one question:
Is this caller allowed to mutate this health instance?
What Lives Here¶
Core Contract — IHealthAuthority¶
bool HasAuthority(IHealthReadonly health);
Semantics:
- Returns
true→ mutation is allowed - Returns
false→ mutation is denied
No side effects. No state changes.
Important Notes¶
Authority does not:
- Replicate state
- Synchronize health
- Define ownership
- Handle networking
- Guarantee consistency across machines
These concerns belong to your networking layer, not Health.
Usage Guidance¶
How It Is Used¶
HealthSystemconsults authority only whenrequireAuthorityis enabled- If no authority is resolved → mutation is denied
- If authority returns
false→ mutation is denied
Authority is enforced at the point of mutation, not continuously.
Important Notes¶
Design Constraints¶
Implementations are expected to be:
- Fast enough for hot paths
- Designed to avoid allocations
- Side-effect free (pure query only)
Important Notes¶
Boundaries¶
Do not:
- Encode networking or replication logic here
- Couple authority to a specific framework (Mirror, NGO, Photon, etc.)
- Depend on where you were found. Resolution is nearest-first from the
HealthSystembeing gated — the object, its parents, then the scene — and an injectedFunc<bool>wins over all of it. Write the decision from theIHealthReadonlyyou are handed, not from your own placement - Perform mutation inside authority checks
Authority is a permission layer, nothing more.
Related Documentation¶
- Health Abstractions
- Health System