‪TechbloxModdingAPI  ‪v2.2.0
‪The unofficial Techblox modding API
TechbloxModdingAPI.Player Class Reference

‪An in-game player character. Any Leo you see is a player. More...

Inheritance diagram for TechbloxModdingAPI.Player:
TechbloxModdingAPI.EcsObjectBase

Public Member Functions

 Player (PlayerType player)
 ‪Initializes a new instance of the T:TechbloxModdingAPI.Player class. More...
 
 Player (uint id)
 ‪Initializes a new instance of the T:TechbloxModdingAPI.Player class. More...
 
bool DespawnMachine ()
 ‪Despawn the player's machine in time running mode and place it in their hand. More...
 
void EnterSeat (Seat seat)
 ‪Enter the given seat. More...
 
bool Equals (EGID other)
 
override bool Equals (object obj)
 
bool Equals (Player other)
 
void ExitSeat ()
 ‪Exit the seat the player is currently in. More...
 
Block GetBlockLookedAt (float maxDistance=-1f)
 ‪Returns the block the player is currently looking at in build mode. More...
 
Block GetGhostBlock ()
 ‪Returns the ghost block that shows the block to be placed in build mode. More...
 
override int GetHashCode ()
 
Block[] GetSelectedBlocks ()
 ‪Returns the blocks that are in the player's current selection. More...
 
SimBody GetSimBodyLookedAt (float maxDistance=-1f)
 ‪Returns the rigid body the player is currently looking at during simulation. More...
 
Wire GetWireLookedAt (float maxDistance=-1f)
 ‪Returns the wire the player is currently looking at in build mode. More...
 
bool SpawnMachine ()
 ‪Spawn the machine the player is holding in time running mode. More...
 
void Teleport (float x, float y, float z, bool relative=true, bool exitSeat=true)
 ‪Teleport the player to the specified coordinates. More...
 
override string ToString ()
 

Static Public Member Functions

static uint Count ()
 ‪The amount of Players in the current game. More...
 
static bool Exists (PlayerType player)
 ‪Checks if the specified player exists. More...
 
static bool Exists (uint player)
 ‪Checks if the specified player exists. More...
 

Public Attributes

PlayerBuildingMode BuildingMode
 ‪The player's mode in time stopped mode, determining what they place. More...
 
float Mass => 0
 ‪The player's mass. More...
 
PlayerState State
 

Static Package Functions

static Player GetInstance (uint id)
 
static T GetInstance< T > (EGID egid, Func< EGID, T > constructor, Type type=null)
 ‪Returns a cached instance if there's an actively used instance of the object already. Objects still get garbage collected and then they will be removed from the cache. More...
 
static WeakDictionary< EGID, EcsObjectBaseGetInstances (Type type)
 
static void Init ()
 

Package Attributes

EcsInitData InitData
 
WrappedHandler< PlayerSeatEventArgsseatEntered
 
WrappedHandler< PlayerSeatEventArgsseatExited
 

Static Package Attributes

static WrappedHandler< PlayerEventArgsjoined
 
static WrappedHandler< PlayerEventArgsleft
 

Properties

float?? AccelerationSetting [get, set]
 ‪The acceleration setting of the player. Build mode (camera) and simulation mode settings are separate. More...
 
float3 AngularVelocity [get, set]
 ‪The player's current angular velocity. More...
 
float? CurrentHealth [get, set]
 ‪The player's current health in Simulation (aka Time Running) mode. More...
 
uint? CurrentLives [get, set]
 ‪The player's current lives in Simulation (aka Time Running) mode. More...
 
bool Damageable [get, set]
 ‪Whether this T:TechbloxModdingAPI.Player is damageable. More...
 
bool Dead [get]
 ‪Whether the player is dead. If true, hopefully it was quick. More...
 
new uint Id [get]
 ‪The player's unique identifier. More...
 
float? InitialHealth [get, set]
 ‪The player's initial health when entering Simulation (aka Time Running) mode. More...
 
uint? InitialLives [get, set]
 ‪The player's lives when initially entering Simulation (aka Time Running) mode. More...
 
static Player LocalPlayer [get]
 ‪Returns the current player belonging to this client. It will be different after entering/leaving simulation. May return null if the local player doesn't exist. More...
 
