Files
Commonwealth-Online-Public/protocol/server-world-state.md
T
andrew 77751c69f7 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.
2026-06-25 10:48:18 +12:00

2.2 KiB

Server World State Packet

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 the current world-state host runs fw <8-digit-id>. The host then relays usual worldState updates to other clients.

Packet Format

Time-only (all clients):

{
  "type": "serverWorldState",
  "timeHHmm": "1900",
  "serverTime": 1780212128.301
}

Weather (all clients receive; only world-state host acts):

{
  "type": "serverWorldState",
  "weatherConsoleArg": "001ca7e4",
  "weatherFormId": "001CA7E4",
  "serverTime": 1780212128.301
}

Field Definitions

Field Type Required Description
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 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 current world-state host runs fw <weatherConsoleArg>.
  • Weather commands are scheduled on the F4SE game thread from the network receive path.
  • 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).

Preset Weather Console Args

Label Default fw arg
Clear 0002b52a
Cloudy 001cc186
Overcast 001c8556
Fog 001c3473
Rain 001ca7e4
Radstorm 001c3d5e
Glowing Sea 000f1033

Backward Compatibility

Older clients that do not handle serverWorldState ignore the packet safely.