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:
@@ -187,7 +187,7 @@ class DevServerWindow(QMainWindow):
|
||||
weather_layout = QGridLayout(weather_group)
|
||||
for index, (label, fw_console_arg) in enumerate(WEATHER_PRESETS):
|
||||
button = QPushButton(label)
|
||||
button.setToolTip(f"Runs `fw {fw_console_arg}` on player 1.")
|
||||
button.setToolTip(f"Runs `fw {fw_console_arg}` on the current world-state host.")
|
||||
button.clicked.connect(
|
||||
lambda _checked=False, console_arg=fw_console_arg: self._set_server_weather(console_arg)
|
||||
)
|
||||
@@ -205,8 +205,8 @@ class DevServerWindow(QMainWindow):
|
||||
layout.addWidget(time_group)
|
||||
|
||||
hint = QLabel(
|
||||
"Time is sent to all clients. Weather runs `fw <8-digit-id>` on player 1 only, "
|
||||
"then player 1 relays weather to other clients. Edit preset IDs in "
|
||||
"Time is sent to all clients. Weather runs `fw <8-digit-id>` on the current world-state host only, "
|
||||
"then the host relays weather to other clients. Edit preset IDs in "
|
||||
"server/world_state_presets.py to match what works in your console."
|
||||
)
|
||||
hint.setWordWrap(True)
|
||||
|
||||
@@ -207,7 +207,7 @@ class FalloutTogetherServer:
|
||||
self._started_at = time.time()
|
||||
# Each server run is a fresh session for player/host assignment.
|
||||
# Without this reset, restarts can leave stale host IDs and player IDs
|
||||
# > 1, which breaks weather commands gated to player 1.
|
||||
# > 1, which breaks weather authority handoff to the active host.
|
||||
self._next_player_id = 1
|
||||
self._world_state_host_player_id = None
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
# Each preset is (label, fw_console_arg).
|
||||
# `fw_console_arg` is passed directly to the in-game `fw` command on player 1
|
||||
# `fw_console_arg` is passed directly to the in-game `fw` command on the
|
||||
# current world-state host client
|
||||
# (8-digit hex form ID, not an editor name like CommonwealthRain).
|
||||
WEATHER_PRESETS: list[tuple[str, str]] = [
|
||||
("Clear", "0002b52a"),
|
||||
|
||||
Reference in New Issue
Block a user