How roflmuffin/counterstrikesharp works
CounterStrikeSharp is a Counter-Strike 2 server-side modding framework: plugin developers write C# plugins against a .NET API, which exposes game-server commands, events, listeners, timers, player/entity state, and related features. At runtime, the Metamod plugin and native scripting bridge connect those plugins to the game. The README documents the main capabilities; source excerpts are partial, so links between unsampled runtime components are limited to documented architecture and visible native dispatch.
Main entry points: Api.cs Plugin API · script_engine.cpp Native dispatch · BasePlugin.cs C# plugin · dotnet_host.cpp .NET host
Components 21
Plugin API
- Plugin API
managed/CounterStrikeSharp.API/Api.cs - Command handling
managed/CounterStrikeSharp.API/Core/Commands/CommandManager.cs - Admin permissions
managed/CounterStrikeSharp.API/Modules/Admin/AdminManager.cs - Events and listeners
managed/CounterStrikeSharp.API/Modules/Events/GameEvent.cs - Tick timers
managed/CounterStrikeSharp.API/Modules/Timers/Timer.cs - Players and entities
managed/CounterStrikeSharp.API/Modules/Entities/Player.cs - Player menus
managed/CounterStrikeSharp.API/Modules/Menu/MenuManager.cs
Managed Runtime
- .NET host
src/scripting/dotnet_host.cpp - Native dispatch
src/scripting/script_engine.cpp
Native Runtime
- Command natives
src/scripting/natives/natives_commands.cpp - Event natives
src/scripting/natives/natives_events.cpp - Engine natives
src/scripting/natives/natives_engine.cpp - Native commands
src/core/managers/con_command_manager.cpp - Native events
src/core/managers/event_manager.cpp - Player lifecycle
src/core/managers/player_manager.cpp - Timer scheduler
src/core/timer_system.cpp
Game Integration
- Schema access
managed/CounterStrikeSharp.API/Modules/Memory/Schema.cs - Metamod plugin
src/mm_plugin.cpp
Other components
- Plugin developer
- C# plugin
managed/CounterStrikeSharp.API/Core/BasePlugin.cs - Counter-Strike 2 server
Connections 23
- Plugin developer → C# plugin: authors
- C# plugin → Plugin API: uses
- C# plugin → .NET host: loaded by
- Plugin API → Command handling: registers commands
- Plugin API → Events and listeners: subscribes to
- Plugin API → Tick timers: schedules timers
- Plugin API → Players and entities: accesses game state
- Plugin API → Player menus: displays menus
- Command handling → Admin permissions: checks permissions
- Metamod plugin → .NET host: hosts runtime
- .NET host → Native dispatch: invokes natives
- Native dispatch → Command natives: dispatches
- Native dispatch → Event natives: dispatches
- Native dispatch → Engine natives: dispatches
- Command natives → Native commands: registers commands
- Event natives → Native events: registers callbacks
- Player lifecycle → Native dispatch: executes callbacks
- Engine natives → Timer scheduler: reads tick time
- Schema access → Counter-Strike 2 server: reads schema state
- Native commands → Counter-Strike 2 server: registers server commands
- Native events → Counter-Strike 2 server: handles game events
- Player lifecycle → Counter-Strike 2 server: tracks players
- Metamod plugin → Counter-Strike 2 server: integrates with