Interacting with game entities
entity.get_all(classname)
Returns an array of entity indices matching the
classname. Ifclassnameis omitted, returns all entities. (Dormant entities are not returned)
entity.get_bounding_box(entindex)
Returns the 2D bounding box and alpha multiplier. The bounding box is returned as an array of 4 points (top-left, top-right, bottom-right, bottom-left) in screen coordinates.
entity.get_classname(entindex)
Returns the entity’s class name.
entity.get_inventory(entindex)
Returns an array of item entity indices in the player’s inventory.
entity.get_local_player()
Returns the local player’s entity index, or nil if not found.
entity.get_origin(entindex)
Returns the entity’s origin world coordinates, or nil if information is unavailable.
entity.get_player_name(entindex)
Returns the player name for a player entity, fallbacks to UUID or the string “unknown” on failure.
entity.get_player_uuid(entindex)
Returns the player UUID for a player entity and the UUID format, or nil on failure.
entity.get_players(enemies_only: optional)
Returns an array of player entity indices.
entity.hitbox_pos(entindex)
Returns world coordinates of the hitboxes, or nil on failure.
entity.is_alive(entindex)
Returns true if the entity is alive.