Repository navigation
Module System
A plugin owns assembly loading; a module owns one running feature. Loading a plugin registers its attributed modules. Regular runs begin after CNetGame is ready. Early modules have a separate entry point and lifetime.
The required method is Task RunAsync(IModuleContext context). Its task must cover the entire run. SFModuleBase optionally supplies startup, execution, completion/fault and stopping hooks. Its Context and Log are unavailable outside an active run.
MainThread, BackgroundWorker and Hybrid select how execution starts, not an unconditional thread affinity guarantee after every await. Use explicit main-thread invocation for native work from workers.
Lifecycle states are Created, Starting, Running, Stopping, Stopped and Faulted. Stop requests cooperative cancellation. The host rejects new work, cancels owned tasks, drains them and disposes resources in reverse order on the game thread. Work that ignores cancellation can prevent unload; it is not forcibly freed. Faulted workers contribute to the final outcome.
/sfs start, stop, restart, info use module IDs. plugin-unload and plugin-reload use plugin IDs. See manifest commands for the distinction. Completing a module does not unload the plugin. An ALC-still-alive message means managed references remain, not a filesystem ACL failure. Shared exported APIs intentionally remain resident until game exit.
Saved /sfs choices override manifest enabledOnStart, which overrides the attribute's DefaultEnabled. Autostart is intent, separate from current Running state. Manifest dependencies order plugins; attribute dependencies use module IDs. Restart-on-fault is controlled by the host and its circuit breaker.
Source: SFModuleContainer, SFModuleBase, lifetime tests. See threading and ownership for cleanup rules.
- Главная / Home
- Установка
- Архитектура и совместимость
- SA-MP R1, R3-1, R5-1
- Написание модулей
- Плагины и зависимости
- Жизненный цикл
- API модулей
- Потоки и время жизни
- Ранняя загрузка
- Конфигурация и ассеты