Package reference
Every engine-generic capability is a subpath of the single @s2script/sdk package; CS2 game types are the separate @s2script/cs2. Prefer the
root @s2script/sdk barrel for authoring. Import the types at author time; the engine
injects the runtime at load.
This page is generated from the shipped type definitions, as are the module pages it links to, so it lists exactly what you can import.
Platform
| Import | What it gives you |
|---|---|
@s2script/sdk/config | typed access to the plugin's materialized config. ConfigValue,Config,config — guide |
@s2script/sdk/console | Injected console logging for plugins. console |
@s2script/sdk/unsafe | Call or detour an engine function the framework does not wrap. Declare it in `gamedata/functions.jsonc` and bind with `Engine.function` — `s2s build` derives `engine:calls` / `engine:hooks`. Validated at load; optional bindings degrade with structured `status`. Operator allow-list still default-deny. EngineCalls,EngineHooks,EngineFunctions,FunctionStatus,Disposable,FunctionSubscription, and 1 more — guide |
@s2script/sdk/entity | Liveness-gated EntityRef handles, typed reads/writes, create/spawn/teleport/remove, and entity I/O. EntityRef,EntityKeyValueMap,createEntity,OutputEvent,Entity — guide |
@s2script/sdk/interfaces | Protocol 2 contract types: Notification, Hook, Transform, Subscription, AttachmentScope. Name-inferred publish / use, bindForwards, and watchOptional. Protocol 2 `on` returns an idempotent Subscription (not a numeric id). PublishHandle,Notification,Hook,Transform,TransformResponse,InterfaceContracts, and 12 more — guide |
@s2script/sdk/math | Vector and QAngle value types plus helpers like forwardVector. Vector,QAngle,forwardVector |
@s2script/sdk/plugin | Load-window authoring: `hook` (game-event catalog: hook.on / hook.onPre), previous(), pluginId(), publish / use / tryUse / watchOptional / bindForwards, onOutput, createScope, Scope. The artifact is export function OnPluginStart (plus optional named publics). CJS evaluation is before the load window. CtxEvents,CtxClients,CtxEntities,CtxServer,CtxCommands,CtxTranslations, and 18 more — guide |
@s2script/sdk/plugins | runtime plugin management (the SM `sm plugins` backend). PluginInfo,Plugins |
@s2script/sdk/timers | Tick-integrated async timing: delay, nextTick, nextFrame, threadSleep (Promise). Overload rejects or throws AsyncQueueFull. delay,nextTick,nextFrame,threadSleep,Timer,after, and 1 more — guide |
Players & world
| Import | What it gives you |
|---|---|
@s2script/sdk/clients | A Client is a handle to one connection lifetime. Reusing a slot never revives a saved handle. Disconnect callbacks expose a synchronous identity snapshot; stale getters and actions return safe defaults. Client,Clients — guide |
@s2script/sdk/damage | Borrowed DamageInfo view of a live damage event (throws "expired borrowed view" after the synchronous callback). Subscribe with SDKHook (OnTakeDamage / OnTakeDamagePost), provided by the selected game package. Post assignment of damage is ignored. DamageInfo — guide |
@s2script/sdk/events | Typed game-event bus: fire / fireToClient, HookResult, and the block-scoped GameEvent accessor. GameEvent,HookResult,HookResultValue,Events — guide |
@s2script/sdk/sdkhooks | Per-entity SDKHook / SDKUnhook (SourceMod-shaped). OnTakeDamage / OnTakeDamagePost; SetTransmit AND-merges with Transmit.setVisibleTo; lifecycle virtuals (Spawn, Think, Use, …); Weapon* / Reload. UseTypeValue,UseType,SDKHookType,TraceAttackInfo,SDKHook,SDKUnhook — guide |
@s2script/sdk/sound | engine-generic sound: emit a named SoundEvent + register custom precache paths. SoundEmitOptions,PrecacheContext,Sound |
@s2script/sdk/trace | Ray / line / hull traces returning a liveness-gated hit entity. TraceMask,TraceHit,TraceOptions,Trace |
@s2script/sdk/transmit | Declarative per-client visibility masks. AND-merges with SDKHookType.SetTransmit — either API can hide; SetTransmit cannot un-hide a native mask clear. TransmitStats,Transmit — guide |
@s2script/sdk/usercmd | 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. UserCmdView |
@s2script/sdk/usermessages | A general protobuf user-message builder. UserMessage,UserMessageView,UserMessages |
@s2script/sdk/voice | Who can hear whom: per-sender audibility rules (`Voice.setAudibleTo`) that AND-merge across plugins, plus hot-path counters (`Voice.stats`). VoiceStats,Voice |
Admin & chat
| Import | What it gives you |
|---|---|
@s2script/sdk/admin | engine-generic admin flag model + cache API. Resolved at runtime via `globalThis.__s2pkg_admin`; no game-specific symbols. Import: `import { ADMFLAG, Admin } from "./admin";` ADMFLAG,AdminInfo,AdminGroup,Admin |
@s2script/sdk/bans | Host-global SteamID64 ban cache. `Bans.add` updates the cache then attempts persistence (void; no rollback). `Bans.remove` returns whether a cache key existed, not disk ACK. BanInfo,BanEntry,Bans — guide |
@s2script/sdk/chat | print messages to player chat. Chat |
@s2script/sdk/commands | Load-window `command()` / `command.admin` / `command.server`. `Command` is an alias for `CommandInvocation`. Owned handlers return `HookResult.Handled`. ReplySource,CommandInvocation,Command,CommandHandler,command,ChatTrigger, and 1 more — guide |
@s2script/sdk/menu | Slot-based menus. On CS2, Center and Chat paint a hudkit center sheet from the six-sheet pool (claim on first open, release when idle; Chat fallback per session if the pool is busy or the HUD open fails). activation is immediate or tab. MenuActivation,MenuStyle,MenuCancelReason,MenuSelectEvent,MenuCancelEvent,Menu, and 3 more |
@s2script/sdk/server | Server.command, cvars, and map validity. Map start is the named public `OnMapStart`. Server — guide |
@s2script/sdk/topmenu | Shared admin/top-menu registry. Plugins declare a tab with `addTab({ id, title })` then `addItem(tabId, item)`. Items default to the admin sheet (`sm_admin`); opt into the player hub (`sm_menu`) with `sheets: ["menu"]`. Snapshot `tabs` is `{ id, title }[]`; `categories` stays tab ids. TopMenuSheet,TopMenuTab,TopMenuItem,TopMenuSnapshot,TopMenu — guide |
@s2script/sdk/translations | SourceMod-style i18n (per-client language, phrase files, {1} formatting). Phrases,Translations — guide |
@s2script/sdk/votes | Chat-ballot votes. On CS2, a right-side rail on s2script_lib (hudkit.layout — not a Menu, not a hudkit modal, not a second CustomHudLayout). VoteTally.choice is the per-slot 0-based cast. showLiveTally is ignored when a tally renderer is registered. VoteResult,VoteConfig,VoteTally,VoteTallyRenderer,Vote |
Persistence
| Import | What it gives you |
|---|---|
@s2script/sdk/cookies | SM-parity client preference cookies. Cookies.set / setAuthId return boolean admission — false leaves the cache unchanged; true is host-owned until DB ACK, not a durability guarantee. CookieAccess,Cookie,CookieOptions,Cookies — guide |
@s2script/sdk/db | Async SQLite / SQL. query / execute reject with AsyncQueueFull or AsyncPayloadTooLarge before acceptance; oversized results reject with DatabaseResultTooLarge. SqlValue,Row,ExecuteResult,DriverConnection,ConnectionConfig,Driver, and 1 more — guide |
Network
| Import | What it gives you |
|---|---|
@s2script/sdk/http | Off-thread fetch. Admission rejects with AsyncQueueFull / AsyncPayloadTooLarge; oversized responses reject with HttpResponseTooLarge. FetchOptions,Response,fetch — guide |
@s2script/sdk/net | Raw TCP / UDP sockets. TcpSocket.send and UdpSocket.sendTo return boolean admission — false means closed, oversized, or full; true is queued, not delivered. TcpSocket,UdpSocket,Net — guide |
@s2script/sdk/ws | Client WebSocket. send returns boolean admission — false means closed, oversized, or full; true is queued, not delivered. WebSocket,WebSocketInit — guide |
Game
| Import | What it gives you |
|---|---|
@s2script/cs2 | CS2 player/pawn model, schema accessors, typed events overlay, menus, CustomHudLayout / hudkit, CustomPlayerCamera, Fade/Shake/HintText, and pickup gates (`items` / ItemsApi). HudInput,Pawn,Player,Events,Activity,ChatColors, and 20 more |
@s2script/cs2 | Custom Panorama HUD: CustomHudLayout.create(spec) plus hudkit (modals, badges, toasts, callouts, banners, MOTD, dashboard). `CustomHudSpec.observable` (default false) is spectator rendering policy, not confidentiality. Use from OnPluginStart or later; pre-ctx methods throw. Modal/badge null is pool exhaustion (`tryModal` / `tryBadge` report PoolExhausted). spec/descriptor stay readable at module top-level. Retained views expose isValid(); modal/dashboard clicks dispatch from the last complete paint. `invalidate()` coalesces next-frame repaints; `refresh()` stays synchronous. tryOwn* / tryOwnDashboard claim shared surfaces (`Busy` instead of overwrite); hideAll preserves explicit claims. Unload/reload clears surfaces; `badge.release()` hides for every remaining viewer. HudLayout.subscribeClick is a disposable sibling of onClick. ui / hud() / components() are deprecated aliases. HudResult,UiErrorCode,UiResult,UiSubscription,UiSurfaceHandle,UiStatus, and 41 more — guide |
Interfaces
| Import | What it gives you |
|---|---|
@s2script/sdk/contracts/workshop | Type-only contract for a workshop / UGC service. The framework ships no implementation: a community plugin publishes one and consumers depend on this shape. WorkshopItem,WorkshopMap,WorkshopDownloadProgress,WorkshopService |
Today the live game package is CS2 on linuxsteamrt64 only. Game-specific facts stay
in @s2script/cs2. Litmus test: would this still be true on another Source 2 game?
If not, it belongs in the game package.