Search docs
Search guides, modules and symbols
Modules

Docs / API / Modules / transmit

Transmit

Players & world

@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.

Import

import { TransmitStats } from "@s2script/sdk/transmit";

Author-time types ship in the npm package; the engine injects the runtime at plugin load. Add @s2script/sdk to your plugin's dependencies.

API reference

Generated from the shipped type definitions.

interface
TransmitStats

Hot-path measurement counters returned by Transmit.stats.

snapshots: number
— CheckTransmit invocations observed since load/reset.
entries: number
— Live rule entries in the native table.
bitsCleared: number
— Total transmit bits cleared since load/reset.
nsLast: number
— Nanoseconds spent in the post-hook, last invocation.
nsMax: number
— Worst single invocation (ns) since load/reset.
const
Transmit

Declarative per-client entity visibility: hide an entity from some viewers, enforced engine-side each snapshot.

import { Transmit } from "@s2script/sdk/transmit";
// examples/cookbook/src/recipes/transmit.ts:65 — show `prop` ONLY to one viewer slot
const ok = Transmit.setVisibleTo(prop, [slot]);
setVisibleTo(entity: EntityRef, viewers: readonly number[]): boolean
— Replace this plugin's visibility rule for entity: it is transmitted ONLY to the given viewer slots (an empty array = hidden from everyone). Multiple plugins AND-merge — an entity reaches a viewer only if every plugin holding a rule on it allows that viewer. Returns false if the ref is stale or the capability is unavailable/disabled. Throws RangeError on a slot outside [0, 64).
reset(entity: EntityRef): boolean
— Remove this plugin's rule for entity (visible to all again, as far as this plugin is concerned). Returns false if the ref is stale or the capability is unavailable.
resetAll(): void
— Remove all of this plugin's rules.
stats(): TransmitStats
— Hot-path counters for measurement/debugging.
Back to modules All packages