- 🔄 Automatic map reload via
map(orhost_workshop_mapfor workshop maps) when tick drift conditions are likely - 🧩 Workshop-aware — uses
host_workshop_map <workshopId>when the current map has a workshop ID, otherwise falls back tomap <mapName> - ⏱️ Configurable map-age threshold (defaults to 1 hour)
- 👤 Triggers only when the server is empty (zero disruption — no one is playing when the restart fires)
This plugin exposes no chat or console commands. It operates passively in the background.
Config file: addons/swiftlys2/plugins/MapRestart/config.jsonc
| Setting | Type | Default | Description |
|---|---|---|---|
DetailedLogging |
bool | false |
Enable verbose informational logging for diagnostics. Warnings and errors are always logged. |
MapRestartThresholdMinutes |
int | 60 |
Minimum map age (in minutes) before a restart can be triggered. |
{
"MapRestart": {
"DetailedLogging": false,
"MapRestartThresholdMinutes": 60
}
}CS2 servers develop "tick drift" when a map stays loaded for extended periods. This plugin reloads the map to reset tick state, but only when the server is empty so no active session is disrupted.
On OnMapLoad, the plugin records the map name and timestamp and arms a periodic 60s timer. Two triggers can then fire the empty-server check:
OnClientDisconnected— if the map has exceeded the threshold, waits 2 seconds and counts non-bot players.- The 60s periodic timer — short-circuits until
elapsed ≥ threshold, then each tick runs the same human-count check. Covers a server that stayed empty from map load.
If zero humans remain when the check runs, the plugin picks the restart command based on Core.Engine.WorkshopId: host_workshop_map <workshopId> when a workshop ID is present, otherwise map <mapName>.
OnMapLoad → store map + timestamp + arm 60s periodic timer
│
├─ OnClientDisconnected → map age ≥ threshold → wait 2s → humans == 0 → reload map
│
└─ periodic timer tick (60s) → map age ≥ threshold → humans == 0 → reload map
- Open the project in your preferred .NET IDE (Visual Studio, Rider, VS Code).
- Run
dotnet build. Output DLL and resources are placed inbuild/. - Run
dotnet publish -c Releaseto produce a distributable zip inbuild/.