diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-06-29 20:26:02 +0200 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-06-29 20:26:02 +0200 | 
| commit | 04a4902d1054a2e8776107c99ef83496b6050b60 (patch) | |
| tree | 45d4bd14ec4a17e0accd060bf7211ee421418a34 /test-client | |
| parent | 03c46a18d3a283ee737688c4c65bb5ef1d6ba1dc (diff) | |
| download | hurrycurry-04a4902d1054a2e8776107c99ef83496b6050b60.tar hurrycurry-04a4902d1054a2e8776107c99ef83496b6050b60.tar.bz2 hurrycurry-04a4902d1054a2e8776107c99ef83496b6050b60.tar.zst | |
server message for command errors
Diffstat (limited to 'test-client')
| -rw-r--r-- | test-client/main.ts | 5 | ||||
| -rw-r--r-- | test-client/protocol.ts | 1 | 
2 files changed, 6 insertions, 0 deletions
| diff --git a/test-client/main.ts b/test-client/main.ts index e3185c67..38b9e730 100644 --- a/test-client/main.ts +++ b/test-client/main.ts @@ -211,6 +211,11 @@ function packet(p: PacketC) {              global_message_clear = setTimeout(() => global_message = undefined, 4000)              console.warn(p.message)              break; +        case "server_message": +            if (global_message_clear) clearTimeout(global_message_clear) +            global_message = { inner: { text: p.text }, anim_size: 0., anim_position: { x: 0, y: 0 } } +            global_message_clear = setTimeout(() => global_message = undefined, 4000) +            break;          case "set_ingame":              console.log(`ingame ${p.state}`);              break; diff --git a/test-client/protocol.ts b/test-client/protocol.ts index f9f0dbaf..81a0d1a4 100644 --- a/test-client/protocol.ts +++ b/test-client/protocol.ts @@ -48,6 +48,7 @@ export type PacketC =      | { type: "set_active", tile: Vec2, progress?: number, warn: boolean } // A tile is doing something. progress goes from 0 to 1, then null when finished      | { type: "update_map", tile: Vec2, kind: TileIndex | null, neighbors: [TileIndex | null] } // A map tile was changed      | { type: "communicate", player: PlayerID, message?: Message, persist: boolean } // A player wants to communicate something, message is null when cleared +    | { type: "server_message", text: string } // Text message from the server      | { type: "score", points: number, demands_failed: number, demands_completed: number, } // Supplies information for score OSD      | { type: "set_ingame", state: boolean } // Set to false when entering the game or switching maps      | { type: "error", message: string } // Your client did something wrong. | 
