Player proxy (self.player)¶
Bound on script tables as self.player. Only these members are available; unknown names are rejected.
Source: Utils/Lua/LuaPlayerApi.cs.
Properties¶
| Name | Lua type | Access | Notes |
|---|---|---|---|
AlienEnergy |
integer |
Read/write | Current alien-energy points. Reads 0 and ignores writes when the player is absent. |
CurGlobalCenter |
Vector2 | Read-only | Current center in world pixels. Returns a Vector2 value copy, or (0, 0) when the player is absent. |
DoingAerialAttack |
boolean |
Read/write | Whether the player is performing an aerial attack. Reads false and ignores writes when the player is absent. |
Dying |
boolean |
Read-only | Check whether the player is in the dying phase. True during the engine's dying phase; false when absent. |
FullnessPercent |
number |
Read/write | Fullness fraction, normally 0 to 1: 1 is full. The setter does not clamp the value. Reads 0 and ignores writes when the player is absent. |
Health |
number |
Read-only | Read current player health without changing it. Current health points, or 0 when absent. |
HoldRotation |
number |
Read/write | Held-item aim rotation in radians. Reads 0 and ignores writes when the player is absent. |
Id |
string or nil |
Read-only | Read a stable key for this runtime player object across different Lua views. Opaque ID, or nil when absent. Suitable for Lua table keys; changes when the object is recreated and is not a save or network identifier. |
IsDead |
boolean |
Read-only | Read the engine's completed-death flag. True when the player is marked dead; false when absent. Dying is exposed separately. |
IsLocalPlayer |
boolean |
Read-only | Check whether this player is controlled by this running game instance. True only for the local player; false for remote or absent players. Local ownership is independent of host authority. |
IsPlayer |
boolean |
Read-only | Distinguish a player from creatures and flora. True when a player object is present, including a retained invalid view; false when absent. |
IsValid |
boolean |
Read-only | Check whether this player remains present in the current Lua world. False when absent, dead, removed, or in another world. Presence does not imply combat eligibility; dying or respawning players may still be present. |
MaxHealth |
number |
Read-only | Read maximum player health without changing it. Maximum health points, or 0 when absent. |
Stamina |
number |
Read-only | Current stamina in stamina points, or 0 when the player is absent. |
TypeId |
string or nil |
Read-only | Read the player category used by entity type filters. PLAYER for a player, or nil when absent. This category is not a spawnable creature type. |
VelX |
number |
Read/write | Horizontal velocity in pixels per simulation update. Reads 0 and ignores writes when the player is absent. |
Methods¶
| Lua call | Arguments | Returns | Notes |
|---|---|---|---|
self.player:AddStatusEffect(statusEffect) |
statusEffect: StatusEffectHandle or nil — StatusEffectHandle returned by World.createStatusEffect for this player; nil does nothing. |
no return value | Attach a status-effect handle created for this player by World.createStatusEffect. Nil, wrong-target, expired, or already attached handles do nothing. A merged handle tracks the exact retained effect. |
self.player:AdjustAlienEnergy(adjustAmount) |
adjustAmount: integer — Signed alien-energy adjustment in points. |
no return value | Adjust alien-energy points. Does nothing when the player is absent. |
self.player:AdjustStamina(staminaAdjustment, canTriggerExhaust, canTriggerRegenDelay, giveHalfGrace) |
staminaAdjustment: number — Signed stamina adjustment in points.canTriggerExhaust: boolean (optional); default true — Whether this adjustment can trigger exhaustion. Defaults to true.canTriggerRegenDelay: boolean (optional); default true — Whether this adjustment triggers regeneration delay. Defaults to true.giveHalfGrace: boolean (optional); default false — When a cost takes stamina below zero, trigger exhaustion only if half the cost exceeds the prior remaining stamina. Defaults to false. |
no return value | Adjust stamina with optional exhaustion and regeneration-delay behavior. Does nothing when the player is absent. |
self.player:DetermineEncumbranceAttackSpeedMultiplier() |
None | number — Speed multiplier, where 1 means unchanged; 1 when the player is absent. |
Read the attack-speed multiplier caused by player encumbrance. |
self.player:GetGlobalBonePosition(boneName, offsetX, offsetY) |
boneName: string — Authored bone name.offsetX: number (optional); default 0 — Horizontal pixel offset. Defaults to 0.offsetY: number (optional); default 0 — Vertical pixel offset. Defaults to 0. |
Vector2 — World position as a Vector2 value copy; (0, 0) when the player is absent or the bone name is empty. | Read a player bone position with pixel texture offsets. |
self.player:GetGloveDamageReductionFlat() |
None | number — Flat damage reduction in damage points, or 0 when no player or gloves are available. |
Read flat damage reduction from equipped gloves. |
self.player:GetItemQuantity(itemType) |
itemType: ItemTypeToken — Built-in ammo token returned by Item.GetCurAmmoType; numeric enum IDs are not accepted by the Lua binder. Prefer the namespaced string overload for pack items. |
integer — 0 when the host is absent or does not support this operation. |
Count inventory units matching a namespaced item ID or built-in enum value. |
self.player:GetItemQuantity(itemUniqueID) |
itemUniqueID: string — Full registered item identity string. |
integer — 0 when the host is absent or does not support this operation. |
Count inventory units matching a namespaced item ID or built-in enum value. |
self.player:GetMeleeSpeedMod() |
None | number — Melee-speed multiplier; 1 when the player is absent. |
Read the current status-effect melee-speed multiplier, where 1 means normal. |
self.player:GetPointDirectionVector() |
None | Vector2 — Pointing direction as a Vector2 value copy; (0, 0) when the player is absent. | Read the player pointing direction. |
self.player:HasItemQuantity(itemType, quantity) |
itemType: ItemTypeToken — Built-in ammo token returned by Item.GetCurAmmoType; numeric enum IDs are not accepted by the Lua binder. Prefer the namespaced string overload for pack items.quantity: integer — Number of inventory units. |
boolean — False when the host is absent or does not support this operation. |
Check whether the player holds the requested inventory quantity. |
self.player:HasItemQuantity(itemUniqueID, quantity) |
itemUniqueID: string — Full registered item identity string.quantity: integer — Number of inventory units. |
boolean — False when the host is absent or does not support this operation. |
Check whether the player holds the requested inventory quantity. |
self.player:HasTag(tag) |
tag: string — Authored or engine-assigned tag. |
boolean — True when the player has the tag; false when absent or unmatched. |
Check an exact, case-sensitive entity tag. |
self.player:Heal(amount) |
amount: number — Finite nonnegative health points; invalid values raise an error. Healing does not revive dead or dying players. |
number — Actual health restored, or zero for an absent, dead, dying, or fully healed player. |
Heal the player in the local simulation, clamped to maximum health. |
self.player:IsExhausted() |
None | boolean — False when the host is absent or does not support this operation. |
Check whether the player is exhausted. |
self.player:IsOnGround() |
None | boolean — False when the host is absent or does not support this operation. |
Check whether the player is on the ground. |
self.player:IsRunning() |
None | boolean — False when the host is absent or does not support this operation. |
Check whether the player is running. |
self.player:IsStartingJump() |
None | boolean — False when the host is absent or does not support this operation. |
Check whether the player is starting a jump. |
self.player:LimitAimAngle(limitedAimAngle, limitedAimAngleTime) |
limitedAimAngle: number — Limited aim angle in radians.limitedAimAngleTime: number — Aim limitation duration in milliseconds. |
no return value | Limit the player aim angle for a duration. Does nothing when the player is absent. |
self.player:OverrideAnimation(animationName, lengthMS, transitionTime, lockHead, disrupt, playSpeedMultiplier) |
animationName: string — Authored animation name.lengthMS: integer — Override duration in milliseconds.transitionTime: number (optional); default .25 — Transition duration in seconds. Defaults to .25.lockHead: boolean (optional); default false — Whether the override locks head movement. Defaults to false.disrupt: boolean (optional); default false — Whether the override disrupts the current animation. Defaults to false.playSpeedMultiplier: number (optional); default 1 — Playback multiplier; 1 is normal speed. Defaults to 1. |
no return value | Override the player animation for a duration. Does nothing when the player is absent. |
self.player:RemoveItemQuantity(itemType, quantity) |
itemType: ItemTypeToken — Built-in ammo token returned by Item.GetCurAmmoType; numeric enum IDs are not accepted by the Lua binder. Prefer the namespaced string overload for pack items.quantity: integer — Number of inventory units. |
no return value | Remove inventory units matching a namespaced item ID or built-in enum value. Does nothing when the player is absent. |
self.player:RemoveItemQuantity(itemUniqueID, quantity) |
itemUniqueID: string — Full registered item identity string.quantity: integer — Number of inventory units. |
no return value | Remove inventory units matching a namespaced item ID or built-in enum value. Does nothing when the player is absent. |
self.player:Stun(stunTimeMS, stunAnimation, transitionTime, playSpeedMultiplier) |
stunTimeMS: integer — Stun duration in milliseconds.stunAnimation: string (optional); default "stun" — Authored stun animation name. Defaults to "stun".transitionTime: number (optional); default .25 — Transition duration in seconds. Defaults to .25.playSpeedMultiplier: number (optional); default 1 — Playback multiplier; 1 is normal speed. Defaults to 1. |
no return value | Stun the player and play a stun animation. Does nothing when the player is absent. |
CLR declaration reference
These names identify the backing engine source declarations.
int AlienEnergyVector2 CurGlobalCenterBoolean DoingAerialAttackbool Dyingfloat FullnessPercentfloat Healthfloat HoldRotationstring Idbool IsDeadbool IsLocalPlayerbool IsPlayerbool IsValidfloat MaxHealthfloat Staminastring TypeIdfloat VelXvoid AddStatusEffect(object statusEffect)void AdjustAlienEnergy(int adjustAmount)void AdjustStamina(float staminaAdjustment, Boolean canTriggerExhaust = true, Boolean canTriggerRegenDelay = true, Boolean giveHalfGrace = false)float DetermineEncumbranceAttackSpeedMultiplier()Vector2 GetGlobalBonePosition(String boneName, float offsetX = 0, float offsetY = 0)float GetGloveDamageReductionFlat()int GetItemQuantity(InventoryItemType itemType)int GetItemQuantity(String itemUniqueID)float GetMeleeSpeedMod()Vector2 GetPointDirectionVector()Boolean HasItemQuantity(InventoryItemType itemType, int quantity)Boolean HasItemQuantity(String itemUniqueID, int quantity)bool HasTag(string tag)float Heal(float amount)Boolean IsExhausted()Boolean IsOnGround()Boolean IsRunning()Boolean IsStartingJump()void LimitAimAngle(float limitedAimAngle, float limitedAimAngleTime)void OverrideAnimation(String animationName, int lengthMS, float transitionTime = .25f, Boolean lockHead = false, Boolean disrupt = false, float playSpeedMultiplier = 1f)void RemoveItemQuantity(InventoryItemType itemType, int quantity)void RemoveItemQuantity(String itemUniqueID, int quantity)void Stun(int stunTimeMS, String stunAnimation = "stun", float transitionTime = .25f, float playSpeedMultiplier = 1f)
Generated 2026-10-02T21:05:27.5090099Z · b8c9ae78 · 39 members.