Entities
Entity references are EntityRef = { index, serial } — a raw pointer never crosses to JavaScript.
Every field access re-validates the captured serial against the live CEntityIdentity. A stashed ref whose entity was destroyed reads null / false, not garbage.
import { Player } from '@s2script/cs2';
const players = Player.all();
for (const p of players) {
const hp = p.pawn?.health; // number | null
} CS2 Pawn / Player are EntityRef-backed with generated schema accessors (health, origin, …). Handle fields return live refs; writes call notifyStateChanged automatically.
Create/spawn/remove and entity I/O live on @s2script/entity. See the entity module.