Files
Commonwealth-Online-Public/plugin/include/F4TRemotePlayerState.h
T
andrew 4ed671464e Add Pip-Boy state to transform sync
Adds optional `isPipboyOpen` to transform packets, remote player state, proxy animation logging, and fake client/player samples. Updates protocol and architecture docs to describe the new Pip-Boy open/raising/closing state and related movement-state handling.
2026-06-30 16:00:07 +12:00

108 lines
3.0 KiB
C++

#pragma once
#include <chrono>
#include <cstdint>
#include <optional>
#include <string>
#include <vector>
namespace F4T::RemotePlayerState
{
// Represents a remote action event captured from another player
// Used for action replay on proxy actors (combat idles, equipping, etc.)
struct RemoteActionEvent
{
std::uint32_t type{}; // Action type (see ActorMediator::ActorAction enum)
std::string eventName; // Action event name (e.g., "ActorMovementStart")
std::vector<float> animationVariablesFloat; // Float variables snapshot (Speed, Direction, etc.)
std::vector<bool> animationVariablesBool; // Bool variables snapshot (IsSprinting, IsSneaking, etc.)
std::vector<std::uint32_t> animationVariablesInt; // Int variables snapshot (weapon types, etc.)
std::uint32_t actorStateFlags1{}; // ActorState.flags1 at action time
std::uint32_t actorStateFlags2{}; // ActorState.flags2 at action time
std::chrono::steady_clock::time_point captureTime{};
};
struct RemoteEquippedItem
{
std::string slot;
std::uint32_t formId{};
};
struct RemoteAppearanceMorph
{
std::uint32_t id{};
float value{};
};
struct RemoteAppearanceTintColor
{
std::uint8_t r{};
std::uint8_t g{};
std::uint8_t b{};
std::uint8_t a{};
};
struct RemoteAppearanceMorphWeight
{
float thin{};
float muscular{};
float large{};
};
struct RemoteAppearance
{
std::uint32_t version{ 1 };
std::uint32_t raceFormId{};
float height{ 1.0F };
RemoteAppearanceMorphWeight morphWeight;
RemoteAppearanceTintColor bodyTintColor;
std::uint32_t hairColorFormId{};
std::uint32_t facialHairColorFormId{};
std::vector<std::uint32_t> headPartFormIds;
std::vector<RemoteAppearanceMorph> morphSliders;
};
struct RemotePlayerState
{
std::uint32_t playerId{};
float x{};
float y{};
float z{};
float angleZ{};
std::string movementType;
std::string cellId;
std::string worldspaceId;
std::optional<double> clientTime;
std::optional<double> serverTime;
bool isMoving{ false };
bool isSprinting{ false };
bool isSneaking{ false };
bool isJumping{ false };
bool isCrouching{ false };
bool weaponDrawn{ false };
bool isPipboyOpen{ false };
float movementSpeed{ 0.0F };
float animationGraphSpeed{ -1.0F };
bool hasEquipmentUpdate{ false };
std::vector<RemoteEquippedItem> equippedItems;
bool hasAppearanceUpdate{ false };
RemoteAppearance appearance;
std::chrono::steady_clock::time_point lastReceivedLocalTime{};
// Phase 2: Actor state and action events (TiltedEvolution alignment)
std::uint32_t actorStateFlags1{};
std::uint32_t actorStateFlags2{};
std::vector<RemoteActionEvent> actionEvents;
};
void SetAssignedPlayerId(std::uint32_t a_playerId);
std::optional<std::uint32_t> GetAssignedPlayerId();
bool IsAssignedPlayerId(std::uint32_t a_playerId);
void ClearAssignedPlayerId();
void UpdateRemotePlayer(RemotePlayerState a_state);
bool RemoveRemotePlayer(std::uint32_t a_playerId);
void ClearRemotePlayers();
std::vector<RemotePlayerState> GetRemotePlayerSnapshot();
}