Improve commands

This commit is contained in:
2026-09-27 00:38:55 -03:00
parent 535bd36d91
commit 8c7ca92891
13 changed files with 1095 additions and 109 deletions
+6 -2
View File
@@ -7,7 +7,7 @@ export const AIR_ID = "bworld:air";
// bump when a client and server of different versions can't play together.
// the server rejects a different version before the client downloads anything
export const PROTOCOL_VERSION = 5;
export const PROTOCOL_VERSION = 6;
export interface PlayerInfo {
id: string;
@@ -75,7 +75,9 @@ export type ClientMessage =
| { type: "drop_item"; container: ContainerKey; index: number; all: boolean }
// closes the open screen, including the player's own inventory screen
| { type: "close_screen" }
| { type: "chat"; text: string };
| { type: "chat"; text: string }
// what could come next in a command being typed, answered with suggestions. id matches them up
| { type: "suggest"; id: number; text: string };
export type ServerMessage =
// what to download before joining, see "Delivery to clients" in MODS.md
@@ -124,6 +126,8 @@ export type ServerMessage =
| { type: "close_screen" }
// the world time, every second and when it's changed. clients count ticks in between
| { type: "time"; time: number }
// answers suggest: start is where in the text the suggestions replace from, up to the caret
| { type: "suggestions"; id: number; start: number; suggestions: { text: string; tooltip?: string }[] }
// the player's own health, hunger and saturation, when they change
| { type: "vitals"; health: number; food: number; saturation: number };