scaffold activity based components

This commit is contained in:
Aaron Kimbre 2023-06-23 10:30:03 -05:00
parent c78760db59
commit f27e0400e7
17 changed files with 105 additions and 15 deletions

View File

@ -0,0 +1,5 @@
#include "ActivityComponent.h"
ActivityComponent::ActivityComponent(Entity* parent) : Component(parent) {
}

View File

@ -0,0 +1,17 @@
#ifndef __ACTIVITYCOMPONENT__H__
#define __ACTIVITYCOMPONENT__H__
#include "Component.h"
#include "eReplicaComponentType.h"
class Entity;
class ActivityComponent : public Component {
public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::INVALID;
ActivityComponent(Entity* parent);
};
#endif //!__ACTIVITYCOMPONENT__H__

View File

@ -0,0 +1,5 @@
#include "BaseRacingControlComponent.h"
BaseRacingControlComponent::BaseRacingControlComponent(Entity* parent) : Component(parent) {
}

View File

@ -0,0 +1,16 @@
#ifndef __BASERACINGCONTROLCOMPONENT__H__
#define __BASERACINGCONTROLCOMPONENT__H__
#include "ScriptedActivityComponent.h"
#include "eReplicaComponentType.h"
class Entity;
class BaseRacingControlComponent : public ScriptedActivityComponent {
public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::RACING_CONTROL;
BaseRacingControlComponent(Entity* parent);
};
#endif //!__BASERACINGCONTROLCOMPONENT__H__

View File

