Entities - Hirato/lamiae GitHub Wiki

Entities are split into two sections, Engine side entities and Game side entities. For convenience they are arranged in the order they are defined.

General Editing Tips

All entities have a variable number of attributes, the king of the hill is currently Particles at 8 attributes. These attributes are stores as integers and can have values ranging from INT_MIN to INT_MAX.

For easily editing, you can hold down the respective number of the attribute and scroll to change it. eg, hold 2 and scroll to edit the second attribute

Some entities also have directional components, typically if the first attribute is Yaw, you and hold R and scroll and change the direction in 15 degree increments.

All entities also have a quickedit menu you can access via F3 which will provide additional context and easy means of changing the variables.

The PERIOD key is bound to saycommand /entset (entget) which allows for very quick and easy setting of all entity attributes, do be warned that this method like the above will set them for ALL entities in the selection!

Another handy feature is entloop, If you have a bunch of entities selected and you only want to toy with one of their attributes, and not all of them, you can use entloop to cycle through them individually to make changes. Let's assuming you have hundreds of unique trees selected and you want to give each and everyone a random direction...

entloop [
	entattr 0 (rnd 360)
]

This also brings us to entattr n [newval], and enttype [newtype], commands which can be used to query the respective detail, or if a new value is provided, to set them

Engine

(Empty?)

This is a special entity which has no attributes. These are usually the result of a faulty call to change the entity's type.

Empty entities are deleted when their focus is lost, as well as on map save. If they're important to you, it's vital that you change them to something that will persist.

Light

light:
	attr1: Radius
	attr2: Red
	attr3: Green
	attr4: Blue
	attr5: Flags
	attr6: light_# script tag

The Radius can be a value from 0 to well beyond. None of the numbers are considered special, but values <= 0 are considered to be off. Historically the value of 0 was used to create sunlight, if you have any of these lights, consider changing them into a proper sunlight

RGB values can be positive to add light to the region, or negative to drain light from the region. The produced light is clamped to prevent it from washing out the world in white. Note that RGB values of (0, 0, 0), while invisible, will still do full cost shadow passes

The following flags are available for use with the light entities. To use them, simply do a summation of the desired flags.

L_NOSHADOW = 1
L_NODYNSHADOW = 2

L_NOSHADOW disables hit-testing. This makes lighting significantly cheaper as no expensive shadow passes need to be made, and it also frees up room in the shadow atlas for other lights to use.

L_NODYNSHADOW disables shadow updates. Basically it generates a shadowmap from world geometry and the mapmodels, but it never updates it to reflect any changes such as mapmodel animations. Game entities such as the player are not given shadows by these lights.

The light script goes by the form light_1 = [result [64 255 0 0]] and is only considered when attr6 is non-zero. The script is executed and the results are cached between frames. Up to 4 values can be provided, any extras are ignored and silently dropped, and these respectively override the associated light's radius and RGB values if present.

One very important thing to note with the light_# scripts. If you're using this to turn lights on and off, do NOT use (0, 0, 0) for the RGB colours. The reasons for this are explained above, but the short of it is, they won't turn off the lights!

See also: Spotlight

Map model

mapmodel:
	attr1: Model
	attr2: Yaw
	attr3: Pitch
	attr4: Roll
	attr5: Size

Player start

playerstart:
	attr1: Yaw
	attr2: Tag

The Tag is a leftover component from the FPS game component that comes with the cube 2 engine, and was used to define the team associated of the entity.

Environment map

envmap:
	attr1: Radius
	attr2: Size
	attr3: Blur

Radius overrides the radius as defined by envmapradius, There's no limit, but it defines the radius in which the envmap generated here will be used for fake reflections. These fake reflections are present on mapmodels and the glass material

Size overrides the size as defined by envmapsize, and can be within the range of 4 to 9. The value is otherwise clamped.

Blur enables either a 3x3 or a 5x5 blur on the envmap texture. This is basically there to reduce aliasing.

Particles

particles:
	attr1: Type
	attr2: ???
	attr3: ???
	attr4: ???
	attr5: ???
	attr6: ???
	attr7: ???
	attr8: ???
	attr9: particles_# tag

The effects of attributes 2-8 vary wildly based on the value of the type. You can find a description of them and their effects below.

The other varies wildly and is inconsistent across types. Use the F3 quickedit menu or the text helper to your advantage. Also remember that by default the particles will be drawn as you're editing, so you'll see the effects reflected in real time.

