Use world-state host for server weather actions
Stop hardcoding player 1 for server-initiated weather/time and instead use the current world-state host. Plugin code now defers weather commands until GetWorldStateHostPlayerId() is available, uses IsWorldStateHost() to gate execution, logs local/host IDs, and requeues when host assignment is missing. Relay logic now attempts ForceHostWorldStateBroadcast and logs if relay fails. Updated protocol docs, dev server UI tooltips, presets comment, changelog, and dev log to reflect world-state host terminology and behavior. This ensures weather/time control survives host reassignment and avoids dropped commands on reconnect/restart.
This commit is contained in:
@@ -5,7 +5,7 @@ Server-authoritative weather and time control from the dev server GUI.
|
||||
## Authority
|
||||
|
||||
- **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.
|
||||
- **Weather** (`weatherConsoleArg`): sent to **all** clients, but only the current **world-state host** runs `fw <8-digit-id>`. The host then relays usual `worldState` updates to other clients.
|
||||
|
||||
## Packet Format
|
||||
|
||||
@@ -19,7 +19,7 @@ Time-only (all clients):
|
||||
}
|
||||
```
|
||||
|
||||
Weather (all clients receive; only player 1 acts):
|
||||
Weather (all clients receive; only world-state host acts):
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -36,16 +36,16 @@ Weather (all clients receive; only player 1 acts):
|
||||
|-------|------|----------|-------------|
|
||||
| `type` | string | yes | Must be `"serverWorldState"` |
|
||||
| `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) |
|
||||
| `weatherConsoleArg` | string | no | Exact argument for `fw` on the current world-state host (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 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:** only the current world-state host 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`.
|
||||
- After the host runs `fw`, it immediately relays `worldState` with `weatherFormId`.
|
||||
|
||||
Edit `server/world_state_presets.py` so each preset uses the exact `fw` ID that works in your console (for example `0000015e`).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user