Send world/item UI metadata in welcome and consume on client

This commit is contained in:
Jage9
2026-02-21 19:12:58 -05:00
parent 4f04e735da
commit 008de60727
9 changed files with 274 additions and 42 deletions

View File

@@ -18,7 +18,7 @@ This is a behavior guide for packet semantics beyond raw schemas.
## Server -> Client
- `welcome`: initial snapshot with users/items.
- `welcome`: initial snapshot with users/items plus server UI/world metadata.
- `signal`: forwarded WebRTC offer/answer/ICE.
- `update_position`, `update_nickname`, `user_left`: presence updates.
- `chat_message`: system and user chat stream.
@@ -35,6 +35,17 @@ This is a behavior guide for packet semantics beyond raw schemas.
- `item_action_result` messages are intended for direct screen-reader/user status feedback.
- `item_use_sound` contains absolute item world coordinates (`x`, `y`) and sound path.
## Welcome Metadata
- `welcome.worldConfig.gridSize`: server-authoritative grid size used by clients for bounds/drawing.
- `welcome.uiDefinitions`: server-provided item UI definitions:
- `itemTypeOrder`: add-item menu order
- `itemTypes[].editableProperties`: editable property keys by item type
- `itemTypes[].propertyOptions`: menu options for property keys (for example clock `timeZone`)
- `itemTypes[].globalProperties`: non-editable global values (`useSound`, `emitSound`, `useCooldownMs`)
- Clients keep local fallback defaults but should prefer server-provided metadata when present.
## Validation Boundaries
- Server is authoritative for all action validation and normalization.