Interface IEntitySystemService
Interface IEntitySystemService
Namespace: SwiftlyS2.Shared.EntitySystem
Assembly: SwiftlyS2.CS2.dll
public interface IEntitySystemServiceMethods
CreateEntity<T>()
Create an entity by class.
T CreateEntity<T>() where T : class, ISchemaClass<T>Returns
- T — Created entity.
Type Parameters
- T — Entity type.
Exceptions
- ArgumentException — Thrown when failed to create entity by class or class doesn't have a designer name.
CreateEntityByDesignerName<T>(string)
Create an entity by designer name.
T CreateEntityByDesignerName<T>(string designerName) where T : ISchemaClass<T>Parameters
- designerName string — Designer name.
Returns
- T — Created entity.
Type Parameters
- T — Entity type.
Exceptions
- ArgumentException — Thrown when failed to create entity by designer name or designer name is invalid.
GetAllEntities()
Get all entities.
IEnumerable<CEntityInstance> GetAllEntities()Returns
- IEnumerable<CEntityInstance> — All entities.
GetAllEntitiesByClass<T>()
Get all entities by class.
IEnumerable<T> GetAllEntitiesByClass<T>() where T : class, ISchemaClass<T>Returns
- IEnumerable<T> — All entities by class.
Type Parameters
- T — Entity type.
GetAllEntitiesByDesignerName<T>(string)
Get all entities by designer name, and cast to type T.
IEnumerable<T> GetAllEntitiesByDesignerName<T>(string designerName) where T : class, ISchemaClass<T>Parameters
- designerName string — Designer name.
Returns
- IEnumerable<T> — All entities by designer name.
Type Parameters
- T — Entity type.
GetEntityByIndex<T>(uint)
Get an entity by index.
T? GetEntityByIndex<T>(uint index) where T : class, ISchemaClass<T>Parameters
- index uint — Entity index.
Returns
- T? — Entity by index. Nullable.
Type Parameters
- T — Entity type.
GetGameRules()
Get the game rules entity.
CCSGameRules? GetGameRules()Returns
- CCSGameRules? — Game rules entity. Nullable.
GetRefEHandle<T>(T)
Get a reference handle to the entity.
CHandle<T> GetRefEHandle<T>(T entity) where T : class, ISchemaClass<T>Parameters
- entity T — Entity instance.
Returns
- CHandle<T> — Reference entity handle to the entity.
Type Parameters
- T — Entity type.
HookEntityOutput<T>(string, EntityOutputHandler)
Hooks an output of the specified entity type to a callback function.
Guid HookEntityOutput<T>(string outputName, IEntitySystemService.EntityOutputHandler callback) where T : class, ISchemaClass<T>Parameters
- outputName string — The name of the output to hook. This value cannot be null or empty.
- callback IEntitySystemService.EntityOutputHandler — The callback function to invoke when the output is triggered. This value cannot be null.
Returns
- Guid — A System.Guid that uniquely identifies the hook. This identifier can be used to manage or remove the hook.
Type Parameters
- T — The type of the entity, which must implement SwiftlyS2.Shared.Schemas.ISchemaClass%601.
Remarks
This method allows you to attach a handler to a specific output of an entity. The callback will be invoked whenever the output is triggered.
UnhookEntityOutput(Guid)
Removes the association between the specified entity output and its handler.
void UnhookEntityOutput(Guid guid)Parameters
- guid Guid — The unique identifier of the entity output to unhook.