API overview

API overview

s2script ships capability modules as @s2script/* packages (types at author time; the engine injects the runtime).

How imports work

import { OnGameFrame } from '@s2script/frame';
import { Player } from '@s2script/cs2';
import { Events } from '@s2script/events';

Declare each import under s2script.pluginDependencies in package.json. The CLI externalizes @s2script/* by wildcard; the host maps @s2script/<name> → the injected runtime module.

Engine-generic highlights

PackageRole
@s2script/entityEntityRef, create/spawn, I/O
@s2script/frameOnGameFrame
@s2script/timersdelay / nextTick / nextFrame
@s2script/eventsGame events + HookResult
@s2script/clientsClient lifecycle
@s2script/commandsConCommands
@s2script/chatChat send + onMessage
@s2script/adminAdmin flags + cache
@s2script/serverServer.command, cvars, onMapStart
@s2script/dbSQLite Database
@s2script/http / @s2script/wsAsync network
@s2script/menu / @s2script/votesMenus + votes

CS2

@s2script/cs2Player, Pawn, schema accessors, typed events, ChatColors, GameRules, Fade/Shake/HintText.

Next

s2script — Source 2 plugin framework

GitHub