Modules
Generated API reference for @s2script/sdk subpaths and @s2script/cs2. See also the package reference.
- Config @s2script/sdk/config Platform
typed access to the plugin's materialized config.
- Console @s2script/sdk/console Platform
Injected console logging for plugins.
- Contracts/workshop @s2script/sdk/contracts/workshop Platform
`@s2script/sdk/contracts/workshop` — the standard contract for a **workshop / UGC** plugin. TYPE-ONLY. The framework ships no implementation: subscribing to, downloading and mounting UGC is a Steam-services concern, not a Source 2 engine touchpoint. A community plugin implements this and publishes it; consumers depend on the one agreed shape. See `contracts/README.md`. Engine-generic on purpose — every Source 2 title has workshop content, so nothing here is CS2-specific. Game-specific economy lives in `@s2script/cs2/econ`. @example import type { WorkshopService } from "@s2script/sdk/contracts/workshop"; const ws = ctx.tryUse<WorkshopService>("workshop"); if (ws) { const map = await ws.currentMap(); console.log(map ? `${map.title} (${map.id})`: "not a workshop map"); }
- Engine calls (unsafe) @s2script/sdk/unsafe Platform
Call or detour an engine function the framework does not wrap, declared in your own gamedata. Validated at load and degraded to null on failure — requires a manifest permission (`engine:calls` or `engine:hooks`) and an operator allow-list entry.
- Entity @s2script/sdk/entity Platform
Liveness-gated EntityRef handles, typed reads/writes, create/spawn/teleport/remove, and entity I/O.
- Interfaces @s2script/sdk/interfaces Platform
Producer-as-import and use / tryUse proxies for typed, versioned cross-plugin interfaces. Events are ledgered forwards (`on`, no `off`).
- Math @s2script/sdk/math Platform
Vector and QAngle value types plus helpers like forwardVector.
- Plugin @s2script/sdk/plugin Platform
Load-window authoring: `hook` (game-event catalog: hook.on / hook.onPre), previous(), pluginId(), publish / use, onOutput, createScope, Scope. The artifact is export function OnPluginStart (plus optional named publics).
- Plugins @s2script/sdk/plugins Platform
runtime plugin management (the SM `sm plugins` backend).
- Timers @s2script/sdk/timers Platform
Tick-integrated async timing: delay, nextTick, nextFrame, threadSleep.
- Voice @s2script/sdk/voice Platform
who can hear whom.
- Clients @s2script/sdk/clients Players & world
engine-generic client handle + lifecycle events. Resolved at runtime via globalThis.__s2pkg_clients. Import: import { Client, Clients } from "./clients";
- Damage @s2script/sdk/damage Players & world
Block-scoped DamageInfo view of a live damage event. Subscribe with SDKHook — not a global mux.
- Events @s2script/sdk/events Players & world
Typed game-event bus: fire / fireToClient, HookResult, and the block-scoped GameEvent accessor.
- SDKHooks @s2script/sdk/sdkhooks Players & world
Per-entity SDKHook / SDKUnhook (SourceMod-shaped). OnTakeDamage; SetTransmit AND-merges with Transmit.setVisibleTo; lifecycle virtuals (Spawn, Think, Use, …).
- Sound @s2script/sdk/sound Players & world
engine-generic sound: emit a named SoundEvent + register custom precache paths.
- Trace @s2script/sdk/trace Players & world
Ray / line / hull traces returning a liveness-gated hit entity.
- Transmit @s2script/sdk/transmit Players & world
Declarative per-client visibility masks. AND-merges with SDKHookType.SetTransmit — either API can hide; SetTransmit cannot un-hide a native mask clear.
- User Commands @s2script/sdk/usercmd Players & world
a SourceMod `OnPlayerRunCmd`-equivalent: intercept, read, modify, and block a player's per-tick input (buttons, view angles, movement, impulse) before the game processes it.
- User Messages @s2script/sdk/usermessages Players & world
A general protobuf user-message builder.
- Admin @s2script/sdk/admin Admin & chat
engine-generic admin flag model + cache API. Resolved at runtime via `globalThis.__s2pkg_admin`; no game-specific symbols. Import: `import { ADMFLAG, Admin } from "./admin";`
- Bans @s2script/sdk/bans Admin & chat
engine-generic SteamID64 ban store + bans.json persistence. Resolved at runtime via `globalThis.__s2pkg_bans`; no game-specific symbols. Import: `import { Bans } from "./bans";` The store is host-global in core, populated from `addons/s2script/configs/bans.json` via the config bridge. Enforcement is JS-driven: a ban plugin (e.g. @s2script/basebans) registers a `Clients.onConnect` handler that looks a connecting SteamID64 up here and, if banned, shows the reason then kicks (`Client.kickWithReason`) — a banned player is admitted, shown their reason, and kicked, not instant-rejected. A 3rd-party ban system registers its own onConnect against its own store.
- Chat @s2script/sdk/chat Admin & chat
print messages to player chat.
- Commands @s2script/sdk/commands Admin & chat
Load-window `command()` / `command.admin` / `command.server`. `Command` is an alias for `CommandInvocation`. Owned handlers return `HookResult.Handled`.
- Menu @s2script/sdk/menu Admin & chat
interactive player menus (chat + center backends).
- Server @s2script/sdk/server Admin & chat
Server.command, cvars, and map validity. Map start is the named public `OnMapStart`.
- TopMenu @s2script/sdk/topmenu Admin & chat
the extensible admin/top menu registry.
- Translations @s2script/sdk/translations Admin & chat
SourceMod-style i18n (per-client language, phrase files, {1} formatting).
- Votes @s2script/sdk/votes Admin & chat
chat-ballot voting with revote + an optional live center tally.
- Cookies @s2script/sdk/cookies Persistence
SM-parity client preference cookies.
- Database @s2script/sdk/db Persistence
engine-generic async SQLite database.
- HTTP @s2script/sdk/http Network
async HTTP.
- Sockets @s2script/sdk/net Network
engine-generic raw TCP + UDP sockets (binary), off the game thread.
- WebSocket @s2script/sdk/ws Network
client WebSocket.
- CS2 @s2script/cs2 Game CS2
CS2 player/pawn model, schema accessors, typed events overlay, menus, ui, and Fade/Shake/HintText.
- HUD @s2script/cs2 Game CS2
Custom Panorama HUD: ui.components() (modals, badges, toasts) and the ui.hud() primitive.