Deadworks Scripting API Documentation
Deadworks is a .NET plugin framework for creating server-side mods for Deadlock (Valve's Source 2 game). Plugins are compiled as .NET DLLs and loaded at runtime, with full access to the game's entity system, networking, damage pipeline, and more.
Quick Start
- Project Setup — Create a Visual Studio project, reference the API DLL, and configure auto-deploy
- Your First Plugin — Build a minimal plugin with a chat command
API Reference
| Topic | Description |
|---|---|
| Plugin Base | DeadworksPluginBase, lifecycle hooks, IDeadworksPlugin interface |
| Chat Commands | [ChatCommand] attribute, ChatCommandContext |
| Console Commands & ConVars | [ConCommand], [ConVar], ConVar class |
| Timers | Timer.Once, Timer.Every, Timer.Sequence, Duration |
| Entities | CBaseEntity, entity creation, schema access, EntityData<T> |
| Players | CCitadelPlayerController, CCitadelPlayerPawn, Players helpers |
| Networking | NetMessages.Send, RecipientFilter, message hooks |
| Particles | CParticleSystem, fluent builder API |
| Modifiers | AddModifier, KeyValues3, EModifierState |
| Damage | OnTakeDamage, CTakeDamageInfo, Hurt() |
| Game Events | [GameEventHandler], GameEvents, GameEvent |
| Entity I/O | EntityIO.HookOutput, EntityIO.HookInput |
| Configuration | IPluginConfig<T>, BasePluginConfig, JSON serialization |
| Heroes | Heroes enum, HeroTypeExtensions, CitadelHeroData |
| Precaching | Precache.AddResource, Precache.AddHero |
| Tracing | Trace.Ray, TraceShape, CGameTrace, collision filtering |
| World Text | CPointWorldText, ScreenText |
Guides
- Plugin Lifecycle — Load/unload flow, hot-reloading, resource precaching
- Damage System — Intercepting and modifying damage, applying DOT effects
- Team & Hero Management — Balancing teams, forcing hero selection, currency control
- Chat & HUD Messaging — Sending chat messages, HUD announcements, world text
Example Plugins
Full annotated breakdowns of real plugins:
- Roll The Dice — Random effects via chat command (particles, modifiers, timers)
- Item Rotation — Timed item set rotation with JSON config
- Deathmatch — Full game mode: spawn control, team balancing, custom commands
- Scourge — Damage-over-time effect using
OnTakeDamage+ timer sequences
Architecture
Your Plugin (.cs)
│
├── inherits DeadworksPluginBase
├── references DeadworksManaged.Api.dll
└── compiles to .NET DLL
│
└── deployed to: Deadlock/game/bin/win64/managed/plugins/
Runtime: .NET 10.0
Dependencies: DeadworksManaged.Api.dll, Google.Protobuf.dll
Namespace: DeadworksManaged.Api