#ifndef __GHOSTCOMPONENT__H__ #define __GHOSTCOMPONENT__H__ #include "Component.h" #include "eReplicaComponentType.h" #include #include "PlayerMessages.h" class NiPoint3; namespace tinyxml2 { class XMLDocument; } class GhostComponent final : public Component { public: static inline const eReplicaComponentType ComponentType = eReplicaComponentType::GHOST; GhostComponent(Entity* parent, const int32_t componentID); ~GhostComponent() override; void SetGhostOverride(bool value) { m_GhostOverride = value; }; const NiPoint3& GetGhostReferencePoint() const { return m_GhostOverride ? m_GhostOverridePoint : m_GhostReferencePoint; }; const NiPoint3& GetOriginGhostReferencePoint() const { return m_GhostReferencePoint; }; const NiPoint3& GetGhostOverridePoint() const { return m_GhostOverridePoint; }; bool GetGhostOverride() const { return m_GhostOverride; }; void SetGhostReferencePoint(const NiPoint3& value); void SetGhostOverridePoint(const NiPoint3& value); void AddLimboConstruction(const LWOOBJID objectId); void RemoveLimboConstruction(const LWOOBJID objectId); void ConstructLimboEntities(); void ObserveEntity(const LWOOBJID id); bool IsObserved(const LWOOBJID id); void GhostEntity(const LWOOBJID id); // The client dropped every object it had (it reloaded the zone in place): nothing counts as sent to it any more void ForgetObservedEntities() { m_ObservedEntities.clear(); m_LimboConstructions.clear(); } // LWOGhostComponent::LoadFromSaveData: , whether the GM was invisible when the save was // written. The client reads the same element and hides its own character again once the scene has loaded. void LoadFromSaveData(const tinyxml2::XMLDocument& doc) override; // Writes while invisible. A visible character only has an element it already had set back to 0. void WriteSaveData(tinyxml2::XMLDocument& doc) override; bool IsGMInvisible() const { return m_IsGMInvisible; } bool OnToggleGMInvis(GameMessages::ToggleGMInvisEvent& event); bool OnGetGMInvis(GameMessages::GetGMInvis& msg); bool MsgGetObjectReportInfo(GameMessages::GetObjectReportInfo& msg); private: NiPoint3 m_GhostReferencePoint; NiPoint3 m_GhostOverridePoint; std::unordered_set m_ObservedEntities; std::unordered_set m_LimboConstructions; bool m_GhostOverride; bool m_IsGMInvisible{ false }; }; #endif //!__GHOSTCOMPONENT__H__