Show / Hide Table of Contents

Class Player

Inheritance
System.Object
Player
Implements
IPredator
ICanTakeDamage
IPrey
INetObjectPosition
INetObject
IPositionAndBounds
System.IDisposable
IDynamicObstacle
Namespace: Eco.Gameplay.Players
Assembly: Eco.Gameplay.dll
Syntax
public sealed class Player : WorldObserver, IPredator, ICanTakeDamage, IPrey, INetObjectPosition, INetObject, IPositionAndBounds, IDisposable, IDynamicObstacle

Constructors

Player(User, Single, INetClient)

Declaration
public Player(User user, float viewDistance, INetClient client)
Parameters
Type Name Description
User user
System.Single viewDistance
INetClient client

Fields

MountManager

Handles all player vehicle mounting and dismounting logic.

Declaration
public readonly MountManager MountManager
Field Value
Type Description
MountManager

OnChangedPlotPosition

Declaration
public ThreadSafeAction<PlotPos> OnChangedPlotPosition
Field Value
Type Description
ThreadSafeAction<PlotPos>

Properties

BaseVelocity

Declaration
public Vector3 BaseVelocity { get; }
Property Value
Type Description
System.Numerics.Vector3

Client

Declaration
public override INetClient Client { get; }
Property Value
Type Description
INetClient

ControllerID

Declaration
public ref int ControllerID { get; }
Property Value
Type Description
System.Int32

DesiredSpeed

Declaration
public float DesiredSpeed { get; }
Property Value
Type Description
System.Single

DisplayName

Declaration
public string DisplayName { get; }
Property Value
Type Description
System.String

FacingDir

Declaration
public override Vector3 FacingDir { get; }
Property Value
Type Description
System.Numerics.Vector3

Flying

Declaration
public bool Flying { get; }
Property Value
Type Description
System.Boolean

IsInitialized

Declaration
public override bool IsInitialized { get; set; }
Property Value
Type Description
System.Boolean

MinimapObject

Declaration
public MinimapObject MinimapObject { get; }
Property Value
Type Description
MinimapObject

OnMarkerAdd

Declaration
public ThreadSafeAction<WorldMarker> OnMarkerAdd { get; }
Property Value
Type Description
ThreadSafeAction<WorldMarker>

OnTwitchEnableStateChange

Called when the client changes the value of TwitchEnabled.

Declaration
public static ThreadSafeAction<User, bool> OnTwitchEnableStateChange { get; }
Property Value
Type Description
ThreadSafeAction<User, System.Boolean>

TargetId

Declaration
public int TargetId { get; }
Property Value
Type Description
System.Int32

TargetPos

Declaration
public Vector3i TargetPos { get; }
Property Value
Type Description
Vector3i

TwitchEnabled

Flag determining if the player currently has the Twitch integration enabled.

Declaration
public bool TwitchEnabled { get; }
Property Value
Type Description
System.Boolean

User

Declaration
[NewTooltipChildren]
public User User { get; }
Property Value
Type Description
User

Methods

ChangeBodyEmote(AnimationEmote)

These RPCs are called from local player (i.e. owner of this Player) after local player checks if it's possible to play the emote. Sends an RPC to all clients. Notify the clients to start playing an emote animation.

Declaration
public void ChangeBodyEmote(AnimationEmote bodyEmote)
Parameters
Type Name Description
AnimationEmote bodyEmote

ChangeExpressionEmote(ExpressionEmote)

Declaration
public void ChangeExpressionEmote(ExpressionEmote expressionEmote)
Parameters
Type Name Description
ExpressionEmote expressionEmote

CheckEmotes(INetClient, AnimationEmote, ExpressionEmote)

Sends an RPC only to the player who requested the emote. Player will check if possible to play the emote and then notify the server. This function is called from a chat command call when a player wants to change their emote.

Declaration
public void CheckEmotes(INetClient client, AnimationEmote bodyEmote, ExpressionEmote expressionEmote)
Parameters
Type Name Description
INetClient client
AnimationEmote bodyEmote
ExpressionEmote expressionEmote

ConfirmBox(LocString)

Declaration
public Task<bool> ConfirmBox(LocString message)
Parameters
Type Name Description
LocString message
Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

ConfirmBoxLoc(FormattableString)

Declaration
public Task<bool> ConfirmBoxLoc(FormattableString message)
Parameters
Type Name Description
System.FormattableString message
Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

ConvertToType(Type)

Declaration
public override object ConvertToType(Type type)
Parameters
Type Name Description
System.Type type
Returns
Type Description
System.Object

