From 4667c4b56710d1dffa333a02c0e2bff23beb0c8b Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Thu, 20 Feb 2020 23:55:16 -0500 Subject: [PATCH] Update list of message types from thinking --- src/Net/LockstepClient.ts | 12 ++++++++---- src/Net/LoopbackServer.ts | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Net/LockstepClient.ts b/src/Net/LockstepClient.ts index 2f1d0d9..8fd1e52 100644 --- a/src/Net/LockstepClient.ts +++ b/src/Net/LockstepClient.ts @@ -6,17 +6,21 @@ import map from "callbag-map"; import { INPUT_FREQUENCY, LockstepProcessor, LockstepState } from "../Ecs/Lockstep"; export const enum MessageTypes { - RESET = 0, - INPUT = 1, + META = 0, + SET_STATE = 1, + INPUT = 2, + GET_STATE = 3, + PING = 4 } export type Packet = { t: TypeId } & Payload; export type ClientMessage = + | Packet }> | Packet; export type ServerMessage = - | Packet }> + | Packet }> | Packet; export type Server = Callbag, ServerMessage>; @@ -62,7 +66,7 @@ export abstract class LockstepClient { // server message const message = data as ServerMessage; switch (message.t) { - case MessageTypes.RESET: + case MessageTypes.SET_STATE: const resetState = this.initState(message.s); this.state = new LockstepState(resetState, this.engine); break; diff --git a/src/Net/LoopbackServer.ts b/src/Net/LoopbackServer.ts index e2bbb1b..9e1deb1 100644 --- a/src/Net/LoopbackServer.ts +++ b/src/Net/LoopbackServer.ts @@ -20,5 +20,5 @@ export function Loopback(start: number, data?: Client