The particles_#tag acts very much the same as the light_# tag, if not-zero, these will override up to the first 8 attributes for the particles entity.

Plume (0-2)

Types:
	0: Fire and smoke
	1: Fire plume
	2: Smoke plume

particles:
	attr1: Type
	attr2: Radius
	attr3: Height
	attr4: Colour
	attr5: Scale
	attr6: Velocity
	attr7: Fade-Time
	attr8: Gravity
	attr9: particles_# tag

Type 0 is a combination of both 1 and 2, and spawns the respective particles with suitable defaults.

Types 1 and 2 require you to explicitly set the Radius and Height, lest they be invisible.

Note that Gravity refers to ticks. lowers gravity levels like 1 or -1 will cause rapid acceleration. larger values like 50 will accelerate much more slowly.

Basic (3-4)

Types:
	3: Steam Vent
	4: Water Fountain

particles:
	attr1: Type
	attr2: Orientation
	attr3: Radius
	attr4: Fade-Time
	attr5: Scale
	attr6: Gravity
	attr7: -
	attr8: -
	attr9: particles_# tag

Orientation is a value from 0-5, and it aligns the emission vector along an axis, going a certain direction from the entity. The axis are as follows.

Orientation
	0: +Z
	1: +Y
	2: +X
	3: -Z
	4: -Y
	5: -X

Explosion (5)

Types:
	5: Fireball

particles:
	attr1: Type
	attr2: Radius
	attr3: Colour
	attr4: -
	attr5: -
	attr6: -
	attr7: -
	attr8: -
	attr9: particles_# tag

Meter (6-7)

Types:
	6: Capture
	7: Versus

particles:
	attr1: Type
	attr2: Percentage
	attr3: Primary Colour
	attr4: Secondary Colour
	attr5: -
	attr6: -
	attr7: -
	attr8: -
	attr9: particles_# tag

Note that the secondary colour is only used with the Versus variety.

Text (8)

Types:
	8: Text

particles:
	attr1: Type
	attr2: part_text_# Tag
	attr3: Colour
	attr4: Scale
	attr5: -
	attr6: -
	attr7: -
	attr8: -
	attr9: particles_# tag

part_text_# is the name of an alias containing a text string. The string is not executed and is displayed verbatim.

Multi-Effect (9-15)

Types:
	9:  Flare (aka tapeworm)
	10: Lightning
	11: Fireballs
	12: Steam
	13: Water (c)
	14: Snow (c)
	15: Leaves (c)

particles:
	attr1: Type
	attr2: Orientation/Effect
	attr3: Length/Width
	attr4: Colour
	attr5: Fade-Time
	attr6: Scale
	attr7: Velocity
	attr8: Gravity
	attr9: particles_# tag

Orientation

Orientation types have the orientation/effect field set to something below 256. Much like the effects describes for types 3-4. Attributes 5 and 7 are unused for this type.

Also note that with the exception of the Flare and Lightning particles, the fast majority of these are meant to be used as the other variant.

Effect

The effect types are available when attribute 2 is above 256. It is essentially done as a bitwise function against the number.

The number is first put through a bitwise-and with the value 31, the result of this determines the effect's shape from the table below. if the 32-bit is true, the direction is inverted. Eg, for the circle, particles will travel inwards from the circumference, rather than outwards from the centre.

0  - 2  - Circles
3  - 5  - Cylinder
6  - 11 - Cone
12 - 14 - Cubic Volume
15 - 20 - Planar Wall
21 - 23 - Sphere
24 - 26 - Flat Plane
27 - 31 - nil, stay in place.

Some flags are also supported. These are governed by the bits for values 32, and 64.

32: This flips the to and from positions, effectively causing the particles to travel the reverse of their route. (eg, inwards instead of outwards)

64: Turns on "taper" - This basically throttles particle emissions of distant entities rather than disabling them outright when the distance threshold is reached. Essentially letting them fade out instead of pop out.

Also worth noting, negative fade time enables collision for the particles that support it. Supported particles are annotated with (c) above.

Additionally, Flare/Lighting types interact really poorly with Velocity and Gravity, setting them is ill-advised in these circumstances, but looks really cool!

Lens-Flare (32-35)

Types:
	32: Normal
	33: Sparkly
	34: Fixed-Size
	35: Fixed-Size + Sparkly

particles:
	attr1: Type
	attr2: Red
	attr3: Green
	attr4: Blue
	attr5: Size
	attr6: -
	attr7: -
	attr8: -
	attr9: particles_# tag

