Skip to content

entity

Description

Interacting with game entities


get_all

entity.get_all(classname)

Returns an array of entity indices matching the classname. If classname is omitted, returns all entities. (Dormant entities are not returned)

get_bounding_box

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.

get_classname

entity.get_classname(entindex)

Returns the entity’s class name.

get_inventory

entity.get_inventory(entindex)

Returns an array of item entity indices in the player’s inventory.

get_local_player

entity.get_local_player()

Returns the local player’s entity index, or nil if not found.

get_origin

entity.get_origin(entindex)

Returns the entity’s origin world coordinates, or nil if information is unavailable.

get_player_name

entity.get_player_name(entindex)

Returns the player name for a player entity, fallbacks to UUID or the string “unknown” on failure.

get_player_uuid

entity.get_player_uuid(entindex)

Returns the player UUID for a player entity and the UUID format, or nil on failure.

get_players

entity.get_players(enemies_only: optional)

Returns an array of player entity indices.

hitbox_pos

entity.hitbox_pos(entindex)

Returns world coordinates of the hitboxes, or nil on failure.

is_alive

entity.is_alive(entindex)

Returns true if the entity is alive.