UNPKG

@hastearcade/snowglobe

Version:

A TypeScript port of CrystalOrb, a high-level Rust game networking library

20 lines 1.13 kB
import { type Cloneable } from './cloneable'; import { type Command } from './command'; import { type Disposable } from './disposable'; import { type Stepper } from './fixed_timestepper'; export interface Snapshot extends Cloneable, Disposable { } export interface DisplayState extends Cloneable, Disposable { } export type World<$Command extends Command = Command, $Snapshot extends Snapshot = Snapshot, $DisplayState extends DisplayState = DisplayState> = Stepper & { commandIsValid: (command: $Command, clientId: number) => boolean; applyCommand: (command: $Command) => void; rollbackCommand: (command: $Command) => void; applySnapshot: (snapshot: $Snapshot) => void; snapshot: () => $Snapshot; displayState: () => $DisplayState; } & Cloneable & Disposable; export type SnapshotOf<$World> = $World extends World<infer _, infer $Snapshot> ? $Snapshot : never; export type CommandOf<$World> = $World extends World<infer $Command> ? $Command : never; export type DisplayStateOf<$World> = $World extends World<infer _, infer __, infer $DisplayState> ? $DisplayState : never; //# sourceMappingURL=world.d.ts.map