/// import * as t from 'io-ts'; import { BehaviorSubject, Observable, Subject } from 'rxjs'; import { Component } from '../component'; import { EcsEvent } from '../events'; import { Plugin } from '../plugin'; import { Resource } from '../resource'; export declare class Peers { readonly current: BehaviorSubject>; readonly join: Subject; readonly leave: Subject; constructor(p: BehaviorSubject> | { join: Subject; leave: Subject; initial?: Set; }); } export interface Communicator { uuid: string | undefined; peers: Peers; servers: BehaviorSubject>; messages: Observable<{ source: string; message: unknown; }>; connected: BehaviorSubject; sendMessage(message: unknown, destination?: string | Set): void; } export declare const Message: t.PartialC<{ delta: t.Type | undefined; componentDeltas?: Map | undefined; removeComponents?: Set | undefined; }>, [string, { componentStates?: [string, unknown][] | undefined; componentDeltas?: [string, unknown][] | undefined; removeComponents?: string[] | undefined; }][], unknown>; state: t.Type, [string, { components: [string, unknown][]; } & { name?: string | undefined; }][], unknown>; requestState: t.TypeC<{ uuids: t.Type, string[], unknown>; invert: t.BooleanC; }>; remove: t.ArrayC; ownedUuids: t.ArrayC; admins: t.Type, string[], unknown>; peers: t.Type, string[], unknown>; }>; export declare type Message = t.TypeOf; export declare const MultiplayerData: Component<{ owner: string; }>; export interface MessageWithSource { message: M; source: string; } export declare const Comms: Component<{ ownedUuids: Set; admins: Set; uuid: string | undefined; stateRequests: Map>; lastEntities: Map; messages: MessageWithSource[]; initialStateRequested: boolean; }>; export declare const NewOwnedEntityEvent: EcsEvent; export declare const MultiplayerMessageEvent: EcsEvent, MessageWithSource>; export declare const CommunicatorResource: Resource; export declare function multiplayer(communicator: Communicator, warn?: (message: string) => void): Plugin;