Skip to content

shmitzas/MapRestart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MapRestart

Automatically reloads the current map to mitigate CS2 tick drift on long-running, low-population servers.

Build Status Downloads Stars License


Features

  • 🔄 Automatic map reload via map (or host_workshop_map for 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 to map <mapName>
  • ⏱️ Configurable map-age threshold (defaults to 1 hour)
  • 👤 Triggers only when exactly one human player is on the server (zero disruption to active sessions)

Commands

This plugin exposes no chat or console commands. It operates passively in the background.

Configuration

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.

Example Configuration

{
  "MapRestart": {
    "DetailedLogging": false,
    "MapRestartThresholdMinutes": 60
  }
}

How It Works

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 no active session would be disrupted.

On OnMapLoad, the plugin records the map name and timestamp. On OnClientPutInServer, it checks whether the map has exceeded MapRestartThresholdMinutes. If so, it waits 2 seconds and counts non-bot players — if exactly one human is present, the map is reloaded via host_workshop_map <workshopId> (workshop maps) or map <mapName> (built-in maps).

OnMapLoad → store map + timestamp
       │
       ▼
OnClientPutInServer
       │
       └─ map age ≥ threshold → wait 2s → humans == 1 → reload map

Building

  • Open the project in your preferred .NET IDE (Visual Studio, Rider, VS Code).
  • Run dotnet build. Output DLL and resources are placed in build/.
  • Run dotnet publish -c Release to produce a distributable zip in build/.

About

Restarts a map if no players were connected for a long time to prevent tick drift.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages