Introduce a server-authoritative world-state packet to control weather and time from the dev server GUI. Adds protocol docs and message type (serverWorldState), a new Weather/Time tab in dev_server_app.py, server-side broadcasting in server_core.py, and preset utilities in server/world_state_presets.py. Plugin changes (F4TNetworking.cpp, F4TWorldStateSync.*) queue and apply incoming serverWorldState on the game thread, run `set gamehour` for all clients, and run `fw <8-digit-id>` on the assigned player 1 then force the host to relay a worldState snapshot. Also includes parsing/validation of hex form IDs, logging improvements, and minimal fake client handling. This ensures consistent server-driven time/weather and documents usage and presets.
34 lines
813 B
C++
34 lines
813 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace F4T::WorldStateSync
|
|
{
|
|
struct PendingWorldState
|
|
{
|
|
float gameHour{ 0.0F };
|
|
float gameDaysPassed{ 0.0F };
|
|
std::optional<std::uint32_t> weatherFormId;
|
|
bool hasWeatherFormId{ false };
|
|
bool applyTime{ false };
|
|
};
|
|
|
|
struct PendingServerWorldState
|
|
{
|
|
std::optional<std::string> timeHHmm;
|
|
std::optional<std::string> weatherFormId;
|
|
std::optional<std::string> weatherConsoleArg;
|
|
};
|
|
|
|
bool IsWorldStateHost();
|
|
std::optional<std::uint32_t> GetWorldStateHostPlayerId();
|
|
void SetWorldStateHostPlayerId(std::uint32_t a_hostPlayerId);
|
|
void Reset();
|
|
void SetPendingWorldState(PendingWorldState a_state);
|
|
void SetPendingServerWorldState(PendingServerWorldState a_state);
|
|
void PollHostCapture();
|
|
void ApplyPendingState();
|
|
}
|