The type is essentially a bitwise function, bit 1 turns on sparkle, bit 2 registers it as a "sun", aka gives it a fixed size.

RGB values are clamped between 0 and 255.

Map Sound

sound:
	attr1: Index
	attr2: Radius
	attr3: Fade-Radius

Spotlight

spotlight:
	attr1: Angle

Lights and Spotlights are the only two entities that can be linked. The linking is implicit and done automatically when the spotlight is added, and on map load. To direct the spotlight, the spotlight entity is moved around and acts as a focal point for the light.

The links are not saved, and spotlights will always attach to the closest light!

Game

Teleport Destination

teledest:
	attr1: Yaw
	attr2: Tag

These serve as destination markers for the r_teleport command, for more information, see Scripting.

Jump pad

jumppad:
	attr1: Z-vel
	attr2: Y-vel
	attr3: X-vel
	attr4: Radius

Multiply the given velocities by 10, and this is the velocity added to any entity that comes within its radius. There is a brief cooldown period to avoid rapid and deadly acceleration.

Checkpoint

checkpoint:
	attr1: Yaw
	attr2: Tag
	attr3: Radius

If you hit one of these entities, the checkpoiint will be explicitly set to respawn you here.You can set this manually with the setcheckpoint map tag command.

Spawn

spawn:
	attr1: Yaw
	attr2: Radius
	attr3: Tag

These can be used to spawn arbitrary game entities into the game world via the r_spawn_* family of commands. For more information, see Scripting.

Location

location:
	attr1: Tag
	attr2: Radius

These entities serve as markers for the AI. For more information, see AI Directives.

Blip (Unimplemented)

This entity is currently not functional.

Camera

camera:
	attr1: tag
	attr2: yaw
	attr3: pitch
	attr4: roll

The camera entity is only useful in cutscenes. It is used both to mark locations and possible camera configurations. This information is used by cs_action_viewcamera and cs_action_movecamera to manipulate the camera.

For more information, see Cutscenes.

Platform Route

platformroute:
	attr1: Tag

These entities serve as a destination marker for platforms. For more information, see Configuration.

Critter

critter:
	attr1: Yaw
	attr2: Index

These entities serve as an initial spawn marker for critters. These are spawned only when the map is initialised. The name of the critter to spawn is set via the spawnname command. For more information, see Configuration.

Item

item:
	attr1: Yaw
	attr2: Index
	attr3: Quantity

These entities serve as an initial spawn marker for items with a specific quantity. These are spawned only when the map is initialised. The name of the item to spawn is set via the spawnname command. For more information, see Configuration.

Obstacle

obstacle:
	attr1: Yaw
	attr2: Index

These entities serve as an initial spawn marker for obstacles. These are spawned only when the map is initialised. The name of the obstacle to spawn is set via the spawnname command. For more information, see Configuration.

Container

container:
	attr1: Yaw
	attr2: Index

These entities serve as an initial spawn marker for containers. These are spawned only when the map is initialised. The name of the container to spawn is set via the spawnname command. For more information, see Configuration.

Platform

platform:
	attr1: Yaw
	attr2: Index

These entities serve as an initial spawn marker for platforms. These are spawned only when the map is initialised. The name of the platform to spawn is set via the spawnname command. For more information, see Configuration.

Trigger

trigger:
	attr1: Yaw
	attr2: Index

These entities serve as an initial spawn marker for triggers. These are spawned only when the map is initialised. The name of the item to trigger is set via the spawnname command. For more information, see Configuration.

AreaTrigger

areatrigger:
	attr1; X-rad
	attr2; Y-rad
	attr3; Z-rad
	attr4; Flags
	attr5; Period Time

These entities defines a rectangular area that acts as a trigger based on certain flags. The Period Time attribute is used to set the period if the AT_ONFIXEDPERIOD flag is set. When triggered, it sends a named signal based on its flags. The name of the signal can be set via the spawnname command.

flags:
	0x000001	AT_SIGNALMAP       (default)
	0x000002	AT_SIGNALCRITTER

	0x000100	AT_ONENTRY         (default)
	0x000200	AT_ONEXIT          (default)
	0x000400	AT_ONFIXEDPERIOD
	0x000800	AT_ONFRAME

	0x010000	AT_TESTPLAYER      (default)
	0x020000	AT_TESTCRITTERS
	0x040000	AT_TESTEXTERNAL