Show / Hide Table of Contents

Class Player

Represents a player in multiplayer.

There are no players in singleplayer.

Inheritance
Object
Player
Namespace: Modding.Common
Assembly: Assembly-CSharp.dll
Syntax
public class Player

Properties

ActivePrefab

The entity type the player has selected in the level editor.

Can be null if the player is not actively using the level editor.

Declaration
public EntityPrefabInfo ActivePrefab { get; }
Property Value
Type Description
EntityPrefabInfo

InLocalSim

Whether this player is currently in local simulation mode.

Declaration
public bool InLocalSim { get; }
Property Value
Type Description
Boolean

InternalObject

Internal representation of this object.

WARNING: This is not part of the stable API and subject to change!

Declaration
public PlayerData InternalObject { get; }
Property Value
Type Description
PlayerData

IsHost

Whether this is the host of the current multiplayer session.

Declaration
public bool IsHost { get; }
Property Value
Type Description
Boolean

IsLocalPlayer

Whether this is the local player.

Declaration
public bool IsLocalPlayer { get; }
Property Value
Type Description
Boolean

IsSpectator

Whether this player is a spectator.

Declaration
public bool IsSpectator { get; }
Property Value
Type Description
Boolean

Machine

The machine of this player (if it's not a spectator).

Declaration
public PlayerMachine Machine { get; }
Property Value
Type Description
PlayerMachine

Name

Name of the player.

Declaration
public string Name { get; }
Property Value
Type Description
String

NetworkId

ID of the player used for network communications.

Declaration
public ushort NetworkId { get; }
Property Value
Type Description
UInt16

Ping

The ping of this player.

Declaration
public int Ping { get; }
Property Value
Type Description
Int32

Selection

What entities the local player has selected in the level editor.

If this is not the local player, null.

Declaration
public ReadOnlyCollection<Entity> Selection { get; }
Property Value
Type Description
ReadOnlyCollection<Entity>

SteamId

SteamID of the player.

Empty if not connected via Steam.

Declaration
public string SteamId { get; }
Property Value
Type Description
String

Team

What team this player is a part of.

Declaration
public MPTeam Team { get; }
Property Value
Type Description
MPTeam

VoteState

Whether this player has voted to start simulation.

Declaration
public bool VoteState { get; }
Property Value
Type Description
Boolean

Methods

Equals(Player)

Declaration
protected bool Equals(Player other)
Parameters
Type Name Description
Player other
Returns
Type Description
Boolean

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
Object obj
Returns
Type Description
Boolean
Overrides
Object.Equals(Object)

From(PlayerData)

Create a Player object from its internal representation.

Declaration
public static Player From(PlayerData data)
Parameters
Type Name Description
PlayerData data
Returns
Type Description
Player

From(UInt16)

Returns a Player object from its network id.

Declaration
public static Player From(ushort networkId)
Parameters
Type Name Description
UInt16 networkId
Returns
Type Description
Player

GetAllPlayers()

Get a list of players currently connected.

Declaration
public static List<Player> GetAllPlayers()
Returns
Type Description
List<Player>

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
Int32
Overrides
Object.GetHashCode()

GetHost()

Returns a Player object representing the host of the current multiplayer session.

Declaration
public static Player GetHost()
Returns
Type Description
Player

GetLocalPlayer()

Returns a Player object representing the local player. Can be null when in singleplayer.

Declaration
public static Player GetLocalPlayer()
Returns
Type Description
Player

ToString()

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

Operators

Equality(Player, Player)

Declaration
public static bool operator ==(Player left, Player right)
Parameters
Type Name Description
Player left
Player right
Returns
Type Description
Boolean

Inequality(Player, Player)

Declaration
public static bool operator !=(Player left, Player right)
Parameters
Type Name Description
Player left
Player right
Returns
Type Description
Boolean
Back to top Generated by DocFX