#pragma once #include #include #include #include "F4AnimationDescriptor.h" #include "RE/A/Actor.h" #include "RE/A/ActorState.h" namespace F4T::RemoteActionComponent { // Represents a remote action event to be replayed on a proxy actor // Includes animation state snapshot and actor state at the time of capture struct RemoteActionSnapshot { std::uint32_t actionType{}; // Action enum value std::string eventName; // Human-readable event name AnimationDescriptor::AnimationVariableSnapshot animationVariables; // Graph variables at action time std::uint32_t actorStateFlags1{}; // Actor state flags1 at action time std::uint32_t actorStateFlags2{}; // Actor state flags2 at action time std::chrono::steady_clock::time_point captureTime{}; // When action was captured }; // Manages action queue for a single remote player's proxy actor // Queues discrete actions and replays them with proper state synchronization class RemoteActionQueue { public: // Initialize empty queue RemoteActionQueue() = default; // Prevent copies RemoteActionQueue(const RemoteActionQueue&) = delete; RemoteActionQueue& operator=(const RemoteActionQueue&) = delete; // Enable moves RemoteActionQueue(RemoteActionQueue&&) noexcept = default; RemoteActionQueue& operator=(RemoteActionQueue&&) noexcept = default; // Enqueue an action for replay void Enqueue(const RemoteActionSnapshot& a_action); // Clear all pending actions void Clear(); // Get number of pending actions std::size_t GetPendingActionCount() const { return m_actionQueue.size(); } // Replay next action on proxy actor // Returns true if an action was replayed, false if queue empty bool ReplayNextAction(RE::Actor& a_proxy); private: std::vector m_actionQueue; std::size_t m_maxQueueSize{ 16 }; // Prevent excessive queuing // Helper: Apply action state to proxy and trigger animation bool ApplyActionToProxy(RE::Actor& a_proxy, const RemoteActionSnapshot& a_action); // Helper: Set actor state flags from snapshot void ApplyActorStateFromSnapshot(RE::Actor& a_proxy, const RemoteActionSnapshot& a_action); // Helper: Load animation variables and trigger action animation void TriggerActionAnimation(RE::Actor& a_proxy, const RemoteActionSnapshot& a_action); }; }