This article's documentation is for anything that uses the Source engine. Click here for more information.

Env entity maker: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(I'm not stalking you, XFunc_CaRteR. Just in case you were wondering :P Removed "Usage" bit. It was unnecessary.)
 
(17 intermediate revisions by 12 users not shown)
Line 1: Line 1:
{{base point|env_entity_maker}} It spawns the specified [[entity]] [[point_template|template]] at the env_entity_maker's [[origin]]. If set to auto-spawn, it will spawn the template whenever there's room and the player is looking elsewhere.
{{LanguageBar}}
{{this is a|point entity|name=env_entity_maker|sprite=1}} <!-- Add the categories to the main page, not here -->
 
{{CD|CEnvEntityMaker|file1=env_entity_maker.cpp}}
It spawns a specified point_template entity at the {{ent|env_entity_maker}}'s [[origin]]. It can be set to spawn automatically or through inputs.<br>
One of the main benefits is that the {{ent|env_entity_maker}} can be parented to an entity, so that the ultimately spawning entities will spawn dynamically wherever the {{ent|env_entity_maker}} happens to be.<br>
This could be used to spawn things on top of a [[func_tracktrain]] or similar moving entity.<br>
 
For further clarification:<br>
When this entity is spawned, it forces the {{ent|point_template}} to be teleported to the {{ent|env_entity_maker}}'s location. And if <code>PostSpawn Inherit Angles</code> is set, the rotation is also copied.<br>
The {{ent|point_template}} acts as a parent to all the entities it spawns, which in turn will cause every other entity to be teleported as well.<br>
This allows you to build one setup of entities where {{ent|point_template}} acts as the origin, and then use {{ent|env_entity_maker}} to spawn this setup anywhere on the map. Similar to how [[func_instance]] works.<br>
If you were to place the {{ent|point_template}} in the same spot as the {{ent|env_entity_maker}} to begin with, no movement will happen.
 
== Flags ==
{{fl|1|Enable AutoSpawn Spawn template whenever there's enough room to fit it, and the player is not looking.}}
{{fl|2|AutoSpawn: Wait for entity to be destroyed.}}
{{fl|4|AutoSpawn: Spawn even if the player is looking.}}
{{fl|8|ForceSpawn: Spawn only if there's enough room to fit the object.}}
{{fl|16|ForceSpawn: Spawn only if the player isn't looking.}}


== Keyvalues ==
== Keyvalues ==
{{KV|Point_template To Spawn|target_destination|Name of the [[point_template]] to spawn '''here'''.}}
{{KV|PostSpawn Movement Speed|float|If specified, all the entities created in the template will move this fast in the specified PostSpawn Movement Direction.}}
{{KV|PostSpawn Movement Direction|angle|If a PostSpawn Movement Speed is specified, all the entities created in the template will move in this direction.}}
{{KV|PostSpawn Direction Variance|float|This variance is applied to the PostSpawn Movement Direction for each spawned entity in the template. Use it to apply some randomness to the directions.}}
{{KV|PostSpawn Inherit Angles|boolean|If in hierarchy, is spawn direction in world space, or object local space of parent}}
{{KV Targetname}}
{{KV Targetname}}
{{KV Parentname}}
{{KV|Point_template To Spawn|intn=EntityTemplate|target_destination|Name of the <code>point_template</code> to spawn here. If there is an offset between the <code>point_template</code> and its spawned entities in hammer, that offset will be maintained when spawning happens relative to the <code>env_entity_maker</code>.}}
{{KV Angles}}
{{KV|PostSpawn Movement Speed|intn=PostSpawnSpeed|float|All entities spawned will move this many [[hammer units]] per second in the direction of '''PostSpawn Movement Direction'''.}}
 
{{KV|PostSpawn Movement Direction|intn=PostSpawnDirection|angle|If a PostSpawn Movement Speed is specified, this angle will be added to the movement direction of all the entities created by the template.}}
== Flags ==
{{KV|PostSpawn Direction Variance|intn=PostSpawnDirectionVariance|float|The '''PostSpawn Movement Direction''' may vary by this many degrees. This is a radius.}}
:* 1 : Enable AutoSpawn (will spawn whenever there's room)
{{KV|PostSpawn Inherit Angles|intn=PostSpawnInheritAngles|boolean|If checked, uses the parent's forward vector as the spawn direction. Otherwise uses the <code>env_entity_maker</code>'s forward.}}
:* 2 : AutoSpawn: Wait for entity destruction
:* 4 : AutoSpawn: Even if the player is looking
:* 8 : ForceSpawn: Only if there's room
:* 16 : ForceSpawn: Only if the player isn't looking


== Inputs ==
== Inputs ==
{{IO|ForceSpawn|Spawn an instance of the template at this origin and angle.}}
{{I|ForceSpawn|Spawn an instance of the template at this origin and angle.}}
{{IO|ForceSpawnAtEntityOrigin|Spawn an instance of the template that the same origin and angle as the specified entity (specify by targetname in parameters)|param=target_destination}}
{{I|ForceSpawnAtEntityOrigin|param=target_destination|Spawn an instance of the template at the same origin and angles as a specified entity.
{{I Targetname}}
:{{note|Supports [[Targetname#Keywords|special targetnames]].}}
{{I Parentname}}
}}


== Outputs ==
== Outputs ==
{{IO|OnEntitySpawned|Fired when an instance of the entity template has been spawned.}}
{{O|OnEntitySpawned|activator = !caller = !self|caller=hide|Fired when an instance of the entity template has been spawned.}}
{{IO|OnEntityFailedSpawn|Fired when a <code>ForceSpawn</code> input failed to spawn the template, either due to lack of space or being in player's view, depending on the spawnflags.}}
{{O|OnEntityFailedSpawn|activator = !caller = !self|caller=hide|Fired when a <code>ForceSpawn</code> input failed to spawn the template, either due to lack of space or being in player's view, depending on the spawnflags.}}
{{O Targetname}}
 
== See Also ==
* {{ent|point_template}}

Latest revision as of 01:20, 24 April 2025

English (en)Русский (ru)中文 (zh)Translate (Translate)
Env entity maker.png

env_entity_maker is a point entity available in all Source Source games.

C++ Class hierarchy
CEnvEntityMaker
CPointEntity
CBaseEntity
C++ env_entity_maker.cpp

It spawns a specified point_template entity at the env_entity_maker's origin. It can be set to spawn automatically or through inputs.
One of the main benefits is that the env_entity_maker can be parented to an entity, so that the ultimately spawning entities will spawn dynamically wherever the env_entity_maker happens to be.
This could be used to spawn things on top of a func_tracktrain or similar moving entity.

For further clarification:
When this entity is spawned, it forces the point_template to be teleported to the env_entity_maker's location. And if PostSpawn Inherit Angles is set, the rotation is also copied.
The point_template acts as a parent to all the entities it spawns, which in turn will cause every other entity to be teleported as well.
This allows you to build one setup of entities where point_template acts as the origin, and then use env_entity_maker to spawn this setup anywhere on the map. Similar to how func_instance works.
If you were to place the point_template in the same spot as the env_entity_maker to begin with, no movement will happen.

Flags

Enable AutoSpawn Spawn template whenever there's enough room to fit it, and the player is not looking. : [1]
AutoSpawn
Wait for entity to be destroyed. : [2]
AutoSpawn
Spawn even if the player is looking. : [4]
ForceSpawn
Spawn only if there's enough room to fit the object. : [8]
ForceSpawn
Spawn only if the player isn't looking. : [16]

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Point_template To Spawn (EntityTemplate) <targetname>
Name of the point_template to spawn here. If there is an offset between the point_template and its spawned entities in hammer, that offset will be maintained when spawning happens relative to the env_entity_maker.
PostSpawn Movement Speed (PostSpawnSpeed) <float>
All entities spawned will move this many hammer units per second in the direction of PostSpawn Movement Direction.
PostSpawn Movement Direction (PostSpawnDirection) <angle>
If a PostSpawn Movement Speed is specified, this angle will be added to the movement direction of all the entities created by the template.
PostSpawn Direction Variance (PostSpawnDirectionVariance) <float>
The PostSpawn Movement Direction may vary by this many degrees. This is a radius.
PostSpawn Inherit Angles (PostSpawnInheritAngles) <boolean>
If checked, uses the parent's forward vector as the spawn direction. Otherwise uses the env_entity_maker's forward.

Inputs

ForceSpawn
Spawn an instance of the template at this origin and angle.
ForceSpawnAtEntityOrigin <targetnameRedirectInput/string>
Spawn an instance of the template at the same origin and angles as a specified entity.
Note.pngNote:Supports special targetnames.

Outputs

OnEntitySpawned
!activator = !caller = !self
Fired when an instance of the entity template has been spawned.
OnEntityFailedSpawn
!activator = !caller = !self
Fired when a ForceSpawn input failed to spawn the template, either due to lack of space or being in player's view, depending on the spawnflags.

See Also