Skip to content

Commit

Permalink
Add ghost component (#1409)
Browse files Browse the repository at this point in the history
will be used to migrate other Player functionality in a future PR.

Tested that I can login still.
  • Loading branch information
EmosewaMC authored Jan 12, 2024
1 parent 929d029 commit 8b6fb8f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dGame/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
#include "RacingStatsComponent.h"
#include "CollectibleComponent.h"
#include "ItemComponent.h"
#include "GhostComponent.h"

// Table includes
#include "CDComponentsRegistryTable.h"
Expand Down Expand Up @@ -436,6 +437,8 @@ void Entity::Initialize() {
AddComponent<PlayerForcedMovementComponent>();

AddComponent<CharacterComponent>(m_Character)->LoadFromXml(m_Character->GetXMLDoc());

AddComponent<GhostComponent>();
}

if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::INVENTORY) > 0 || m_Character) {
Expand Down
1 change: 1 addition & 0 deletions dGame/dComponents/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set(DGAME_DCOMPONENTS_SOURCES
"ControllablePhysicsComponent.cpp"
"DestroyableComponent.cpp"
"DonationVendorComponent.cpp"
"GhostComponent.cpp"
"InventoryComponent.cpp"
"ItemComponent.cpp"
"LevelProgressionComponent.cpp"
Expand Down
4 changes: 4 additions & 0 deletions dGame/dComponents/GhostComponent.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "GhostComponent.h"

// TODO Move ghosting related code from Player to here
GhostComponent::GhostComponent(Entity* parent) : Component(parent) {}
13 changes: 13 additions & 0 deletions dGame/dComponents/GhostComponent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef __GHOSTCOMPONENT__H__
#define __GHOSTCOMPONENT__H__

#include "Component.h"
#include "eReplicaComponentType.h"

class GhostComponent : public Component {
public:
static inline const eReplicaComponentType ComponentType = eReplicaComponentType::GHOST;
GhostComponent(Entity* parent);
};

#endif //!__GHOSTCOMPONENT__H__

0 comments on commit 8b6fb8f

Please sign in to comment.