Class EntityFactory
Namespace: ValveResourceFormat.Renderer.Entities
Assembly: Renderer.dll
Turns a classname into a live entity. Source's entity factory dictionary: every simulated classname registers here, and anything absent from the table is not one the entity system implements.
public static class EntityFactoryInheritance
Remarks
The table is filled in statically rather than by scanning types, to stay trim-safe and AOT-compatible. Add a classname here and hands it to instead of loading it as a static scene node.
Methods
Create(EntitySystem, EntitySpawnInfo)
Creates and spawns the entity for a classname. The entity is fully set up when this returns, but is not in the world yet; is what puts it there.
public static BaseEntity? Create(EntitySystem system, EntitySpawnInfo spawnInfo)Parameters
system EntitySystem
spawnInfo EntitySpawnInfo
Returns
The spawned entity, or null when the classname is not implemented.
IsRegistered(string)
Whether this classname is simulated by the entity system.
public static bool IsRegistered(string classname)Parameters
classname string
Returns
Register<T>(string, EntityCreator)
Registers a classname the entity system should simulate, and builds the entity class's table of
handlers. Safe to call while maps are loading, though the staticconstructor below is where the entity system's own classnames are declared.
public static void Register<T>(string classname, EntityCreator creator) where T : BaseEntityParameters
classname string
The classname to link, matched case-insensitively.
creator EntityCreator
Constructs the entity.
Type Parameters
T
The entity class the classname spawns.

