IPlayer
An interface in Root.Township, Alta.Networking.Scripts.Player.
The interface behind every player on the server or client. Player is the only implementation; Player.Current, Player.AllPlayers and Player.Get hand these out.
- Listed in Networking and servers
- Inherits or implements
INetworkEntity - Derived types
Player,PlayerEvent,PlayerList,PlayerUnityEvent - Attributes
TypeConverter - Documented in Arguments and results
Properties
| Member | What it is |
|---|---|
PlayerChunkManager ChunkManager { get; } | The player's PlayerChunkManager, which decides which chunks are loaded for them. |
Connection ConnectionToRemotePlayer { get; } | Server: the network connection to this player. Null on clients. |
PlayerCharacterCustomizationManager Customization { get; } | The player's cosmetics (their look). |
FriendshipManager FriendshipManager { get; } | Tracks which other players this player is friends with. |
bool IsLocalPlayer { get; } | True on a client for the player it controls. Always false on a dedicated server. |
PlayerCharacter PlayerCharacter { get; } | The current body as a PlayerCharacter. A hard cast of PlayerController. |
PlayerController PlayerController { get; } | The body the player currently controls, or null between spawns. |
PlayerEventsManager PlayerEventsManager { get; } | The player's event hub component. |
PlayerMode PlayerMode { get; set; } | How the player joined (VR, fly, autocam and so on). Only normal modes are saved. |
PlayerProgressionManager ProgressionManager { get; } | The player's skills and progression. |
PlayerSave Save { get; } | Server: the player's PlayerSave in memory, created at join if they had none. Null on clients. |
PlayerStateManager StateManager { get; } | The player's state stack (playing, downed, character room and so on). |
string UnityObjectName { get; } | The GameObject's name, such as 12 - Remote Player Bob. |
PlayerUnlockManager UnlockManager { get; } | Which unlocks the player has. |
UserInfoAndRole UserInfo { get; } | The player's account id, username and member status. |
IParticipant Voice { get; set; } | The player's Vivox voice participant, if voice chat is on. |
Events
| Member | What it is |
|---|---|
event Action LoadComplete | Raised after the player's save (entity, states and progression) has been loaded. |
event PlayerControllerHandler PlayerControllerSet | Raised when PlayerController is set or cleared. |
Methods
| Member | What it is |
|---|---|
void DestroyWithAssociatedObjects() | Destroys the player's body and the entities spawned with it, then the player entity itself. |
Vector3 GetSpawnPosition(bool isHome) | Where the player should appear: their saved position on join, or their respawn point (home if set) when respawning. |
bool IsInSavableState(bool isSavingIfDead = false) | Whether the player can be saved now. False with saving off, in fly or autocam mode, in the character room, dead or blocked. |
void Kick(string reason) | Server: disconnects the player and logs the reason. |
void SafeMoveToChunk(LocationChunk chunk, Vector3 controllerPosition, Action callback) | Server: parks the body in the void chunk, waits for the client to load the target chunk, moves it there, then calls the callback. |
void SaveControllerAndState(bool isSavingIfDead = false) | Server: copies body, states and progression into Save, if the player is in a savable state. Does not write the file. |
void WriteSave(bool isUnloading) | Server: serializes the player entity into Save and starts writing the file. Pass isUnloading when the player is leaving. |
Used in
Members of other types that take, return or hold a IPlayer:
AchievementBoard.UpdateAchievement, AchievementBoard.UpdatePlayer, AchievementGroupAchievement.CheckCompletion, ActionItem.OwnerUpdated, ActionItem.SetupOwner, ActionItem.SyncEffect, ActionItem.SyncOwner, AdditionalStaticContent.Sync, PlayerEffectController.NetworkTeleport, ForgedModel<TB, TA>.ProcessForgedEvent, ForgedModel<TB, TA>.SyncComplete, ForgedPoint.Sync, Recycler.SyncFull, Recycler.SyncOutputEffect, Recycler.SyncTemperatureValue, Smelter.SyncEffects, Smelter.SyncIcons, ChisellingDeck.NetworkUpdateBlock, TimberBlock.SyncPickup, TimberBlock.SyncPieceEffects, TimberBlock.SyncStatus, TimberBlockSpawner.SyncPosition, TimberBlockSpawner.SyncRotation, CaveLayerManager.SyncSeed, CaveTeleporter.AllowInteract, CaveTeleporter.SyncLayer, CaveTeleporter.Teleport, CaveTeleporter.teleporting, CaveTeleporterManager.DelayTeleport, CaveTeleporterManager.SyncEffect, CaveTeleporterManager.SyncFull, CaveTeleporterManager.SyncProxy, CaveTeleporterManager.TeleportPlayer, GenerationBase.ClientSpawn, CaveLayerStreamer.SyncLayer, CaveLayerStreamer.SyncLayerSetup, Chunk.SyncIndex, ChunkSync.playerSyncs, PlayerEntitySync.ClientLoad, StaticCaveChunk.SyncSetup, Inventory.Inventory, UserInfoDetailed.UserInfoDetailed, Cookable.SyncEffect, StewManager.FadeOutAddedIngredient, StewManager.SyncStewCreated, ConfirmationCraftingPart.OnCompleteEffect, ConfirmationCraftingPart.SyncAttemptCraft, ConfirmationCraftingPart.SyncClientNailHit, ConfirmationCraftingPart.SyncNail, ConfirmationCraftingPart.SyncPopout, ConfirmationCraftingPart.SyncSetup, CraftingPart.AttemptCraft, CraftingPart.ProcessCraftedEvent, DecraftingComponent.SyncDecraftingHit, GenericAssemblyStation.SyncDockPosition, GenericCraftingComponent.SyncEffects, GenericCraftingNail.LastHittingPlayer, GenericCraftingProject.SetPieceComplete, GenericCraftingProject.SyncDestroyEffect, GenericCraftingProject.SyncPiece and 706 more.