chore: Move Player ghosting functionality to GhostComponent (#1413)

* Moving and organizing Player code

- Move code to CharacterComponent
- Remove extraneous interfaces
- Simplify some code greatly
- Change some types to return and take in const ref (only structs larger than 8 bytes benefit from this change.)
- Update code to use CharacterComponent for sending to zone instead of Player*.

* Moving and organizing Player code

- Move code to CharacterComponent
- Remove extraneous interfaces
- Simplify some code greatly
- Change some types to return and take in const ref (only structs larger than 8 bytes benefit from this change.)
- Update code to use CharacterComponent for sending to zone instead of Player*.
- Remove static storage container (static containers can be destroyed before exit/terminate handler executes)

* remove player cast

* Remove extra includes

* Add a player manager

Used for the static Player functions.  Further removes stuff from the Player class/file.

* chore: Move ghosting functionality to component

Tested that ghosting still works and players are still firing off the OnPlayerLeave and relevant handlers.

* move to unordered_set
This commit is contained in:
David Markowitz
2024-01-14 11:10:13 -08:00
committed by GitHub
parent 0a30430c4f
commit c83ec8228c
10 changed files with 138 additions and 144 deletions

View File

@@ -26,14 +26,6 @@ public:
const NiQuaternion& GetRespawnRotation() const override { return m_respawnRot; };
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; };
std::map<LWOOBJID, Loot::Info>& GetDroppedLoot() { return m_DroppedLoot; };
uint64_t GetDroppedCoins() const { return m_DroppedCoins; };
@@ -42,8 +34,6 @@ public:
* Setters
*/
void SetGhostOverride(bool value) { m_GhostOverride = value; };
void SetDroppedCoins(const uint64_t value) { m_DroppedCoins = value; };
void SetSystemAddress(const SystemAddress& value) override;
@@ -52,26 +42,10 @@ public:
void SetRespawnRot(const NiQuaternion& rotation) override;
void SetGhostReferencePoint(const NiPoint3& value);
void SetGhostOverridePoint(const NiPoint3& value);
/**
* Ghosting
*/
void AddLimboConstruction(LWOOBJID objectId);
void RemoveLimboConstruction(LWOOBJID objectId);
void ConstructLimboEntities();
void ObserveEntity(const int32_t id);
bool IsObserved(const int32_t id);
void GhostEntity(const int32_t id);
~Player() override;
private:
SystemAddress m_SystemAddress;
@@ -82,16 +56,6 @@ private:
User* m_ParentUser;
NiPoint3 m_GhostReferencePoint;
NiPoint3 m_GhostOverridePoint;
bool m_GhostOverride;
std::vector<int32_t> m_ObservedEntities;
std::vector<LWOOBJID> m_LimboConstructions;
std::map<LWOOBJID, Loot::Info> m_DroppedLoot;
uint64_t m_DroppedCoins;