Fix GUI weather: valid IDs, defer & reset
Replace invalid Fallout 4 weather form IDs with valid ones (including fixing Clear from 0002852a -> 0002b52a) and update protocol examples and server presets accordingly. Change the plugin to re-queue/defer server weather payloads when the local assigned player ID is not yet available (so early GUI clicks are not dropped) and add a log entry when deferring. Reset player/host assignment on server startup (_next_player_id = 1 and clear _world_state_host_player_id) to avoid stale host IDs after restarts. Also update changelog and developer log entries describing the fixes and recommended manual testing steps.
This commit is contained in:
@@ -268,10 +268,11 @@ namespace
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool IsAssignedPlayerOne()
|
||||
void RequeueServerWorldState(F4T::WorldStateSync::PendingServerWorldState a_state)
|
||||
{
|
||||
const auto assignedPlayerId = F4T::RemotePlayerState::GetAssignedPlayerId();
|
||||
return assignedPlayerId && *assignedPlayerId == 1U;
|
||||
const std::scoped_lock lock(g_pendingMutex);
|
||||
g_pendingServerWorldState = std::move(a_state);
|
||||
g_hasPendingServerWorldState = true;
|
||||
}
|
||||
|
||||
bool ShouldSendTimeState(float a_gameHour, float a_gameDaysPassed)
|
||||
@@ -425,7 +426,16 @@ namespace
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsAssignedPlayerOne()) {
|
||||
const auto assignedPlayerId = F4T::RemotePlayerState::GetAssignedPlayerId();
|
||||
if (!assignedPlayerId) {
|
||||
RequeueServerWorldState(a_state);
|
||||
if (ShouldLog("server_world_state_weather_defer")) {
|
||||
LogInfo("Deferred server weather command until local player assignment is available.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (*assignedPlayerId != 1U) {
|
||||
if (ShouldLog("server_world_state_weather_skip")) {
|
||||
LogInfo("Ignored server weather command on non-player-1 client.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user