WorkerGameContext beta
Interface of @v12-engine/engine
ts
export interface WorkerGameContextWhat the worker's code that runs on a world is given (ServeWorldOptions.onStart, beforePlay): the player at the screen, the map, what the page sent (WorkerGame.args), and a way to tell the page something
Members
args
ts
args: unknown;What the page sent for the worker's own code (WorkerGame.args): plain data
map
ts
map?: GameMap;The map the world was made from, where it was made from one (or sent with a save)
player
ts
player: PlayerId;The player at the screen
tell
ts
tell(data: unknown): void;Tells the page something, while this game lasts: plain data, as it crosses (a mission won and what it carries on). The page hears it on its session (WorkerSession.onTold), in order with the game's ticks: what is told in a tick is heard before the snapshot of that tick. Said for nothing once the game has ended