@ -1,4 +1,6 @@
set(DGAME_DCOMPONENTS_SOURCES "BaseCombatAIComponent.cpp" set(DGAME_DCOMPONENTS_SOURCES "ActivityComponent.cpp"
"BaseCombatAIComponent.cpp"
"BaseRacingControlComponent.cpp"
"BouncerComponent.cpp" "BouncerComponent.cpp"
"BuffComponent.cpp" "BuffComponent.cpp"
"BuildBorderComponent.cpp" "BuildBorderComponent.cpp"
@ -30,6 +32,7 @@ set(DGAME_DCOMPONENTS_SOURCES "BaseCombatAIComponent.cpp"
"PropertyVendorComponent.cpp" "PropertyVendorComponent.cpp"
"ProximityMonitorComponent.cpp" "ProximityMonitorComponent.cpp"
"RacingControlComponent.cpp" "RacingControlComponent.cpp"
"RacingSoundTriggerComponent.cpp"
"RacingStatsComponent.cpp" "RacingStatsComponent.cpp"
"RailActivatorComponent.cpp" "RailActivatorComponent.cpp"
"QuickBuildComponent.cpp" "QuickBuildComponent.cpp"

View File

@ -0,0 +1,5 @@
#include "GateRushControlComponent.h"
GateRushControlComponent::GateRushControlComponent(Entity* parent) : BaseRacingControlComponent(parent) {
}

View File

@ -0,0 +1,15 @@
#ifndef __GATERUSHCONTROLCOMPONENT__H__
#define __GATERUSHCONTROLCOMPONENT__H__
#include "BaseRacingControlComponent.h"
#include "eReplicaComponentType.h"
class Entity;
class GateRushControlComponent : public BaseRacingControlComponent {
public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::GATE_RUSH_CONTROL;
GateRushControlComponent(Entity* parent);
};
#endif //!__GATERUSHCONTROLCOMPONENT__H__

View File

@ -1,5 +1,5 @@
#include "ItemComponent.h" #include "ItemComponent.h"
ItemComponent::ItemComponent(Entity* parent) : Component(parent) { ItemComponent::ItemComponent(Entity* parent) : Component(parent) {
} }

View File

@ -1,11 +1,15 @@
#include "Component.h" #ifndef __MINIGAMECONTROLCOMPONENT__H__
#define __MINIGAMECONTROLCOMPONENT__H__
#include "ActivityComponent.h"
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
class Entity; class Entity;
class MinigameControlComponent : public Component { class MinigameControlComponent : public ActivityComponent {
public: public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MINIGAME_CONTROL; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MINIGAME_CONTROL;
MinigameControlComponent(Entity* parent); MinigameControlComponent(Entity* parent);
}; };
#endif //!__MINIGAMECONTROLCOMPONENT__H__

View File

@ -8,7 +8,7 @@
#include "NiPoint3.h" #include "NiPoint3.h"
#include "ScriptedActivityComponent.h" #include "ScriptedActivityComponent.h"
#include "Preconditions.h" #include "Preconditions.h"
#include "Component.h" #include "ActivityComponent.h"
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
#include "eRebuildState.h" #include "eRebuildState.h"
@ -20,7 +20,7 @@ enum class eQuickBuildFailReason : uint32_t;
* consists of an activator that shows a popup and then the actual entity that the bricks are built into. Note * consists of an activator that shows a popup and then the actual entity that the bricks are built into. Note
* that quick builds are also scripted activities so this shared some logic with the ScriptedActivityComponent. * that quick builds are also scripted activities so this shared some logic with the ScriptedActivityComponent.
*/ */
class QuickBuildComponent : public Component { class QuickBuildComponent : public ActivityComponent {
public: public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD;

View File

@ -29,8 +29,7 @@
#define M_PI 3.14159265358979323846264338327950288 #define M_PI 3.14159265358979323846264338327950288
#endif #endif
RacingControlComponent::RacingControlComponent(Entity* parent) RacingControlComponent::RacingControlComponent(Entity* parent) : BaseRacingControlComponent(parent) {
: Component(parent) {
m_PathName = u"MainPath"; m_PathName = u"MainPath";
m_RemainingLaps = 3; m_RemainingLaps = 3;
m_LeadingPlayer = LWOOBJID_EMPTY; m_LeadingPlayer = LWOOBJID_EMPTY;

View File

@ -6,7 +6,7 @@
#include "BitStream.h" #include "BitStream.h"
#include "Entity.h" #include "Entity.h"
#include "Component.h" #include "BaseRacingControlComponent.h"
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
/** /**
@ -103,7 +103,7 @@ struct RacingPlayerInfo {
/** /**
* Component that's attached to a manager entity in each race zone that loads player vehicles, keep scores, etc. * Component that's attached to a manager entity in each race zone that loads player vehicles, keep scores, etc.
*/ */
class RacingControlComponent : public Component { class RacingControlComponent : public BaseRacingControlComponent {
public: public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::RACING_CONTROL; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::RACING_CONTROL;

View File

@ -0,0 +1,15 @@
#ifndef __RACINGSOUNDTRIGGERCOMPONENT__H__
#define __RACINGSOUNDTRIGGERCOMPONENT__H__
#include "SoundTriggerComponent.h"
#include "eReplicaComponentType.h"
class Entity;
class RacingSoundTriggerComponent : public SoundTriggerComponent {
public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::RACING_SOUND_TRIGGER;
RacingSoundTriggerComponent(Entity* parent);
};
#endif //!__RACINGSOUNDTRIGGERCOMPONENT__H__

View File

@ -2,7 +2,7 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "ScriptedActivityComponent.h" #include "ScriptedActivityComponent.h"
ShootingGalleryComponent::ShootingGalleryComponent(Entity* parent) : Component(parent) { ShootingGalleryComponent::ShootingGalleryComponent(Entity* parent) : ActivityComponent(parent) {
} }
ShootingGalleryComponent::~ShootingGalleryComponent() = default; ShootingGalleryComponent::~ShootingGalleryComponent() = default;

View File

@ -2,7 +2,7 @@
#include "dCommonVars.h" #include "dCommonVars.h"
#include "NiPoint3.h" #include "NiPoint3.h"
#include "Entity.h" #include "Entity.h"
#include "Component.h" #include "ActivityComponent.h"
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
/** /**
@ -71,7 +71,7 @@ struct StaticShootingGalleryParams {
* A very ancient component that was used to guide shooting galleries, it's still kind of used but a lot of logic is * A very ancient component that was used to guide shooting galleries, it's still kind of used but a lot of logic is
* also in the related scripts. * also in the related scripts.
*/ */
class ShootingGalleryComponent : public Component { class ShootingGalleryComponent : public ActivityComponent {
public: public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SHOOTING_GALLERY; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SHOOTING_GALLERY;

View File

@ -71,6 +71,8 @@
#include "MinigameControlComponent.h" #include "MinigameControlComponent.h"
#include "ItemComponent.h" #include "ItemComponent.h"
#include "DonationVendorComponent.h" #include "DonationVendorComponent.h"
#include "GateRushControlComponent.h"
#include "RacingSoundTriggerComponent.h"
// Table includes // Table includes
#include "CDComponentsRegistryTable.h" #include "CDComponentsRegistryTable.h"
@ -418,6 +420,12 @@ void Entity::Initialize() {
AddComponent<ProximityMonitorComponent>(); AddComponent<ProximityMonitorComponent>();
} }
break; break;
case eReplicaComponentType::GATE_RUSH_CONTROL:
AddComponent<GateRushControlComponent>();
break;
case eReplicaComponentType::RACING_SOUND_TRIGGER:
AddComponent<RacingSoundTriggerComponent>();
break;
case eReplicaComponentType::GHOST: case eReplicaComponentType::GHOST:
case eReplicaComponentType::SPAWN: case eReplicaComponentType::SPAWN:
case eReplicaComponentType::MODULAR_BUILD: case eReplicaComponentType::MODULAR_BUILD:
@ -459,7 +467,6 @@ void Entity::Initialize() {
case eReplicaComponentType::DROPPED_LOOT: case eReplicaComponentType::DROPPED_LOOT:
case eReplicaComponentType::FACTION_TRIGGER: case eReplicaComponentType::FACTION_TRIGGER:
case eReplicaComponentType::BBB: case eReplicaComponentType::BBB:
case eReplicaComponentType::RACING_SOUND_TRIGGER:
case eReplicaComponentType::CHAT_BUBBLE: case eReplicaComponentType::CHAT_BUBBLE:
case eReplicaComponentType::FRIENDS_LIST: case eReplicaComponentType::FRIENDS_LIST:
case eReplicaComponentType::GUILD: case eReplicaComponentType::GUILD:
@ -480,7 +487,6 @@ void Entity::Initialize() {
case eReplicaComponentType::INTERACTION_MANAGER: case eReplicaComponentType::INTERACTION_MANAGER:
case eReplicaComponentType::COMBAT_MEDIATOR: case eReplicaComponentType::COMBAT_MEDIATOR:
case eReplicaComponentType::ACHIEVEMENT_VENDOR: case eReplicaComponentType::ACHIEVEMENT_VENDOR:
case eReplicaComponentType::GATE_RUSH_CONTROL:
case eReplicaComponentType::ROLLER: case eReplicaComponentType::ROLLER:
case eReplicaComponentType::PLAYER_FORCED_MOVEMENT: case eReplicaComponentType::PLAYER_FORCED_MOVEMENT:
case eReplicaComponentType::CRAFTING: case eReplicaComponentType::CRAFTING: