How cs2surf/timer works
CS2 SurfTimer is a CounterStrikeSharp server plugin that turns player movement through map zones into timed map, stage, and bonus runs. Game events and commands initialize player/map state, drive timing and replay capture, and expose results through HUD and chat. Run/profile records use a shared data-access abstraction backed by MySQL or the optional REST API. The index confirms several calls; unsampled modules and portions of excerpts limit finer control-flow claims, so uncertain links are omitted.
Main entry points: Player.cs Player · PlayerCommands.cs Player commands · ZoneEventHandlers.cs Zone events · IDataAccessService.cs Data access contract
Components 28
Plugin runtime
- Plugin lifecycle
src/SurfTimer.cs - Tick updates
src/ST-Events/Tick.cs - Configuration
src/ST-UTILS/Config.cs
Surf gameplay
- Map and zones
src/ST-Map/Map.cs - Zone events
src/ST-Events/ZoneEventHandlers.cs - Trigger touch hooks
src/ST-Events/TriggerStartTouch.cs - Trigger exit hooks
src/ST-Events/TriggerEndTouch.cs - Player commands
src/ST-Commands/PlayerCommands.cs - Map commands
src/ST-Commands/MapCommands.cs - HUD and results
src/ST-Player/PlayerHUD.cs - Practice locations
src/ST-Player/Saveloc/SavelocFrame.cs
Player records
- Player
src/ST-Player/Player.cs - Run timer
src/ST-Player/PlayerTimer.cs - Current run
src/ST-Player/PlayerStats/CurrentRun.cs - Personal bests
src/ST-Player/PlayerStats/PersonalBest.cs - Player stats
src/ST-Player/PlayerStats/PlayerStats.cs - Player profile
src/ST-Player/PlayerProfile.cs - Replay recorder
src/ST-Player/Replay/ReplayRecorder.cs - Replay frames
src/ST-Player/Replay/ReplayFrame.cs - Replay manager
src/ST-Player/Replay/ReplayManager.cs - Replay playback
src/ST-Player/Replay/ReplayPlayer.cs
Persistence and API
- Data access contract
src/ST-UTILS/Data/IDataAccessService.cs - MySQL access
src/ST-UTILS/Data/MySqlDataAccessService.cs - REST API access
src/ST-UTILS/Data/ApiDataAccessService.cs
Other components
- Surf player
- CounterStrikeSharp
- MySQL database
- SurfTimer REST API
Connections 34
- CounterStrikeSharp → Plugin lifecycle: starts plugin
src/SurfTimer.cs - Plugin lifecycle → Map and zones: initializes map
src/SurfTimer.cs - Surf player → Player commands: issues commands
README.md - Player commands → Replay recorder: starts replay
src/ST-Commands/PlayerCommands.cs - Player commands → Replay playback: selects replay
src/ST-Commands/PlayerCommands.cs - Player commands → Practice locations: uses saved locations
src/ST-Commands/PlayerCommands.cs - Trigger touch hooks → Zone events: dispatches zone touch
- Trigger exit hooks → Zone events: dispatches zone exit
- Zone events → Player: updates player
src/ST-Events/ZoneEventHandlers.cs - Zone events → Map and zones: uses map zones
src/ST-Events/ZoneEventHandlers.cs - Zone events → Current run: records run
src/ST-Events/ZoneEventHandlers.cs - Tick updates → Replay recorder: captures frames
src/ST-Events/Tick.cs - Tick updates → Replay playback: advances playback
src/ST-Player/Replay/ReplayPlayer.cs - Player → Run timer: owns timer
src/ST-Player/Player.cs - Player → Player stats: owns stats
src/ST-Player/Player.cs - Player → Player profile: owns profile
src/ST-Player/Player.cs - Player → Replay recorder: owns recorder
src/ST-Player/Player.cs - Player → Practice locations: stores locations
src/ST-Player/Player.cs - Player → HUD and results: owns HUD
src/ST-Player/Player.cs - Current run → Data access contract: saves run
src/ST-Player/PlayerStats/CurrentRun.cs - Player profile → Data access contract: loads profile
src/ST-Player/PlayerProfile.cs - Map and zones → Data access contract: loads map records
src/ST-Map/Map.cs - Player stats → Personal bests: manages bests
src/ST-UTILS/Injection.cs - Player stats → Current run: manages current run
src/ST-UTILS/Injection.cs - Replay recorder → Replay frames: creates frames
src/ST-Player/Replay/ReplayRecorder.cs - Replay manager → Replay playback: holds replays
src/ST-Player/Replay/ReplayManager.cs - Map and zones → Replay manager: initializes manager
src/ST-Map/Map.cs - Player commands → HUD and results: displays results
- Data access contract → MySQL access: implemented by
src/ST-UTILS/Data/MySqlDataAccessService.cs - Data access contract → REST API access: implemented by
src/ST-UTILS/Data/ApiDataAccessService.cs - MySQL access → MySQL database: queries
- REST API access → SurfTimer REST API: requests
- Configuration → REST API access: configures API
src/ST-UTILS/Config.cs - Plugin lifecycle → Configuration: loads settings
src/SurfTimer.cs