Entity class
Part of Flow
Extensions of the Entity metatable, available on every entity, players included.
They add checks (Entity:stuck, Entity:is_door, Entity:facing), bodygroup, hitbox
and idle animation helpers, display names that plugins can provide through hooks
(Entity:get_name) and freezing (Entity:freeze).
The engine's SetModel is kept as fl_set_model, so that the Player metatable can
override it and still call the original.
Summary
Methods
Methods
Returns the current values of all of the entity's bodygroups.
Returns
- Map bodygroup values by bodygroup ID
Checks whether the yaw angles this entity and the specified one are aiming at differ by more than 50 degrees. Both must be able to aim (players or NPCs).
Parameters
- entity Entity player or NPC to compare with
Returns
- Boolean
Freezes the entity and marks it as frozen with the 'fl_frozen' networked variable. Players are unable to move and to use their active weapon, NPCs are put to sleep. Runs the 'EntityFreeze' hook afterward. Meant to be called on the server.
See also
Finds the hit group of the hitbox of the entity that contains the specified position.
Parameters
- pos Vector world position
Returns
- Number HITGROUP_ of the hitbox
- HITGROUP_GENERIC if the position is outside of them
Returns the display name of the entity. Players use the 'GetPlayerName' hook and their name, everything else uses the 'GetEntityName' hook and its string representation.
Returns
- String
Finds an idle sequence of the entity's model.
Returns
- Number ID of the first known idle sequence the model has
- ACT_IDLE if it has none
Checks whether the entity is a door, judging by its class and model.
Returns
- Boolean
Checks whether the entity has been frozen with Entity#freeze.
Returns
- Boolean
Sets several bodygroups of the entity at once.
Parameters
- bodygroups Map bodygroup values by bodygroup ID, as returned by Entity#bodygroups
Checks whether the bounding box of the entity intersects the world or another entity.
Returns
- Boolean
Unfreezes the entity that was frozen with Entity#freeze. Runs the 'EntityUnfreeze' hook afterward. Meant to be called on the server.