Convert HHmm to Fallout game-hour float
Add parsing and application of HHmm time strings as Fallout game-hour floats so GUI time presets apply correctly. Introduce ParseHHmmToGameHour in plugin/src/F4TWorldStateSync.cpp and use it when building the console command (formats as set gamehour to <float> with fallback to the raw HHmm string if parsing fails). Improve logging to indicate when a parsed HHmm was used. Update protocol/server-world-state.md, changelog.md, and docs/dev-log.md to document the behavior and rationale.
This commit is contained in:
@@ -4,7 +4,7 @@ Server-authoritative weather and time control from the dev server GUI.
|
||||
|
||||
## Authority
|
||||
|
||||
- **Time** (`timeHHmm`): sent to **all** clients; each runs `set gamehour to HHmm`.
|
||||
- **Time** (`timeHHmm`): sent to **all** clients; each converts `HHmm` to Fallout game-hour float (for example `2200 -> 22.0`, `1830 -> 18.5`) before applying.
|
||||
- **Weather** (`weatherConsoleArg`): sent to **all** clients, but only **player 1** runs `fw <8-digit-id>`. Player 1 should also be the world-state host so the usual `worldState` relay updates other clients.
|
||||
|
||||
## Packet Format
|
||||
@@ -35,14 +35,14 @@ Weather (all clients receive; only player 1 acts):
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `type` | string | yes | Must be `"serverWorldState"` |
|
||||
| `timeHHmm` | string | no | 24-hour clock value for `set gamehour to HHmm` |
|
||||
| `timeHHmm` | string | no | 24-hour clock value (HHmm) converted client-side to game-hour float for `set gamehour to <float>` |
|
||||
| `weatherConsoleArg` | string | no | Exact argument for `fw` on player 1 (8-digit lowercase hex) |
|
||||
| `weatherFormId` | string | no | Relay form ID used in host `worldState` broadcast |
|
||||
| `serverTime` | number (double) | no | Relay timestamp |
|
||||
|
||||
## Client Apply Rules
|
||||
|
||||
- **Time:** all clients apply `set gamehour to HHmm` on the game thread.
|
||||
- **Time:** all clients convert `timeHHmm` to game-hour float and apply `set gamehour to <float>` on the game thread.
|
||||
- **Weather:** only the client with assigned `playerId == 1` runs `fw <weatherConsoleArg>`.
|
||||
- Weather commands are scheduled on the F4SE game thread from the network receive path.
|
||||
- After player 1 runs `fw`, the world-state host immediately relays `worldState` with `weatherFormId`.
|
||||
|
||||
Reference in New Issue
Block a user