Health and hunger system

This commit is contained in:
2026-09-26 21:07:36 -03:00
parent 0fa6ec4ed3
commit 8d9c85d379
18 changed files with 662 additions and 8 deletions
+4 -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 = 4;
export const PROTOCOL_VERSION = 5;
export interface PlayerInfo {
id: string;
@@ -123,7 +123,9 @@ export type ServerMessage =
| { type: "screen_properties"; properties: Record<string, number> }
| { type: "close_screen" }
// the world time, every second and when it's changed. clients count ticks in between
| { type: "time"; time: number };
| { type: "time"; time: number }
// the player's own health, hunger and saturation, when they change
| { type: "vitals"; health: number; food: number; saturation: number };
export const MAX_NAME_LENGTH = 16;
export const MAX_CHAT_LENGTH = 256;