float Ping [get]
 ‪The player's latest network ping time. More...
 
float3 Position [get, set]
 ‪The player's current position. More...
 
float3?? Rotation [get, set]
 ‪The player's current rotation. More...
 
BlockIDsSelectedBlock [get]
 ‪The player's selected block ID in their hand. More...
 
Blueprint???? SelectedBlueprint [get, set]
 ‪The player's selected blueprint in their hand. Set to null to clear. Dispose after usage. More...
 
BlockColorSelectedColor [get]
 ‪The player's selected block color in their hand. More...
 
BlockColorSelectedColour [get]
 ‪The player's selected block colour in their hand. More...
 
float?? SpeedSetting [get, set]
 ‪Movement speed setting. Build mode (camera) and simulation mode settings are separate. More...
 
float?? SpeedSprintMultiplierSetting [get, set]
 ‪The multiplier setting to use when sprinting. Build mode (camera) and simulation mode settings are separate. More...
 
bool?? Sprinting [get, set]
 ‪Whether the player is sprinting. More...
 
PlayerType Type [get]
 ‪The player's type. The player type is always relative to the current client, not the game host. More...
 
float3 Velocity [get, set]
 ‪The player's current velocity. More...
 

Events

static EventHandler< PlayerEventArgsJoined [add, remove]
 
static EventHandler< PlayerEventArgsLeft [add, remove]
 
EventHandler< PlayerSeatEventArgsSeatEntered [add, remove]
 
EventHandler< PlayerSeatEventArgsSeatExited [add, remove]
 

Detailed Description

An in-game player character. Any Leo you see is a player.

Constructor & Destructor Documentation

◆ Player() [1/2]

TechbloxModdingAPI.Player.Player ( uint  id)
inline

‪Initializes a new instance of the T:TechbloxModdingAPI.Player class.

Parameters
id‪The player's unique identifier.

◆ Player() [2/2]

TechbloxModdingAPI.Player.Player ( PlayerType  player)
inline

‪Initializes a new instance of the T:TechbloxModdingAPI.Player class.

Parameters
player‪The player type. Chooses the first available player matching the criteria.

Member Function Documentation

◆ Count()

static uint TechbloxModdingAPI.Player.Count ( )
inlinestatic

‪The amount of Players in the current game.

Returns
‪The count.

◆ DespawnMachine()

bool TechbloxModdingAPI.Player.DespawnMachine ( )
inline

‪Despawn the player's machine in time running mode and place it in their hand.

◆ EnterSeat()

void TechbloxModdingAPI.Player.EnterSeat ( Seat  seat)
inline

‪Enter the given seat.

Parameters
seat‪The seat to enter.

◆ Equals() [1/3]

bool TechbloxModdingAPI.Player.Equals ( EGID  other)
inline

◆ Equals() [2/3]

override bool TechbloxModdingAPI.Player.Equals ( object  obj)
inline

◆ Equals() [3/3]

bool TechbloxModdingAPI.Player.Equals ( Player  other)
inline

◆ Exists() [1/2]

static bool TechbloxModdingAPI.Player.Exists ( PlayerType  player)
inlinestatic

‪Checks if the specified player exists.

Returns
‪Whether the player exists.
Parameters
playerPlayer type.

◆ Exists() [2/2]

static bool TechbloxModdingAPI.Player.Exists ( uint  player)
inlinestatic

‪Checks if the specified player exists.

Returns
‪Whether the player exists.
Parameters
player‪The player's unique identifier.

◆ ExitSeat()

void TechbloxModdingAPI.Player.ExitSeat ( )
inline

‪Exit the seat the player is currently in.

◆ GetBlockLookedAt()

Block TechbloxModdingAPI.Player.GetBlockLookedAt ( float  maxDistance = -1f)
inline

‪Returns the block the player is currently looking at in build mode.