DeleteAllWaypoints()

Declaration
public void DeleteAllWaypoints()

Destroy()

Declaration
public override void Destroy()

DestroyPlayer()

Declaration
public void DestroyPlayer()

Dispose()

Declaration
public void Dispose()

DropExactWaypoint(Vector3i, String)

Declaration
public void DropExactWaypoint(Vector3i pos, string data)
Parameters
Type Name Description
Vector3i pos
System.String data

DropWaypoint(Vector2i)

Declaration
public void DropWaypoint(Vector2i pos)
Parameters
Type Name Description
Vector2i pos

Error(LocString)

Declaration
public override void Error(LocString message)
Parameters
Type Name Description
LocString message

ErrorLoc(FormattableString)

Declaration
public void ErrorLoc(FormattableString message)
Parameters
Type Name Description
System.FormattableString message

ErrorLocStr(String)

Declaration
public void ErrorLocStr(string message)
Parameters
Type Name Description
System.String message

GetItemForType(String)

Declaration
public Item GetItemForType(string typeName)
Parameters
Type Name Description
System.String typeName
Returns
Type Description
Item

GetItemUILinkForType(String)

Declaration
public string GetItemUILinkForType(string typeName)
Parameters
Type Name Description
System.String typeName
Returns
Type Description
System.String

GiveReputationTo(User, Int32, Single, String)

Declaration
public void GiveReputationTo(User user, int targetID, float value, string review)
Parameters
Type Name Description
User user
System.Int32 targetID
System.Single value
System.String review

HandleButtonLinkClicked(String, String, BSONObject)

Declaration
public void HandleButtonLinkClicked(string linkId, string rpcMethodName, BSONObject args)
Parameters
Type Name Description
System.String linkId
System.String rpcMethodName
BSONObject args

HandleLinkClicked(String, Boolean, Boolean, TooltipOrigin)

Declaration
public void HandleLinkClicked(string linkId, bool cntrPressed, bool shiftPressed, TooltipOrigin origin)
Parameters
Type Name Description
System.String linkId
System.Boolean cntrPressed
System.Boolean shiftPressed
TooltipOrigin origin

HandleViewLinkClicked(IController, Boolean, Boolean, TooltipOrigin)

Declaration
public void HandleViewLinkClicked(IController obj, bool cntrPressed, bool shiftPressed, TooltipOrigin origin)
Parameters
Type Name Description
IController obj
System.Boolean cntrPressed
System.Boolean shiftPressed
TooltipOrigin origin

InfoBox(LocString)

Declaration
public void InfoBox(LocString message)
Parameters
Type Name Description
LocString message

InfoBoxExtraLoc(FormattableString, String)

Declaration
public void InfoBoxExtraLoc(FormattableString message, string extra)
Parameters
Type Name Description
System.FormattableString message
System.String extra

InfoBoxLoc(FormattableString)

Declaration
public void InfoBoxLoc(FormattableString message)
Parameters
Type Name Description
System.FormattableString message

InfoBoxLocStr(String)

Declaration
public void InfoBoxLocStr(string message)
Parameters
Type Name Description
System.String message

InputLargeString(LocString, Nullable<LocString>, Int32)

Presents a large text input dialog to the user to send a text back to the server or hit cancel.

Declaration
public Task<string> InputLargeString(LocString message, Nullable<LocString> defaultText = null, int maxLength = 400)
Parameters
Type Name Description
LocString message
System.Nullable<LocString> defaultText
System.Int32 maxLength

Sets the max number of characters that the user can enter into the text field.

Returns
Type Description
System.Threading.Tasks.Task<System.String>

Text entered by the user if they hit confirm. Otherwise returns the value of System.String.Empty

InputPasswordString(LocString, Nullable<LocString>)

Presents a password input dialog to the user to send a text back to the server or hit cancel.

Declaration
public Task<string> InputPasswordString(LocString message, Nullable<LocString> defaultText = null)
Parameters
Type Name Description
LocString message

Message to show to the user about the text they are entering

System.Nullable<LocString> defaultText

Default text to place into the input field

Returns
Type Description
System.Threading.Tasks.Task<System.String>

Text entered by the user if they hit confirm. Otherwise returns the value of System.String.Empty

InputString(LocString, Nullable<LocString>)

Presents a text input dialog to the user to send a text back to the server or hit cancel.

Declaration
public Task<string> InputString(LocString message, Nullable<LocString> defaultText = null)
Parameters
Type Name Description
LocString message

