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

Returns the current values of all of the entity's bodygroups.
Checks whether the yaw angles this entity and the specified one are aiming at differ by more than 50 degrees.
freeze()shared
Freezes the entity and marks it as frozen with the 'fl_frozen' networked variable.
Finds the hit group of the hitbox of the entity that contains the specified position.
Returns the display name of the entity.
Finds an idle sequence of the entity's model.
is_door()shared
Checks whether the entity is a door, judging by its class and model.
Checks whether the entity has been frozen with Entity#freeze.
Sets several bodygroups of the entity at once.
stuck()shared
Checks whether the bounding box of the entity intersects the world or another entity.
Unfreezes the entity that was frozen with Entity#freeze.

Methods

Entity:bodygroups()

shared packages/flow/lib/meta/sh_entity.lua:69

Returns the current values of all of the entity's bodygroups.

Returns

  • Map bodygroup values by bodygroup ID

Entity:facing(entity)

shared packages/flow/lib/meta/sh_entity.lua:91

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

Entity:get_hitgroup_from_pos(pos)

shared packages/flow/lib/meta/sh_entity.lua:118

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

Entity:get_name()

shared packages/flow/lib/meta/sh_entity.lua:101

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

Entity:idle_animation()

shared packages/flow/lib/meta/sh_entity.lua:54

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

Entity:is_door()

shared packages/flow/lib/meta/sh_entity.lua:30

Checks whether the entity is a door, judging by its class and model.

Returns

  • Boolean

Entity:is_frozen()

shared packages/flow/lib/meta/sh_entity.lua:177

Checks whether the entity has been frozen with Entity#freeze.

Returns

  • Boolean

Entity:set_bodygroups(bodygroups)

shared packages/flow/lib/meta/sh_entity.lua:81

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

Entity:unfreeze()

shared packages/flow/lib/meta/sh_entity.lua:159

Unfreezes the entity that was frozen with Entity#freeze. Runs the 'EntityUnfreeze' hook afterward. Meant to be called on the server.

See also

Defined in