The player component. Every player has one.
public void AwardWeapon(string name)
(Client/Server) Awards a weapon to the player.
Arguments
public void ReplaceWeapon(string name)
(Client/Server) Replaces the current held weapon.
Arguments
public void RemoveWeapon()
(Client/Server) Removes the current held weapon.
public WeaponBaseWrapper GetWeapon()
(Client/Server) Gets the weapon carried by this player.
Returns: (WeaponBase) The weapon.
public void AddImpact(LuaVector3 direction, float force)
(Client/Server) Adds an impact to the player, pushing them in a direction.
Arguments
(Vector3) The direction of the impact. [direction]
(float) Force of the impact. [force]
public void AddImpactWithEasing(LuaVector3 direction, float force, int easing = 1, float time = 0.1f)
(Client/Server) Same as AddImpact, with customizable easing.
Arguments
(Vector3) The direction of the impact. [direction]
(float) Force of the impact. [force]
(int) Easing type index. Defaults to Linear. [easing]
(float) Duration of applied force. [time]
public void Teleport(LuaVector3 newPosition, LuaVector3 newFacing, bool playEffect = true)
(Client/Server) Teleports a player to a given destination.
Arguments
(Vector3) The destination to teleport to [newPosition]
(Vector3) The facing of the player after teleport [newFacing]
(bool) Toggles the teleport effect on or off [playEffect]
public void TeleportWithEulerFacing(LuaVector3 newPosition, LuaVector3 newFacing, bool playEffect = true)
(Client/Server) Teleports a player to a given destination. Facing is set in euler angles (0-360 range).
Arguments
(Vector3) The destination to teleport to [newPosition]
(Vector3) The facing of the player after teleport [newFacing]
(bool) Toggles the teleport effect on or off [playEffect]
public void Kill()
(Client/Server) Kills the player.
public void RespawnAtPoint(LuaVector3 position, LuaVector3 facing, bool autoFalldown = true)
(Server) Respawns the player at a given position
Arguments
(Vector3) The position to respawn the player at. [position]
(Vector3) The facing of the player after respawn. [facing]
(bool) Whether to spawn player on the ground. [autoFalldown]
public void Respawn(bool autoFalldown = true)
(Server) Respawns the player at a random spawn point.
Arguments
public void RespawnWithCountdown(float time)
(Server) Respawns the player at a random spawn point with a given countdown.
Arguments
public void SetSpectator(bool shouldSpectate)
(Server) Set whether this player is a spectator or not.
Arguments
public void TakeDamage(int amount)
(Server) Damages the player.
Arguments
public void LockMovement(bool shouldLock)
(Client/Server) Toggle this player's movement lock.
Arguments
public void LockMovementOption(int lockingOption, bool shouldLock)
(Client/Server) Toggle this player's movement lock (specific option).
Arguments
(MovementLockingOptions) The type of movement to lock. [lockingOption]
(bool) The state of the toggle. [shouldLock]
public void Stun(float time)
(Server) Stun a player for some time.
Arguments
public void ResetEyeExpression()
(Client) Reset the eye expression back to default.
public void PlayEmote(int index)
(Client/Server) Play an emote on the player.
Arguments
public void PlayWinEffect(WinState state)
(Client/Server) Plays the microgame pass or fail effect on the player.
Arguments
public void SetLoserState(bool isLoser)
(Client) Sets a player to the endgame "loser" state. This must be called ONLY on the local player. This is synced.
Arguments
public void ShakeCamera(LuaVector3 positionIntensity, LuaVector3 rotationIntensity, float duration)
(Client) Shakes the player camera.
Arguments
(Vector3) How much should the camera move on each axis? [positionIntensity]
(Vector3) How much should the camera rotate on each axis? [rotationIntensity]
(float) Duration of the shake. [duration]
public void ShakeCameraAtPosition(LuaVector3 sourcePosition, float fallOff, float hotSpot, LuaVector3 positionIntensity, LuaVector3 rotationIntensity, float duration)
(Client) Shakes the player camera relative to a source position.
The closer the player is to the source, the stronger the camera will shake.
Arguments
(Vector3) The position of the source. [sourcePosition]
(float) The radius from the source in which players will be affected by the shake. [fallOff]
(float) The radius from the source in which players will feel the shake at full capacity (value should be smaller than falloff). [hotSpot]
(Vector3) How much should the camera move on each axis? [positionIntensity]
(Vector3) How much should the camera rotate on each axis? [rotationIntensity]
(float) Duration of the shake. [duration]
public int GetHealth()
(Client/Server) Get this player's health
Returns: (int) The health of this player.
public int GetMaxHealth()
(Client/Server) Get this player's max possible health
Returns: (int) The max health of this player.
public float GetHealthRatio()
(Client/Server) Get this player's ratio of health from 0 to 1
Returns: (float) The health ratio of this player.
public float GetHealthRatioInverted()
(Client/Server) Get this player's inverted ratio of health from 1 to 0
Returns: (float) The inverted health ratio of this player.
public void SetHealth(int health)
(Server) Set the health value of this player.
Arguments
public void SetHealthUnclamped(int health)
(Server) Set the health value of this player without the max health limit.
Arguments
public bool IsDead()
(Client/Server) Returns whether the player is dead.
Returns: (bool) The death state of this player.
public ulong GetSteamID()
(Client/Server) Returns this player's steam ID.
Returns: (ulong) The ID of this player
public string GetSteamName()
(Client/Server) Returns this player's steam name.
Returns: (string) The name of this player.
public LuaVector3 GetCameraPosition()
(Client) Get the position of the active player camera.
Returns: (Vector3) The position of the active camera.
public LuaVector3 GetCameraDirection()
(Client) Get the direction of the active player camera.
Returns: (Vector3) The direction of the active player camera.
public void SetFacing(LuaVector3 rotation)
(Client) Set the facing of a player.
Arguments
public void LookAt(LuaVector3 point)
(Client) Forces the player to look at a point in 3d space.
Arguments
public Team GetTeam()
(Client/Server) Get the team of this player.
Returns: (int) 0 for red, 1 for blue, 3 for green and 4 for yellow
public void SetTeam(int team)
(Server) Set this player's team.
Arguments
public bool SameTeamAs(PlayerControllerWrapper player)
(Client/Server) Checks whether this player and provided player are on the same team.
Arguments
Returns: (bool) Whether this player and provided player are on the same team.
public int GetScore()
(Client/Server) Get this player's score.
Returns: (int) Their score.
public int GetBossScore()
(Client/Server) Get this player's boss score.
Returns: (int) Their score.
public int GetLives()
(Client/Server) Get this player's lives.
Returns: (int) Their lives.
public bool GetPlayingStatus()
(Client/Server) Gets whether this player is playing or spectating. A player that ran out of lives in lives based gamemodes is also considered not playing.
Returns: (bool) Whether the coordinator considers this player to be part of the game.
public int GetRank()
(Client/Server) Get this player's scoreboard rank.
Returns: (int) The rank in the scoreboard of this player.
public bool IsLocalController()
(Client/Server) Check whether this player is the local controller.
Returns: (bool) If the player is the local controller.
public bool IsServer()
(Client/Server) Check whether this player is the server host.
Returns: (bool) If the player is the server host.
public int GetPing()
(Client/Server) Get the ping of this player.
Returns: (int) The ping of this player.
public LuaColor GetBodyPartColor(int part)
(Client/Server) Get the color for a body part from this player's customization settings.
Arguments
(int) Index of the body part.
Returns: (Color) The body part color.
public void GivePowerup(string name)
(Server) Award this player a powerup.
These are the same powerups as are in Railwars: * Auto Aim * Dual Railguns * Shield
Arguments
public bool IsCrouching()
(Client) Is the player crouching?
Returns: (bool) Whether this player is crouching.
public bool IsGrounded()
(Client) Is the player grounded?
Returns: (bool) Whether the player is grounded.
public bool IsPartyPassOwner()
(Client/Server) Is this player a party pass owner?
Returns: (bool) Whether the player is a party pass owner.
public void ShowHealthUI()
(Client) Shows the health UI.
public void HideHealthUI()
(Client) Hides the health UI.
public void SetScore(int score)
(Server) Set (regular) score for a player.
Arguments
public void SetBossScore(int score)
(Server) Set boss score for a player.
Arguments
public void AddScore(int score)
(Server) Add a set amount of (regular) score to a player.
Arguments
public void AddBossScore(int score)
(Server) Add a set amount of boss score to a player.
Arguments
public void AddLives(int lives)
(Server) Add a set amount of lives to a player.
Arguments
public void SubtractLives(int lives)
(Server) Subtract a set amount of lives to a player.
Arguments
public async void RequestAvatar()
(Client) Get the avatar of this player without blocking. NOTE: This will receive the avatar in the AvatarReceived global event.