Flashlight entity
Entity defined in plugin/entities/entities/fl_flashlight.lua
Part of Shared Flashlight
The light of a player's flashlight (fl_flashlight): an invisible entity parented to
the player that owns it, created and removed by Player:set_flashlight. Every client that
receives it draws a projected light from the owner's eyes along their view, shaped by the
flashlight_fov, flashlight_distance, flashlight_brightness and flashlight_shadows
configs, so the owner and everyone around them see the same beam.
Summary
Methods
Methods
Draws nothing: the entity has no model, only the light.
On the server
Keeps the entity out of collisions and sends it along with the player it is parented to, so that a client that sees the player always has their light.
On the client
Does nothing but hide the shadow of the entity. The projected light is created on the first think that finds the owner, so that there is never a light without a player.
Defined in
Removes the light and forgets the entity as its owner's flashlight.
Removes the light, for the frames the owner is not known on. The next think that finds the owner creates it again.
Remembers the entity as the flashlight of its owner and moves the light to the owner's eyes, along their view. The engine Think of a clientside entity runs every frame, so the light follows the owner without a delay. The light is removed while the owner is not valid, which happens for a moment after the entity arrives and once the owner has left.