Parameters
maxDistance‪The maximum distance from the player (default is the player's building reach)
Returns
‪The block or null if not found

◆ GetGhostBlock()

Block TechbloxModdingAPI.Player.GetGhostBlock ( )
inline

‪Returns the ghost block that shows the block to be placed in build mode.

Returns
‪A block instance or null if not found

◆ GetHashCode()

override int TechbloxModdingAPI.Player.GetHashCode ( )
inline

◆ GetInstance()

static Player TechbloxModdingAPI.Player.GetInstance ( uint  id)
inlinestaticpackage

◆ GetInstance< T >()

static T TechbloxModdingAPI.EcsObjectBase.GetInstance< T > ( EGID  egid,
Func< EGID, T >  constructor,
Type  type = null 
)
inlinestaticpackageinherited

‪Returns a cached instance if there's an actively used instance of the object already. Objects still get garbage collected and then they will be removed from the cache.

Parameters
egid‪The EGID of the entity
constructor‪The constructor to construct the object
Template Parameters
T‪The object type
Returns
Type Constraints
T :EcsObjectBase 

◆ GetInstances()

static WeakDictionary<EGID, EcsObjectBase> TechbloxModdingAPI.EcsObjectBase.GetInstances ( Type  type)
inlinestaticpackageinherited

◆ GetSelectedBlocks()

Block [] TechbloxModdingAPI.Player.GetSelectedBlocks ( )
inline

‪Returns the blocks that are in the player's current selection.

Returns
‪An array of blocks or an empty array

◆ GetSimBodyLookedAt()

SimBody TechbloxModdingAPI.Player.GetSimBodyLookedAt ( float  maxDistance = -1f)
inline

‪Returns the rigid body the player is currently looking at during simulation.

Parameters
maxDistance‪The maximum distance from the player (default is the player's building reach)
Returns
‪The body or null if not found

◆ GetWireLookedAt()

Wire TechbloxModdingAPI.Player.GetWireLookedAt ( float  maxDistance = -1f)
inline

‪Returns the wire the player is currently looking at in build mode.

Parameters
maxDistance‪The maximum distance from the player (default is the player's building reach)
Returns
‪The wire or null if not found

◆ Init()

static void TechbloxModdingAPI.Player.Init ( )
inlinestaticpackage

◆ SpawnMachine()

bool TechbloxModdingAPI.Player.SpawnMachine ( )
inline

‪Spawn the machine the player is holding in time running mode.

◆ Teleport()

void TechbloxModdingAPI.Player.Teleport ( float  x,
float  y,
float  z,
bool  relative = true,
bool  exitSeat = true 
)
inline

‪Teleport the player to the specified coordinates.

Parameters
x‪The x coordinate.
y‪The y coordinate.
z‪The z coordinate.
relative‪If set to true teleport relative to the player's current position.
exitSeat‪If set to true exit any seat the player is in.

◆ ToString()

override string TechbloxModdingAPI.Player.ToString ( )
inline

Member Data Documentation

◆ BuildingMode

PlayerBuildingMode TechbloxModdingAPI.Player.BuildingMode
Initial value:
=> (‪PlayerBuildingMode)Math.Log((double)playerEngine
.GetCharacterStruct<TimeStoppedModeComponent>(‪Id).Get().timeStoppedContext, 2)

‪The player's mode in time stopped mode, determining what they place.

◆ InitData

EcsInitData TechbloxModdingAPI.EcsObjectBase.InitData
packageinherited

◆ joined

WrappedHandler<PlayerEventArgs> TechbloxModdingAPI.Player.joined
staticpackage

◆ left

WrappedHandler<PlayerEventArgs> TechbloxModdingAPI.Player.left
staticpackage

◆ Mass

float TechbloxModdingAPI.Player.Mass => 0

‪The player's mass.

The mass.

◆ seatEntered

WrappedHandler<PlayerSeatEventArgs> TechbloxModdingAPI.Player.seatEntered
package

◆ seatExited

WrappedHandler<PlayerSeatEventArgs> TechbloxModdingAPI.Player.seatExited
package

◆ State

PlayerState TechbloxModdingAPI.Player.State
Initial value:
=>
playerEngine.GetCharacterStruct<CharacterTagEntityStruct>(‪Id).Get().ID.groupID switch
{
var group when group == CharacterExclusiveGroups.MachineSpawningGroup => ‪PlayerState.HoldingMachine,
var group when group == CharacterExclusiveGroups.OnFootGroup => ‪PlayerState.OnFoot,
var group when group == CharacterExclusiveGroups.InPilotSeatGroup => ‪PlayerState.InSeat,
_ => throw new ArgumentOutOfRangeException("", "Unknown player state")
}

Property Documentation

◆ AccelerationSetting

float?? TechbloxModdingAPI.Player.AccelerationSetting
getset

‪The acceleration setting of the player. Build mode (camera) and simulation mode settings are separate.

◆ AngularVelocity

float3 TechbloxModdingAPI.Player.AngularVelocity
getset

‪The player's current angular velocity.

The angular velocity.

◆ CurrentHealth

float? TechbloxModdingAPI.Player.CurrentHealth
getset

‪The player's current health in Simulation (aka Time Running) mode.

The current health.

◆ CurrentLives

uint? TechbloxModdingAPI.Player.CurrentLives
getset

‪The player's current lives in Simulation (aka Time Running) mode.

The current lives.

◆ Damageable

bool TechbloxModdingAPI.Player.Damageable
getset

‪Whether this T:TechbloxModdingAPI.Player is damageable.

true if damageable; otherwise, false.

◆ Dead

bool TechbloxModdingAPI.Player.Dead
get

‪Whether the player is dead. If true, hopefully it was quick.

true if dead; otherwise, false.

◆ Id

new uint TechbloxModdingAPI.Player.Id
get

‪The player's unique identifier.

The identifier.

◆ InitialHealth

float? TechbloxModdingAPI.Player.InitialHealth
getset

‪The player's initial health when entering Simulation (aka Time Running) mode.

The initial health.

◆ InitialLives

uint? TechbloxModdingAPI.Player.InitialLives
getset

‪The player's lives when initially entering Simulation (aka Time Running) mode.

The initial lives.

◆ LocalPlayer

Player TechbloxModdingAPI.Player.LocalPlayer
staticget

‪Returns the current player belonging to this client. It will be different after entering/leaving simulation. May return null if the local player doesn't exist.

◆ Ping

float TechbloxModdingAPI.Player.Ping
get

‪The player's latest network ping time.

The ping (s).

◆ Position

float3 TechbloxModdingAPI.Player.Position
getset

‪The player's current position.

The position.

◆ Rotation

float3?? TechbloxModdingAPI.Player.Rotation
getset

‪The player's current rotation.

The rotation.

◆ SelectedBlock

BlockIDs? TechbloxModdingAPI.Player.SelectedBlock
get

‪The player's selected block ID in their hand.

The selected block.

◆ SelectedBlueprint

Blueprint???? TechbloxModdingAPI.Player.SelectedBlueprint
getset

‪The player's selected blueprint in their hand. Set to null to clear. Dispose after usage.

◆ SelectedColor

BlockColor? TechbloxModdingAPI.Player.SelectedColor
get

‪The player's selected block color in their hand.

The selected block's color.

◆ SelectedColour

BlockColor? TechbloxModdingAPI.Player.SelectedColour
get

‪The player's selected block colour in their hand.

The selected block's colour.

◆ SpeedSetting

float?? TechbloxModdingAPI.Player.SpeedSetting
getset

‪Movement speed setting. Build mode (camera) and simulation mode settings are separate.

◆ SpeedSprintMultiplierSetting

float?? TechbloxModdingAPI.Player.SpeedSprintMultiplierSetting
getset

‪The multiplier setting to use when sprinting. Build mode (camera) and simulation mode settings are separate.

◆ Sprinting

bool?? TechbloxModdingAPI.Player.Sprinting
getset

‪Whether the player is sprinting.

◆ Type

PlayerType TechbloxModdingAPI.Player.Type
get

‪The player's type. The player type is always relative to the current client, not the game host.

The enumerated player type.

◆ Velocity

float3 TechbloxModdingAPI.Player.Velocity
getset

‪The player's current velocity.

The velocity.

Event Documentation

◆ Joined

EventHandler< PlayerEventArgs> TechbloxModdingAPI.Player.Joined
staticaddremove

◆ Left

EventHandler< PlayerEventArgs> TechbloxModdingAPI.Player.Left
staticaddremove

◆ SeatEntered

EventHandler< PlayerSeatEventArgs> TechbloxModdingAPI.Player.SeatEntered
addremove

◆ SeatExited

EventHandler< PlayerSeatEventArgs> TechbloxModdingAPI.Player.SeatExited
addremove

The documentation for this class was generated from the following files: