Mapbase/Entities/Base Entity
This page lists Mapbase's changes to CBaseEntity, which every single entity in the Source engine derives from. This means every entity in Hammer technically possesses these changes, but whether they actually show up depend on how relevant the changes are to a certain entity. (e.g. "Enable/DisableDraw" is irrelevant on logic entities)
I/O/KV
Inputs
- PassUser1 <string >
- Causes this entity's OutUser1 output to be fired. Can pass any parameter.
- PassUser2 <string >
- Causes this entity's OutUser2 output to be fired. Can pass any parameter.
- PassUser3 <string >
- Causes this entity's OutUser3 output to be fired. Can pass any parameter.
- PassUser4 <string >
- Causes this entity's OutUser4 output to be fired. Can pass any parameter.
- FireRandomUser
- Fires OnUser1, OnUser2, OnUser3, or OnUser4 with a 25% chance of each.
- PassRandomUser <string >
- Fires OutUser1, OutUser2, OutUser3, or OutUser4 with a 25% chance of each. Can pass any parameter.
- SetTarget <targetname >
- A special new input designed to change an entity's "target", including things like path_track paths and env_gunfire targets. By default, this changes the common target keyvalue on entities. Some entities override SetTarget for their own keyvalues, e.g. scripted_sequence's target NPC. In code, this also calls Activate(), which is commonly used to assign m_target to cached entity handles.
- SetOwnerEntity <targetname >
- Sets this entity's "owner entity". Owner entities are mainly used for kill credit, and entities will typically never collide with their owner entity. Note that this has nothing to do with parenting.
- SetHealth <integer >
- Sets this entity's health. This input already existed on several entities, but now it's part of all entities.
- AddHealth/RemoveHealth <integer >
- Adds to/removes from this entity's health. These inputs already existed on props and func_breakables, but now they're part of all entities, including NPCs.
- SetMaxHealth <integer >
- Sets this entity's maximum health. This will not change the entity's current health unless it exceeds the new maximum, in which case the entity's health will be lowered down to the new maximum.
- FireOutput <string >
- Fires the named output on this entity. Format: <output name>:<activator>:<caller>:<parameter>:<delay> For example: OnDeath:my_entity:my_entity. Everything beyond the output name is optional.
- RemoveOutput <string >
- Removes all instances of the named output on this entity. Wildcards are supported, meaning you could just pass '*' to wipe all outputs from this entity.
- AcceptInput <string >
- Fires the named input on this entity. Format: <input name>:<parameter>:<activator>:<caller>:<output ID> Example: SetTarget:target_entity. Everything beyond the input name is optional. Note that this is arranged differently from FireOutput, having the parameter right after the input name.
- CancelPending
- Cancels any events fired by this entity that are currently pending in the I/O event queue. This input originated from logic_relay, but it's been promoted to a base input so any entity could cancel their outputs.
- FreeChildren
- Unparents all entities parented to this entity in a movement hierarchy.
- SetLocalOrigin <vector >
- Sets this entity's origin in local space, relative to its parent if one exists. Otherwise relative to the world.
- SetLocalAngles <vector >
- Set this entity's angles in local space, relative to its parent if one exists. Otherwise relative to the world.
- SetAbsOrigin <vector >
- Sets this entity's origin in the map, always relative to the world origin.
- SetAbsAngles <vector >
- Set this entity's angles, always relative to the world origin.
- SetLocalVelocity <vector >
- Sets this entity's current velocity.
- SetLocalAngularVelocity <vector >
- Sets this entity's current angular velocity.
- AddSpawnFlags <integer >
- Adds spawnflag(s) to this entity. Many spawnflags have their respective numbers suffixed in Mapbase's FGD.
- RemoveSpawnFlags <integer >
- Removes spawnflag(s) from this entity. Many spawnflags have their respective numbers suffixed in Mapbase's FGD.
- SetRenderMode <integer >
- Sets this entity's render mode.
- SetRenderFX <integer >
- Sets this entity's render FX.
- SetViewHideFlags <integer >
- Sets view ID hide flags. See the New nodraw abilities section for more information.}
- AddEffects <integer >
- Adds to this entity's effects flags.
- RemoveEffects <integer >
- Removes from this entity's effects flags.
- EnableDraw <void> (also in
)
- Draws this entity if it was undrawn before. Equivalent to RemoveEffects > 32.
- DisableDraw <void> (also in
)
- Undraws this entity if it was drawn before. Equivalent to AddEffects > 32.
- AddEFlags <integer >
- Adds EFlags to this entity.
- RemoveEFlags <integer >
- Removes EFlags from this entity.
- SetMoveType <integer >
- Sets this entity's movetype.
- SetCollisionGroup <integer >
- Sets this entity's collision group.
- AddSolidFlags <integer >
- Adds solid flags to this entity.
- RemoveSolidFlags <integer >
- Removes solid flags from this entity.
- Touch <targetname >
- Simulates the specified entity touching the entity receiving this input. (e.g. a trigger receiving this input with a player as the parameter will be triggered by that player)
- KillIfNotVisible <void>
- Kills this entity if it's not visible to any players.
- KillWhenNotVisible <float >
- Kills this entity when it's not visible to any players. The parameter is the delay before this is evaluated.
- SetThinkNull <void>
- Sets this entity's general think function to NULL. A string can be passed to clear the think of a specific context.
- ChangeVariable <string >
- A special version of AddOutput that changes a datadesc variable instead of a keyvalue, similar to logic_datadesc_accessor.
Outputs
- OutUser1 <string >
- Fires in response to PassUser1 input. Can pass any parameter.
- OutUser2 <string >
- Fires in response to PassUser2 input. Can pass any parameter.
- OutUser3 <string >
- Fires in response to PassUser3 input. Can pass any parameter.
- OutUser4 <string >
- Fires in response to PassUser4 input. Can pass any parameter.
KeyValues
- View ID nodraw (viewhideflags) <flags>
- Controls whether an entity shouldn't be drawn in specific parts of the view rendering process. See the New nodraw abilities section for more information.
- Disable flashlight (disableflashlight) <choices> (also in
)
- Used to disable flashlight (env_projectedtexture) lighting on this entity.
Note:This will not stop the entity from casting projected texture shadows. See the New nodraw abilities section for information on how to do that.
The owner entity can now be accessed with the OwnerEntity keyvalue and m_fFlags (an internal flag variable) can now be accessed with the aptly named m_fFlags keyvalue, but neither are actually used in any base FGD classes to avoid clutter.
New nodraw abilities
Mapbase adds a few new ways of turning an entity invisible:
- A SetRenderMode input which can be used to set an entity to the "Don't render" mode on the fly by using a parameter of 9.
- New Enable/DisableDraw inputs inspired by the inputs of the same name from
Portal 2.
- A new "view ID nodraw" feature that hides an entity in specific render contexts.
Each of these methods turn an entity invisible in different ways, and they each have their own tradeoffs. For example, using DisableDraw will prevent an entity's data from being transmitted to the client, while using the other methods will not.
The view ID nodraw ability is unique in the fact that it prevents drawing in specific passes from the view rendering process. For example, if an entity is set to not draw in VIEW_MONITOR, then that entity will not show up on RT camera monitors, but it will show up everywhere else.
View IDs are specified in a similar fashion to spawnflags, and combinations of them can be used. Here's a list of view IDs in base Source 2013:
- VIEW_MAIN : [1]
- The main view used for the default player camera.
- VIEW_3DSKY : [2]
- Used by the 3D Skybox.
- VIEW_MONITOR : [4]
- Used by point_camera screens.
- VIEW_REFLECTION : [8]
- Used by expensive water and func_reflective_glass to reflect the world.
- VIEW_REFRACTION : [16]
- Used by expensive water and func_reflective_glass to show underwater areas.
- VIEW_INTRO_PLAYER : [32]
- Used by script_intro's secondary camera view.
- VIEW_INTRO_CAMERA : [64]
- When a script_intro is active, the player uses this instead of VIEW_MAIN.
- VIEW_SHADOW_DEPTH_TEXTURE : [128]
- Used by env_projectedtexture and flashlight shadow maps. Hiding an entity in this view will stop it from casting projected texture shadows.
- VIEW_SSAO : [256]
- [Todo]
The FGD also provides some default presets:
- 0 : "Draw normally"
- 193 : "Hide in main view (player's eyes)" ( VIEW_MAIN + VIEW_INTRO_CAMERA + VIEW_SHADOW_DEPTH_TEXTURE )
- 36 : "Hide in cameras" ( VIEW_MONITOR + VIEW_INTRO_PLAYER )
- 24 : "Hide in mirrors/water" ( VIEW_REFLECTION + VIEW_REFRACTION )
- 60 : "Hide in cameras and mirrors/water" ( VIEW_MONITOR + VIEW_INTRO_PLAYER + VIEW_REFLECTION + VIEW_REFRACTION )
- 2 : "Hide in 3D skybox" ( VIEW_3DSKY )
- 128 : "Hide projected texture shadows" ( VIEW_SHADOW_DEPTH_TEXTURE )