Message to show to the user about the text they are entering

System.Nullable<LocString> defaultText

Default text to place into the input field

Returns
Type Description
System.Threading.Tasks.Task<System.String>

Text entered by the user if they hit confirm. Otherwise returns the value of System.String.Empty

IsAdmin()

Declaration
public override bool IsAdmin()
Returns
Type Description
System.Boolean

IsUpdated(INetObjectViewer)

Declaration
public override bool IsUpdated(INetObjectViewer viewer)
Parameters
Type Name Description
INetObjectViewer viewer
Returns
Type Description
System.Boolean

IsValidPlacement(Vector3i, Quaternion)

This function is called by the client when the player is in 'shadow placement' mode. It checks if a placement position is valid or not, by receiving the position and rotation of the object to be placed from the player. Returns true if the placement is valid, false otherwise. Also returns the blocks that are blocking the object placement position, if any.

Declaration
public (bool, List<Vector3i>) IsValidPlacement(Vector3i position, Quaternion rotation)
Parameters
Type Name Description
Vector3i position
Quaternion rotation
Returns
Type Description
System.ValueTuple<System.Boolean, System.Collections.Generic.List<Vector3i>>

LargeInfoBox(LocString, LocString, Nullable<LocString>)

Opens a large popup dialog box with the supplied text and header.

Declaration
public Task<bool> LargeInfoBox(LocString header, LocString message, Nullable<LocString> button = null)
Parameters
Type Name Description
LocString header

Header of the new popup dialog.

LocString message

The text to display to the user in the popup dialog.

System.Nullable<LocString> button

Text to display on the button. Defaults to "Ok".

Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

LargeInfoBoxConfirm(LocString, LocString, Nullable<LocString>, Nullable<LocString>)

Opens a large resizable popup dialog box with the supplied text, header and two buttons.

Declaration
public Task<bool> LargeInfoBoxConfirm(LocString header, LocString message, Nullable<LocString> buttonOne = null, Nullable<LocString> buttonTwo = null)
Parameters
Type Name Description
LocString header

Header of the new popup dialog.

LocString message

Text to display to the user in the popup dialog.

System.Nullable<LocString> buttonOne

Text to display on the first button ('Ok' by default).

System.Nullable<LocString> buttonTwo

Text to display on the second button ('Copy' by default).

Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

LargeInfoBoxWithTwoButtons(LocString, LocString, Nullable<LocString>, Nullable<LocString>)

Opens a large resizable popup dialog box with the supplied text, header and two buttons. Seconds button will be 'copy'

Declaration
public Task<bool> LargeInfoBoxWithTwoButtons(LocString header, LocString message, Nullable<LocString> buttonOne = null, Nullable<LocString> buttonTwo = null)
Parameters
Type Name Description
LocString header

Header of the new popup dialog.

LocString message

Text to display to the user in the popup dialog.

System.Nullable<LocString> buttonOne

Text to display on the first button ('Ok' by default).

System.Nullable<LocString> buttonTwo

Text to display on the second button ('Copy' by default).

Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

MinimapOpened()

Declaration
public void MinimapOpened()

MinimapSelectLayer()

Declaration
public void MinimapSelectLayer()

Msg(LocString, NotificationStyle)

Declaration
public void Msg(LocString message, NotificationStyle style)
Parameters
Type Name Description
LocString message
NotificationStyle style

MsgLoc(FormattableString, NotificationStyle)

Declaration
public void MsgLoc(FormattableString message, NotificationStyle style)
Parameters
Type Name Description
System.FormattableString message
NotificationStyle style

MsgLocStr(String, NotificationStyle)

Declaration
public void MsgLocStr(string message, NotificationStyle style)
Parameters
Type Name Description
System.String message
NotificationStyle style

NotifyMinimapIsOpenInWindowOrFullscreenMode()

Declaration
public void NotifyMinimapIsOpenInWindowOrFullscreenMode()

OkBox(LocString)

Declaration
public void OkBox(LocString message)
Parameters
Type Name Description
LocString message

OkBox(LocString, Boolean)

Declaration
public Result OkBox(LocString message, bool succeeded)
Parameters
Type Name Description
LocString message
System.Boolean succeeded
Returns
Type Description
Result

OkBoxAwaitable(LocString)

Declaration
public Task<bool> OkBoxAwaitable(LocString message)
Parameters
Type Name Description
LocString message
Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

OkBoxAwaitableLoc(FormattableString)

Declaration
public Task<bool> OkBoxAwaitableLoc(FormattableString message)
Parameters
Type Name Description
System.FormattableString message
Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

OkBoxExtraLoc(FormattableString, String)

Declaration
public void OkBoxExtraLoc(FormattableString message, string extra)
Parameters
Type Name Description
System.FormattableString message
System.String extra

OkBoxLoc(FormattableString)

Declaration
public void OkBoxLoc(FormattableString message)
Parameters
Type Name Description
System.FormattableString message

OkBoxLoc(FormattableString, Boolean)

Declaration
public Result OkBoxLoc(FormattableString message, bool succeeded)
Parameters
Type Name Description
System.FormattableString message
System.Boolean succeeded
Returns
Type Description
Result

OkBoxLocStr(String)

Declaration
public void OkBoxLocStr(string message)
Parameters
Type Name Description
System.String message

OpenInfoPanel(String, String, String)

Open info panel

Declaration
public void OpenInfoPanel(string title, string text, string category)
Parameters
Type Name Description
System.String title
System.String text
System.String category

The category, based on which will be remembered preferred positions and size.

OpenObjectives()

Opens the Objectives UI on the client.

Declaration
public void OpenObjectives()

OpenRepDialog(Int32)

Declaration
public void OpenRepDialog(int targetID)
Parameters
Type Name Description
System.Int32 targetID

OptionBox(LocString, List<String>)

Shows a dialog with a dropdown.

Declaration
public Task<int> OptionBox(LocString message, List<string> options)
Parameters
Type Name Description
LocString message

The text to be shown.

System.Collections.Generic.List<System.String> options

Options to be added to the dropdown.

Returns
Type Description
System.Threading.Tasks.Task<System.Int32>

Index of the selected item. -1 if the player cancels the dialog.

ReceiveUpdate(BSONObject)

Declaration
public override void ReceiveUpdate(BSONObject bsonObj)
Parameters
Type Name Description
BSONObject bsonObj

SendInitialState(BSONObject, INetObjectViewer)

Declaration
public override void SendInitialState(BSONObject obj, INetObjectViewer viewer)
Parameters
Type Name Description
BSONObject obj
INetObjectViewer viewer

SendUpdate(BSONObject, INetObjectViewer)

Declaration
public override void SendUpdate(BSONObject obj, INetObjectViewer viewer)
Parameters
Type Name Description
BSONObject obj
INetObjectViewer viewer

SetFlying(Boolean)

Declaration
public void SetFlying(bool set)
Parameters
Type Name Description
System.Boolean set

SetInitialMinimapObjectPos()

Declaration
public void SetInitialMinimapObjectPos()

SetPosition(Vector3)

Declaration
public void SetPosition(Vector3 position)
Parameters
Type Name Description
System.Numerics.Vector3 position

SetPositionAndRotation(Vector3, Quaternion)

Declaration
public void SetPositionAndRotation(Vector3 position, Quaternion rotation)
Parameters
Type Name Description
System.Numerics.Vector3 position
Quaternion rotation

SetRelativePosAndRot(Int32, Vector3, Vector3)

Declaration
public void SetRelativePosAndRot(int targetID, Vector3 position, Vector3 direction)
Parameters
Type Name Description
System.Int32 targetID
System.Numerics.Vector3 position
System.Numerics.Vector3 direction

SetTwitchEnabled(Boolean)

Sets the player's twitch enabled state

Declaration
public void SetTwitchEnabled(bool state)
Parameters
Type Name Description
System.Boolean state

Client's new Twitch integration enabled state

SetTwitchEnabledOnServer(Boolean)

Sets the client's current Twitch enabled status state.

Declaration
public void SetTwitchEnabledOnServer(bool state)
Parameters
Type Name Description
System.Boolean state

State that the client is currently in.

ShouldFleeUs(IPrey)

Declaration
public bool ShouldFleeUs(IPrey prey)
Parameters
Type Name Description
IPrey prey
Returns
Type Description
System.Boolean

ShowLocation(PointOfInterest)

Declaration
public void ShowLocation(PointOfInterest pointOfInterest)
Parameters
Type Name Description
PointOfInterest pointOfInterest

ShowLocationPos(Vector3i)

Declaration
public void ShowLocationPos(Vector3i position)
Parameters
Type Name Description
Vector3i position

SpawnBlockEffect(Vector3i, Type, BlockEffect)

Declaration
public void SpawnBlockEffect(Vector3i blockPosition, Type blockType, BlockEffect effect)
Parameters
Type Name Description
Vector3i blockPosition
System.Type blockType
BlockEffect effect

