point_spotlight
point_spotlight
is a point entity available in all Source games. It is a light_dynamic
with two glow sprite effects: a beam effect for viewers outside the light cone and a halo effect for viewers inside the cone.
The light_dynamic
functionality can be disabled with the 'No Dynamic Light' spawnflag. In that state, the spotlight will not actually illuminate other objects on its own and can be used with an accompanying light_spot
or env_projectedtexture
(newLight_Spot
if Black Mesa) instead.
Code: By default, point_spotlight uses the material sprites/glow_test02.vmt. You can change this if you are shipping your own binaries by going into point_spotlight.cpp in the server project, navigating to line 351 and replacing the file path with your own material.
Note:This entity creates an
env_beam
and a spotlight_end
to accomplish its sprite effects. This means a single point_spotlight
actually represents three different entities, including the point_spotlight
itself. All of these contribute to the entity limit.Todo: Define a way to set a custom materials through this ents keyvalues
Warning:This entity generates 3 edicts (for itself, the beam visual and beam target respectively:
point_spotlight, beam, spotlight_end
! In Team Fortress 2 and Garry's Mod, the point_spotlight
itself has been converted to a server-only edict (does not take up an edict), and in Team Fortress 2, when no targetname and parentname is assigned, the point_spotlight
and spotlight_end
entity is also killed, thus consuming 1 edict in total for a static spotlight.Warning:In Black Mesa if this entity does not use the
No Dynamic Light
spawnflag then it will create dynamic Deferred lighting instead of using lightmaps.Note:
env_beam
collides only with prop_static and world geometry, this means that beam of point_spotlight and dynamic light will ignore any dynamic objects (with the exception of func_physbox), NPCs, physics objects, e.t.c.Bug:In Black Mesa keyvalue
Render FX / Transparency (0 - 255)
not functional at all, use HDR color scale.
instead.Note:In Alien Swarm Deferred this entity is not supported and on loading a map all point_spotlight entities will be converted to Light deferred!
Contents
Keyvalues
- Spotlight Length (spotlight_length) <integer>
- Length of the spotlight beam.
- Spotlight Width (spotlight_width) <integer>
- Width of the spotlight beam.
- Color (R G B) (rendercolor) <color255>
- Spotlight color.
- HDR color scale. (HDRColorScale) <float>
- Float value to multiply sprite color by when running in HDR mode.
- Halo size scale. (HaloScale) <float> (in all games since )
- Float value to determine the size of the halo.
Targetname:
- Name
(targetname)
<string> - The targetname that other entities refer to this entity by.
Parentname:
- Parent
(parentname)
<targetname> - Specifies a movement parent. An entity will maintain its initial offset from its parent. An attachment point can be added to the end of the name, separated by a comma.
RenderFields:
- Render Mode
(rendermode)
<choices> - Set a non-standard rendering mode on this entity.
- Render FX
(renderfx)
<choices> - Various somewhat legacy alpha effects.
Bug:Alpha effects from 0 to 10 are unavailable due to the bug in code in Counter-Strike: Global Offensive
|
- Render FX / Transparency (0 - 255)
(renderamt)
<integer> - Transparency amount, requires a Render Mode other than Normal. 0 is invisible, 255 is fully visible.
- Render Color (R G B)
(rendercolor)
<color255> - Color tint.
- Disable Receiving Shadows
(disablereceiveshadows)
<boolean> - Prevent the entity from receiving shadows on itself.
Angles:
- Pitch Yaw Roll (Y Z X)
(angles)
<angle> - This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
DXLevelChoice:
- Minimum / Maximum DX Level
(mindxlevel / maxdxlevel)
<choices> (removed since ) - The entity will not exist if the engine is running outside the given range of DirectX Versions.
Warning:If these are used, the object may break when the user switches their DirectX settings.
|
SystemLevelChoice:
- Minimum / Maximum Effect Details Level
(mincpulevel / maxcpulevel)
<choices> (in all games since ) - Don't render for players with Effect Details levels that exceed the minimum or maximum.[Key names are related to
cpu_level
cvar used by Effect Details.]
|
- Minimum / Maximum Shader Details Level
(mingpulevel / maxgpulevel)
<choices> (in all games since ) - Don't render for players with Shader Details levels that exceed the minimum or maximum.[Key names are related to
gpu_level
cvar used by Shader Details.]
|
Flags
- [
1
] : Start On
- [
2
] : No Dynamic Light
Inputs
LightOn
- Turn the spotlight on.
LightOff
- Turn the spotlight off.
SetColor
<color255> (in all games since ) (also in )- Change the color of the spotlight. Light must be turned off then back on for dynamic light to update.
- Note:Functionally identical to the Color input. A delay of at least 0.01 is required before the spotlight is turned back on, or else it will remain off.
ForceUpdate
(in all games since ) (also in )- Force an update of the spotlight position and orientation.
Base:
AddContext
<string>- Adds to the entity's list of response contexts. See Context.
AddOutput
<string>- Assigns a new keyvalue/output on this entity. For keyvalues, some rely on extra necessary code to be ran and won't work if its simply just changed through this input. There is a strict format that must be followed:
// Format of changing KeyValues: "AddOutput [key] [value]"
//// Raw text:
"OnUser1" "!self,AddOutput,targetname new_name"
// Format of adding an Output: "AddOutput {targetname}:{inputname}:{parameter}:{delay}:{max times to fire, -1 means infinite}"
//// Raw text:
"OnUser1" "!self,AddOutput,OnUser1:SetParent:!activator:0.0:-1"
// Arguments can be left blank, but the empty blank should still be contained.
//// Raw text:
"OnUser1" "!self,AddOutput,OnUser1:ClearParent::0.0:-1"
|
ClearContext
- Removes all contexts from this entity's list.
ClearParent
- Removes this entity from the the movement hierarchy, leaving it free to move independently.
FireUser1
toFireUser4
- Fires the respective
OnUser
outputs; see User Inputs and Outputs.
Kill
- Removes this entity and any entities parented to it from the world.
KillHierarchy
- Functions the same as
Kill
, although this entity and any entities parented to it are killed on the same frame, being marginally faster thanKill
input.
RemoveContext
<string>- Remove a context from this entity's list. The name should match the key of an existing context.
SetParent
<string>- Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment
<string>- Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset
<string>- As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
DispatchResponse
<string> !FGD- Dispatches a response to the entity. See Response and Concept.
DispatchEffect
<string> (removed since ) !FGD- Dispatches a special effect from the entity's origin; See also List of Client Effects. Replaced by the particle system since .
RunScriptFile
<script> (in all games since ) (also in )- Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode
<string> (in all games since ) (also in )- Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console. Bug:In Hammer, using string arguments will corrupt the VMF file's structure, making the file unviewable for the next Hammer session.Fix:Remove the string argument manually with a text editor.
CallScriptFunction
<string> (in all games since ) (also in ) !FGD- Calls a VScript function defined in the scope of the receiving entity.
TerminateScriptScope
(only in ) !FGD- Destroys the script scope of the receving entity.
SetLocalOrigin
<coordinates> (in all games since ) !FGD- Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
Parentname:
SetParent
<string>- Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment
<string>- Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset
<string>- As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
ClearParent
- Removes this entity from the the movement hierarchy, leaving it free to move independently.
RenderFields:
Alpha
<integer 0–255>- Sets the entity's transparency to a number from 0 (invisible) to 255 (fully visible). Requires the entity to have its
rendermode
set to a number other than0
.
Color
<color255>- Sets an RGB color for the entity.
Outputs
OnLightOn
- Fires when light turns on.
OnLightOff
- Fires when light turns off.
Targetname:
OnUser1
toOnUser4
- These outputs each fire in response to the firing of the like-numbered
FireUser1
toFireUser4
Input; see User Inputs and Outputs.