Repository navigation
Module API Reference
IModuleContext belongs to one active module run. SFModuleBase exposes it as protected Context and supplies the run-scoped Log. The host's concrete ModuleContext is not a plugin dependency.
Descriptor carries metadata, SF provides game services, CancellationToken signals stop, Log supplies module-scoped logging, and Assets/UserData/Config supply storage. Telemetry is thread-safe. SF.Modules is a read-only snapshot catalog, not an administration API.
Use RegisterChatCommand for synchronous commands and RegisterAsyncChatCommand for tracked asynchronous handlers. Names exclude /. Async handlers receive cancellation, allow at most one active invocation per registration and are drained before resources are released.
RegisterDisposable transfers resource ownership to the run. Direct event registrations must be passed to it. Resources are disposed in reverse order on the game thread after owned work finishes. RunBackground(token => ...) tracks worker work and faults; detached tasks are not automatically tracked.
InvokeOnMainThreadAsync runs only its delegate on the game thread. It does not move the caller's continuation. Native work after ConfigureAwait(false) still needs explicit dispatch.
Heartbeat records liveness and optional activity; ReportActivity only changes activity. SetStatusText supplies a short dashboard status. IncrementCounter maintains named counts, SetDetail maintains named values, TrackLoop measures a scoped iteration, and GetSnapshot returns the current copied state. None of these confirms server acceptance or actual network delivery.
Use counters and sampled summaries on packet hot paths rather than a file-log line per packet. Keep counter names stable across runs.
Source: IModuleContext, telemetry, runtime implementation. See ownership and threading.
- Главная / Home
- Установка
- Архитектура и совместимость
- SA-MP R1, R3-1, R5-1
- Написание модулей
- Плагины и зависимости
- Жизненный цикл
- API модулей
- Потоки и время жизни
- Ранняя загрузка
- Конфигурация и ассеты