SpawnBlockEffect(Vector3i, Type, BlockEffect, BlockEffectParameters)

Declaration
public void SpawnBlockEffect(Vector3i blockPosition, Type blockType, BlockEffect effect, BlockEffectParameters parameters)
Parameters
Type Name Description
Vector3i blockPosition
System.Type blockType
BlockEffect effect
BlockEffectParameters parameters

SpawnBlockEffect(WrappedWorldPosition3i, Type, BlockEffect, BlockEffectParameters)

Declaration
public void SpawnBlockEffect(WrappedWorldPosition3i blockPosition, Type blockType, BlockEffect effect, BlockEffectParameters parameters)
Parameters
Type Name Description
WrappedWorldPosition3i blockPosition
System.Type blockType
BlockEffect effect
BlockEffectParameters parameters

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String

TryDamage(INetObject, Single)

Delegates damage to User.

Declaration
public bool TryDamage(INetObject source, float damage)
Parameters
Type Name Description
INetObject source
System.Single damage
Returns
Type Description
System.Boolean

Events

PropertyChanged

Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type Description
System.ComponentModel.PropertyChangedEventHandler

Implements

IPredator
ICanTakeDamage
IPrey
INetObjectPosition
INetObject
IPositionAndBounds
System.IDisposable
IDynamicObstacle

Extension Methods

InteractUtils.TooFarWithFudgeAndNotify(Player, Vector3i, Single)
TagUtils.TagNames(Object, Boolean)
TagUtils.TagDisplayNames(Object, Boolean)
FoldoutUtils.GetAllObjectsTooltip(Player, String)
FoldoutUtils.BalancedDietMultDescRPC(Player)
FoldoutUtils.VarietyMultDescRPC(Player)
FoldoutUtils.TastinessMultDescRPC(Player)
PlayerRPCs.SetPropertyClaimingMode(Player, PropertyClaimStyle, Nullable<WorldRange>, Nullable<SettlementType>, Settlement, Deed, String, String)
PlayerRPCs.StopPropertyClaimingMode(Player)
PlayerRPCs.EditMap(Player, MapEditRequest)
PlayerRPCs.ClientRPC(Player, String, Object[])
PlayerRPCs.ClientRPC(Player, String, Action, Object[])
UIUtils.OpenUI(Player, IController, String, String)
UIUtils.CloseUI(Player, IController, String)
PlayerPopups.Error(Player, LocString)
PlayerPopups.ErrorLocStr(Player, String)
PlayerPopups.ErrorLoc(Player, FormattableString)
PlayerPopups.InfoBox(Player, LocString)
PlayerPopups.InfoBoxLocStr(Player, String)
PlayerPopups.InfoBoxLoc(Player, FormattableString)
PlayerPopups.Msg(Player, LocString, NotificationStyle)
PlayerPopups.MsgLoc(Player, FormattableString, NotificationStyle)
PlayerPopups.MsgLocStr(Player, String, NotificationStyle)
PlayerPopups.OkBox(Player, LocString, Boolean)
PlayerPopups.OkBox(Player, LocString)
PlayerPopups.OkBoxLoc(Player, FormattableString)
PlayerPopups.OkBoxAwaitable(Player, LocString)
PlayerPopups.OkBoxAwaitableLoc(Player, FormattableString)
PlayerPopups.ConfirmBoxLoc(Player, FormattableString)
PlayerPopups.ConfirmBox(Player, LocString)
PlayerPopups.OkBoxLoc(Player, FormattableString, Boolean)
PlayerPopups.PopupSelectFromOptions(Player, LocString, LocString, LocString, IEnumerable<INamed>, IEnumerable<INamed>, MultiSelectorPopUpFlags, Nullable<LocString>)
PlayerPopups.PopupSelectFromIndexedOptions(Player, LocString, LocString, LocString, PlayerPopups.NamedSelection[], MultiSelectorPopUpFlags)
PlayerPopups.PopupSelectSelectDerivedInstances(Player, LocString, LocString, LocString, Type, IEnumerable<INamed>, Action<List<INamed>>, MultiSelectorPopUpFlags)
PlayerPopups.PopupTypePicker(Player, LocString, Type, Action<List<Type>>)
PlayerPopups.OptionBox(Player, LocString, List<String>)
ClientSetViewExtensions.SetClassOfProperty(Object, Player, String, String, Int32)
TooltipExtensions.GetTypeTooltipUILink(Player, String)
TypeTooltipExtensions.UILinkGeneric(Object)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