swiftlys2/docs/api/ai/
API Reference Services

IEngineService

Interface
Namespace: SwiftlyS2.Shared.Services · Assembly: SwiftlyS2.CS2.dll
public interface IEngineService
View source

Properties

GlobalVars

Gets a reference to the global variables structure.

ref CGlobalVars GlobalVars { get; }
Property Value

ServerIP

The IP address of the server.

string? ServerIP { get; }
Property Value

WorkshopId

Gets the Workshop ID of the current map.

string WorkshopId { get; }
Property Value

Methods

DispatchParticleEffect(string, ParticleAttachment_t, byte, CUtlSymbolLarge, CRecipientFilter, bool, int, CBaseEntity?)

Dispatches a particle effect to the specified recipients. Thread unsafe, use async variant instead for non-main thread context.

void DispatchParticleEffect(string particleName, ParticleAttachment_t attachmentType, byte attachmentPoint, CUtlSymbolLarge attachmentName, CRecipientFilter filter, bool resetAllParticlesOnEntity = false, int splitScreenSlot = 0, CBaseEntity? entity = null)
Parameters
  • particleNamestringThe name of the particle effect.
  • attachmentTypeParticleAttachment_tThe type of attachment for the particle effect.
  • attachmentPointbyteThe attachment point for the particle effect.
  • attachmentNameCUtlSymbolLargeThe name of the attachment for the particle effect.
  • filterCRecipientFilterThe recipient filter for the particle effect.
  • resetAllParticlesOnEntitybooloptionalWhether to reset all particles on the entity.
  • splitScreenSlotintoptionalThe split screen slot for the particle effect.
  • entityCBaseEntity?optionalThe entity to attach the particle effect to.

DispatchParticleEffectAsync(string, ParticleAttachment_t, byte, CUtlSymbolLarge, CRecipientFilter, bool, int, CBaseEntity?)

Dispatches a particle effect to the specified recipients asynchronously.

Task DispatchParticleEffectAsync(string particleName, ParticleAttachment_t attachmentType, byte attachmentPoint, CUtlSymbolLarge attachmentName, CRecipientFilter filter, bool resetAllParticlesOnEntity = false, int splitScreenSlot = 0, CBaseEntity? entity = null)
Parameters
  • particleNamestringThe name of the particle effect.
  • attachmentTypeParticleAttachment_tThe type of attachment for the particle effect.
  • attachmentPointbyteThe attachment point for the particle effect.
  • attachmentNameCUtlSymbolLargeThe name of the attachment for the particle effect.
  • filterCRecipientFilterThe recipient filter for the particle effect.
  • resetAllParticlesOnEntitybooloptionalWhether to reset all particles on the entity.
  • splitScreenSlotintoptionalThe split screen slot for the particle effect.
  • entityCBaseEntity?optionalThe entity to attach the particle effect to.
Returns
A task representing the asynchronous operation.

ExecuteCommand(string)

Executes the specified command string in the current context.

void ExecuteCommand(string command)
Parameters
  • commandstringThe command to execute. Cannot be null or empty.

ExecuteCommandAsync(string)

Executes the specified command string in the current context asynchronously.

Task ExecuteCommandAsync(string command)
Parameters
  • commandstringThe command to execute. Cannot be null or empty.
Returns

ExecuteCommandWithBuffer(string, Action<string>)

Executes the specified command string in the current context.

[Obsolete("This method is planned to be removed.")]
void ExecuteCommandWithBuffer(string command, Action<string> bufferCallback)
Parameters
  • commandstringThe command to execute. Cannot be null or empty.
  • bufferCallbackAction<string>The callback to receive the output of the command.

ExecuteCommandWithBufferAsync(string, Action<string>)

Executes the specified command string in the current context with a buffer callback asynchronously.

[Obsolete("This method is planned to be removed.")]
Task ExecuteCommandWithBufferAsync(string command, Action<string> bufferCallback)
Parameters
  • commandstringThe command to execute. Cannot be null or empty.
  • bufferCallbackAction<string>The callback to receive the output of the command.
Returns

FindGameSystemByName(string)

Find a game system by name.

nint? FindGameSystemByName(string name)
Parameters
  • namestringThe name of the game system.
Returns
The game system handle. Null if not found.

IsMapValid(string)

Determines whether the specified map string represents a valid map in server files.

bool IsMapValid(string map)
Parameters
  • mapstringThe map string to validate. It also supports Workshop ID.
Returns
true if the map is valid; otherwise, false.