Source2 API (hyperion.source2.*)
These functions expose game state. Returned objects can be nil and should be validated with isValid().
Global functions
| Function |
Return |
Throws |
Description |
hyperion.source2.getLocalPlayer() |
PlayerPawn or nil |
No |
Local player pawn. |
hyperion.source2.getLocalController() |
PlayerController or nil |
No |
Local controller. |
hyperion.source2.getPlayerControllers() |
table |
No |
All controllers. |
hyperion.source2.getPlayerPawns() |
table |
No |
All pawns. |
hyperion.source2.getEntityByIndex(index) |
Entity or nil |
No |
Entity by index. |
PlayerPawn methods
| Method |
Return |
Throws |
Description |
player:health() |
int |
No |
Current health. |
player:maxHealth() |
int |
No |
Max health. |
player:armor() |
int |
No |
Armor value. |
player:team() |
int |
No |
Team number. |
player:origin() |
Vec3 |
No |
Position. |
player:eyePosition() |
Vec3 |
No |
Eye position. |
player:velocity() |
Vec3 |
No |
Velocity. |
player:isAlive() |
bool |
No |
Alive state. |
player:isScoped() |
bool |
No |
Scoped state. |
player:isDefusing() |
bool |
No |
Defusing state. |
player:isGrabbingHostage() |
bool |
No |
Hostage state. |
player:shotsFired() |
int |
No |
Shots fired. |
player:flashDuration() |
float |
No |
Flash duration. |
player:getActiveWeapon() |
Weapon or nil |
No |
Active weapon. |
player:isEnemy(other) |
bool |
No |
Enemy check. |
player:isValid() |
bool |
No |
Object validity. |
PlayerController methods
| Method |
Return |
Throws |
Description |
controller:name() |
string |
No |
Player name. |
controller:steamId() |
uint64 |
No |
Steam ID. |
controller:ping() |
int |
No |
Ping value. |
controller:health() |
int |
No |
Pawn health. |
controller:armor() |
int |
No |
Pawn armor. |
controller:isAlive() |
bool |
No |
Pawn alive. |
controller:hasDefuser() |
bool |
No |
Has defuser. |
controller:hasHelmet() |
bool |
No |
Has helmet. |
controller:team() |
int |
No |
Team number. |
controller:isLocal() |
bool |
No |
Is local player. |
controller:getPawn() |
PlayerPawn or nil |
No |
Pawn handle. |
controller:isValid() |
bool |
No |
Object validity. |
Weapon methods
| Method |
Return |
Throws |
Description |
weapon:name() |
string |
No |
Weapon name. |
weapon:ammo() |
int |
No |
Clip ammo. |
weapon:reserveAmmo() |
int |
No |
Reserve ammo. |
weapon:maxReserveAmmo() |
int |
No |
Max reserve ammo. |
weapon:isReloading() |
bool |
No |
Reloading state. |
weapon:weaponType() |
int |
No |
Weapon type enum. |
weapon:weaponTypeName() |
string |
No |
Weapon type name. |
weapon:isValid() |
bool |
No |
Object validity. |
Entity methods
| Method |
Return |
Throws |
Description |
entity:origin() |
Vec3 |
No |
Position. |
entity:team() |
int |
No |
Team number. |
entity:health() |
int |
No |
Health value. |
entity:isAlive() |
bool |
No |
Alive state. |
entity:isPlayerController() |
bool |
No |
Controller check. |
entity:isWeapon() |
bool |
No |
Weapon check. |
entity:isValid() |
bool |
No |
Object validity. |
Constants
Weapon types:
WEAPON_KNIFE, WEAPON_PISTOL, WEAPON_SMG, WEAPON_RIFLE,
WEAPON_SHOTGUN, WEAPON_SNIPER, WEAPON_MACHINEGUN,
WEAPON_C4, WEAPON_GRENADE.
Teams:
TEAM_NONE, TEAM_SPECTATOR, TEAM_T, TEAM_CT.