IRespawnSystemModel
An interface in Root.Township, ATT.Respawn.
The respawn shrines' state: fuel per shrine and which players are subscribed to which shrine. RespawnSystem owns it, ticks it on the server and syncs it to clients as JSON.
- Listed in ATT, Features and other game namespaces
- Inherits or implements IEnumerable<IRespawnShrineModel>,
IEnumerable - Derived types
RespawnSystemModel - Attributes
DefaultMember
Properties
| Member | What it is |
|---|---|
Guid GlobalShrineGuid { get; } | Id of the global (default) shrine that players use when not subscribed elsewhere. |
bool HasModelChanged { get; } | True when fuel or subscribers changed since the last sync to clients. |
IRespawnShrineModel this[Guid id] { get; } | The shrine model with the given id. Throws if there is none. |
Methods
| Member | What it is |
|---|---|
bool AddSubscriber(Guid shrineId, int playerId) | Subscribes a player id to a shrine. Always true for the global shrine, which keeps no list. |
void DecrementFuel(float timeSinceLastDecrementInSeconds) | Burns fuel on every shrine with subscribers. A shrine that runs out loses all its subscribers. |
Guid GetActiveShrineIdForPlayer(int playerId) | The shrine a player is subscribed to, or the global shrine if none. |
float GetRemainingPoweredTimeForShrineNormalized(Guid shrineId) | Fuel left as a fraction of the shrine's capacity. 0 for the global shrine. |
RespawnSystemSaveData GetSaveData() | Builds save data: the global shrine id and all shrine models as JSON. |
IEnumerable<int> GetShrineSubscriberIds(Guid shrineId) | Player ids subscribed to a shrine. Empty for the global shrine. |
bool RemoveSubscriber(Guid shrineId, int playerId) | Unsubscribes a player id from a shrine. Always true for the global shrine. |
void SetFuel(Guid shrineId, float value) | Sets a shrine's fuel and marks the model changed. |
void SyncToClients(IPlayer player, ref Stream stream) | Writes or reads all shrine models as a JSON string. Writing clears the changed flag. |
Used in
Members of other types that take, return or hold a IRespawnSystemModel:
GlobalRespawnShrine.OnModelChanged, IRespawnBeaconController.OnModelChanged, IRespawnSystem.AddSystemModelChangedListener, IRespawnSystem.RemoveSystemModelChangedListener, PoweredRespawnShrine.OnModelChanged, RespawnBeaconController.OnModelChanged, RespawnBeaconController.SpawnAllBeaconViews, RespawnShrine.OnModelChanged, RespawnSystem.AddSystemModelChangedListener, RespawnSystem.model, RespawnSystem.RemoveSystemModelChangedListener, RespawnSystem.systemModelChanged.