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>- T — Created entity.
- T — Entity type.
- ArgumentException — Thrown when failed to create entity by class or class doesn't have a designer name.
- InvalidOperationException — Thrown when called too early that entity system is not valid at this moment.
CreateEntityByDesignerName<T>(string)
Create an entity by designer name.
T CreateEntityByDesignerName<T>(string designerName) where T : class, ISchemaClass<T>- designerName string — Designer name.
- T — Created entity.
- T — Entity type.
- ArgumentException — Thrown when failed to create entity by designer name or designer name is invalid.
- InvalidOperationException — Thrown when called too early that entity system is not valid at this moment.
GetAllEntities()
Get all entities.
IEnumerable<CEntityInstance> GetAllEntities()- IEnumerable<CEntityInstance> — All entities.
- InvalidOperationException — Thrown when called too early that entity system is not valid at this moment.
GetAllEntitiesByClass<T>()
Get all entities by class.
IEnumerable<T> GetAllEntitiesByClass<T>() where T : class, ISchemaClass<T>- IEnumerable<T> — All entities by class.
- T — Entity type.
- InvalidOperationException — Thrown when called too early that entity system is not valid at this moment.
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>- designerName string — Designer name.
- IEnumerable<T> — All entities by designer name.
- T — Entity type.
- InvalidOperationException — Thrown when called too early that entity system is not valid at this moment.
GetEntityByAddress<T>(nint)
Get an entity by address.
T? GetEntityByAddress<T>(nint address) where T : class, ISchemaClass<T>- address nint — Entity address.
- T? — Entity by address. Nullable.
- T — Entity type.
- InvalidOperationException — Thrown when called too early that entity system is not valid at this moment.
- InvalidOperationException — Thrown when the entity is not of type T.
GetEntityByAddress(nint)
Get an entity by address.
CEntityInstance? GetEntityByAddress(nint address)- address nint — Entity address.
- CEntityInstance? — Entity by address. Nullable.
- InvalidOperationException — Thrown when called too early that entity system is not valid at this moment.
GetEntityByIndex<T>(uint)
Get an entity by index.
T? GetEntityByIndex<T>(uint index) where T : class, ISchemaClass<T>- index uint — Entity index.
- T? — Entity by index. Nullable.
- T — Entity type.
- InvalidOperationException — Thrown when called too early that entity system is not valid at this moment.
- InvalidOperationException — Thrown when the entity is not of type T.
GetEntityByIndex(uint)
Get an entity by index. The object return will have the actual type of the entity. You can cast it to the actual type.
CEntityInstance? GetEntityByIndex(uint index)- index uint — Entity index.
- CEntityInstance? — Entity by index. Nullable.
- InvalidOperationException — Thrown when called too early that entity system is not valid at this moment.
GetGameRules()
Get the game rules entity.
CCSGameRules? GetGameRules()- CCSGameRules? — Game rules entity. Nullable.
- InvalidOperationException — Thrown when called too early that entity system is not valid at this moment.
GetRefEHandle<T>(T)
Get a reference handle to the entity.
CHandle<T> GetRefEHandle<T>(T entity) where T : class, ISchemaClass<T>- entity T — Entity instance.
- CHandle<T> — Reference entity handle to the entity.
- T — Entity type.
- InvalidOperationException — Thrown when called too early that entity system is not valid at this moment.
HookEntityInput<T>(string, EntityInputEventHandler)
Hooks an input of the specified entity type to a callback function.
Guid HookEntityInput<T>(string inputName, IEntitySystemService.EntityInputEventHandler callback) where T : class, ISchemaClass<T>- inputName string — The name of the input to hook. This value cannot be null or empty.
- callback IEntitySystemService.EntityInputEventHandler — The callback function to invoke when the input is accepted. This value cannot be null.
- Guid — A System.Guid that uniquely identifies the hook. This identifier can be used to remove the hook.
- T — The type of the entity, which must implement SwiftlyS2.Shared.Schemas.ISchemaClass%601.
This method allows you to attach a handler to a specific input of an entity. The callback will be invoked whenever the input is accepted.
HookEntityInput(string, string, EntityInputEventHandler)
Hooks an input of the specified entity type to a callback function.
Guid HookEntityInput(string designerName, string inputName, IEntitySystemService.EntityInputEventHandler callback)- designerName string — The designer name of the entity to hook. This value cannot be null or empty.
- inputName string — The name of the input to hook. This value cannot be null or empty.
- callback IEntitySystemService.EntityInputEventHandler — The callback function to invoke when the input is accepted. This value cannot be null.
- Guid — A System.Guid that uniquely identifies the hook. This identifier can be used to remove the hook.
This method allows you to attach a handler to a specific input of an entity. The callback will be invoked whenever the input is accepted.
HookEntityOutput<T>(string, EntityOutputEventHandler)
Hooks an output of the specified entity type to a callback function.
Guid HookEntityOutput<T>(string outputName, IEntitySystemService.EntityOutputEventHandler callback) where T : class, ISchemaClass<T>- outputName string — The name of the output to hook. This value cannot be null or empty.
- callback IEntitySystemService.EntityOutputEventHandler — The callback function to invoke when the output is triggered. This value cannot be null.
- Guid — A System.Guid that uniquely identifies the hook. This identifier can be used to remove the hook.
- T — The type of the entity, which must implement SwiftlyS2.Shared.Schemas.ISchemaClass%601.
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.
HookEntityOutput(string, string, EntityOutputEventHandler)
Hooks an output of the specified entity type to a callback function.
Guid HookEntityOutput(string designerName, string outputName, IEntitySystemService.EntityOutputEventHandler callback)- designerName string — The designer name of the entity to hook. This value cannot be null or empty.
- outputName string — The name of the output to hook. This value cannot be null or empty.
- callback IEntitySystemService.EntityOutputEventHandler — The callback function to invoke when the output is triggered. This value cannot be null.
- Guid — A System.Guid that uniquely identifies the hook. This identifier can be used to remove the hook.
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.
UnhookEntityInput(Guid)
Removes the association between the specified entity input and its handler.
bool UnhookEntityInput(Guid guid)- guid Guid — The unique identifier of the entity input to unhook.
UnhookEntityOutput(Guid)
Removes the association between the specified entity output and its handler.
bool UnhookEntityOutput(Guid guid)- guid Guid — The unique identifier of the entity output to unhook.