Rename RebuildComponent to QuickbuildComponent

This commit is contained in:
Aaron Kimbre
2023-06-09 17:12:57 -05:00
parent ddc5f0e117
commit a68fa69e7a
31 changed files with 155 additions and 155 deletions

View File

@@ -20,7 +20,7 @@
#include <vector>
#include "SkillComponent.h"
#include "RebuildComponent.h"
#include "QuickBuildComponent.h"
#include "DestroyableComponent.h"
#include "Metrics.hpp"
#include "CDComponentsRegistryTable.h"
@@ -244,7 +244,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
bool hadRemainingDowntime = m_SkillTime > 0.0f;
if (m_SkillTime > 0.0f) m_SkillTime -= deltaTime;
auto* rebuild = m_ParentEntity->GetComponent<RebuildComponent>();
auto* rebuild = m_ParentEntity->GetComponent<QuickBuildComponent>();
if (rebuild != nullptr) {
const auto state = rebuild->GetState();
@@ -562,7 +562,7 @@ bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const {
return false;
}
auto* quickbuild = entity->GetComponent<RebuildComponent>();
auto* quickbuild = entity->GetComponent<QuickBuildComponent>();
if (quickbuild != nullptr) {
const auto state = quickbuild->GetState();

View File

@@ -29,7 +29,7 @@ set(DGAME_DCOMPONENTS_SOURCES "BaseCombatAIComponent.cpp"
"RacingControlComponent.cpp"
"RacingStatsComponent.cpp"
"RailActivatorComponent.cpp"
"RebuildComponent.cpp"
"QuickBuildComponent.cpp"
"RenderComponent.cpp"
"RigidbodyPhantomPhysicsComponent.cpp"
"MultiZoneEntranceComponent.cpp"

View File

@@ -12,9 +12,9 @@ Legend
LWOActivityComponent
├── LWOShootingGalleryComponent
├── LWOScriptedActivityComponent
└── LWOBaseRacingControlComponent
├── LWORacingControlComponent
└── LWOGateRushControlComponent
| └── LWOBaseRacingControlComponent
| ├── LWORacingControlComponent
| └── LWOGateRushControlComponent
├── LWOQuickBuildComponent
├── LWOMiniGameControlComponent
LWOBaseCombatAIComponent
@@ -32,11 +32,11 @@ LWOBaseRenderComponent
├── LWOSkinnedRenderComponent
LWOBaseVendorComponent
├── LWOVendorComponent
├~~ LWOProximityMonitorComponent
| ├~~ LWOProximityMonitorComponent
├── LWODonationVendorComponent
├~~ LWOProximityMonitorComponent
| ├~~ LWOProximityMonitorComponent
├── LWOAchievementVendorComponent
├~~ LWOProximityMonitorComponent
| ├~~ LWOProximityMonitorComponent
LWOBBBComponent_Common
├── LWOBBBComponent_Client
LWOBlueprintComponent
@@ -51,7 +51,7 @@ LWOCharacterComponent
├~~ LWOPetCreatorComponent
├~~ LWOLevelProgressionComponent
├~~ LWOPlayerForcedMovementComponent
├~? LWOPathfindingControlComponent
| ├~? LWOPathfindingControlComponent
LWOChestComponent
LWOChoiceBuildComponent
LWOCollectibleComponent
@@ -68,7 +68,7 @@ LWOGhostComponent
LWOHFLightDirectionGadgetComponent
LWOInventoryComponent_Common
├── LWOInventoryComponent_Client
└── LWOInventoryComponent_EquippedItem
| └── LWOInventoryComponent_EquippedItem
LWOItemComponent
LWOLUPExhibitComponent
LWOMissionOfferComponent
@@ -91,7 +91,7 @@ LWOPetComponent
├~~ LWOPathfindingControlComponent
├~? LWOItemComponent
├~? LWOModelBehaviorComponent
├~~ ...
| ├~~ ...
LWOPlatformBoundaryComponent
LWOPlatformComponent
├-> LWOMoverPlatformSubComponent

View File

@@ -11,7 +11,7 @@
#include "CDClientManager.h"
#include "CDDestructibleComponentTable.h"
#include "EntityManager.h"
#include "RebuildComponent.h"
#include "QuickBuildComponent.h"
#include "CppScripts.h"
#include "Loot.h"
#include "Character.h"
@@ -82,11 +82,11 @@ void DestroyableComponent::Reinitialize(LOT templateID) {
int32_t buffComponentID = compRegistryTable->GetByIDAndType(templateID, eReplicaComponentType::BUFF);
int32_t collectibleComponentID = compRegistryTable->GetByIDAndType(templateID, eReplicaComponentType::COLLECTIBLE);
int32_t rebuildComponentID = compRegistryTable->GetByIDAndType(templateID, eReplicaComponentType::QUICK_BUILD);
int32_t quickBuildComponentID = compRegistryTable->GetByIDAndType(templateID, eReplicaComponentType::QUICK_BUILD);
int32_t componentID = 0;
if (collectibleComponentID > 0) componentID = collectibleComponentID;
if (rebuildComponentID > 0) componentID = rebuildComponentID;
if (quickBuildComponentID > 0) componentID = quickBuildComponentID;
if (buffComponentID > 0) componentID = buffComponentID;
CDDestructibleComponentTable* destCompTable = CDClientManager::Instance().GetTable<CDDestructibleComponentTable>();
@@ -499,7 +499,7 @@ bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignor
return false;
}
auto* targetQuickbuild = targetEntity->GetComponent<RebuildComponent>();
auto* targetQuickbuild = targetEntity->GetComponent<QuickBuildComponent>();
if (targetQuickbuild != nullptr) {
const auto state = targetQuickbuild->GetState();

View File

@@ -1,4 +1,4 @@
#include "RebuildComponent.h"
#include "QuickBuildComponent.h"
#include "Entity.h"
#include "DestroyableComponent.h"
#include "GameMessages.h"
@@ -24,7 +24,7 @@
#include "CppScripts.h"
RebuildComponent::RebuildComponent(Entity* entity) : Component(entity) {
QuickBuildComponent::QuickBuildComponent(Entity* entity) : Component(entity) {
std::u16string checkPreconditions = entity->GetVar<std::u16string>(u"CheckPrecondition");
if (!checkPreconditions.empty()) {
@@ -39,14 +39,14 @@ RebuildComponent::RebuildComponent(Entity* entity) : Component(entity) {
GeneralUtils::TryParse(positionAsVector[1], m_ActivatorPosition.y) &&
GeneralUtils::TryParse(positionAsVector[2], m_ActivatorPosition.z)) {
} else {
Game::logger->Log("RebuildComponent", "Failed to find activator position for lot %i. Defaulting to parents position.", m_ParentEntity->GetLOT());
Game::logger->Log("QuickBuildComponent", "Failed to find activator position for lot %i. Defaulting to parents position.", m_ParentEntity->GetLOT());
m_ActivatorPosition = m_ParentEntity->GetPosition();
}
SpawnActivator();
}
RebuildComponent::~RebuildComponent() {
QuickBuildComponent::~QuickBuildComponent() {
delete m_Precondition;
Entity* builder = GetBuilder();
@@ -57,7 +57,7 @@ RebuildComponent::~RebuildComponent() {
DespawnActivator();
}
void RebuildComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void QuickBuildComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
if (!m_ParentEntity->GetComponent<DestroyableComponent>()) {
if (bIsInitialUpdate) {
outBitStream->Write(false);
@@ -110,7 +110,7 @@ void RebuildComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitia
m_StateDirty = false;
}
void RebuildComponent::Update(float deltaTime) {
void QuickBuildComponent::Update(float deltaTime) {
m_Activator = GetActivator();
// Serialize the quickbuild every so often, fixes the odd bug where the quickbuild is not buildable
@@ -242,7 +242,7 @@ void RebuildComponent::Update(float deltaTime) {
}
}
void RebuildComponent::OnUse(Entity* originator) {
void QuickBuildComponent::OnUse(Entity* originator) {
if (GetBuilder() != nullptr || m_State == eRebuildState::COMPLETED) {
return;
}
@@ -254,7 +254,7 @@ void RebuildComponent::OnUse(Entity* originator) {
StartRebuild(originator);
}
void RebuildComponent::SpawnActivator() {
void QuickBuildComponent::SpawnActivator() {
if (!m_SelfActivator || m_ActivatorPosition != NiPoint3::ZERO) {
if (!m_Activator) {
EntityInfo info;
@@ -274,7 +274,7 @@ void RebuildComponent::SpawnActivator() {
}
}
void RebuildComponent::DespawnActivator() {
void QuickBuildComponent::DespawnActivator() {
if (m_Activator) {
EntityManager::Instance()->DestructEntity(m_Activator);
@@ -286,73 +286,73 @@ void RebuildComponent::DespawnActivator() {
}
}
Entity* RebuildComponent::GetActivator() {
Entity* QuickBuildComponent::GetActivator() {
return EntityManager::Instance()->GetEntity(m_ActivatorId);
}
NiPoint3 RebuildComponent::GetActivatorPosition() {
NiPoint3 QuickBuildComponent::GetActivatorPosition() {
return m_ActivatorPosition;
}
float RebuildComponent::GetResetTime() {
float QuickBuildComponent::GetResetTime() {
return m_ResetTime;
}
float RebuildComponent::GetCompleteTime() {
float QuickBuildComponent::GetCompleteTime() {
return m_CompleteTime;
}
int RebuildComponent::GetTakeImagination() {
int QuickBuildComponent::GetTakeImagination() {
return m_TakeImagination;
}
bool RebuildComponent::GetInterruptible() {
bool QuickBuildComponent::GetInterruptible() {
return m_Interruptible;
}
bool RebuildComponent::GetSelfActivator() {
bool QuickBuildComponent::GetSelfActivator() {
return m_SelfActivator;
}
std::vector<int> RebuildComponent::GetCustomModules() {
std::vector<int> QuickBuildComponent::GetCustomModules() {
return m_CustomModules;
}
int RebuildComponent::GetActivityId() {
int QuickBuildComponent::GetActivityId() {
return m_ActivityId;
}
int RebuildComponent::GetPostImaginationCost() {
int QuickBuildComponent::GetPostImaginationCost() {
return m_PostImaginationCost;
}
float RebuildComponent::GetTimeBeforeSmash() {
float QuickBuildComponent::GetTimeBeforeSmash() {
return m_TimeBeforeSmash;
}
eRebuildState RebuildComponent::GetState() {
eRebuildState QuickBuildComponent::GetState() {
return m_State;
}
Entity* RebuildComponent::GetBuilder() const {
Entity* QuickBuildComponent::GetBuilder() const {
auto* builder = EntityManager::Instance()->GetEntity(m_Builder);
return builder;
}
bool RebuildComponent::GetRepositionPlayer() const {
bool QuickBuildComponent::GetRepositionPlayer() const {
return m_RepositionPlayer;
}
void RebuildComponent::SetActivatorPosition(NiPoint3 value) {
void QuickBuildComponent::SetActivatorPosition(NiPoint3 value) {
m_ActivatorPosition = value;
}
void RebuildComponent::SetResetTime(float value) {
void QuickBuildComponent::SetResetTime(float value) {
m_ResetTime = value;
}
void RebuildComponent::SetCompleteTime(float value) {
void QuickBuildComponent::SetCompleteTime(float value) {
if (value < 0) {
m_CompleteTime = 4.5f;
} else {
@@ -360,31 +360,31 @@ void RebuildComponent::SetCompleteTime(float value) {
}
}
void RebuildComponent::SetTakeImagination(int value) {
void QuickBuildComponent::SetTakeImagination(int value) {
m_TakeImagination = value;
}
void RebuildComponent::SetInterruptible(bool value) {
void QuickBuildComponent::SetInterruptible(bool value) {
m_Interruptible = value;
}
void RebuildComponent::SetSelfActivator(bool value) {
void QuickBuildComponent::SetSelfActivator(bool value) {
m_SelfActivator = value;
}
void RebuildComponent::SetCustomModules(std::vector<int> value) {
void QuickBuildComponent::SetCustomModules(std::vector<int> value) {
m_CustomModules = value;
}
void RebuildComponent::SetActivityId(int value) {
void QuickBuildComponent::SetActivityId(int value) {
m_ActivityId = value;
}
void RebuildComponent::SetPostImaginationCost(int value) {
void QuickBuildComponent::SetPostImaginationCost(int value) {
m_PostImaginationCost = value;
}
void RebuildComponent::SetTimeBeforeSmash(float value) {
void QuickBuildComponent::SetTimeBeforeSmash(float value) {
if (value < 0) {
m_TimeBeforeSmash = 10.0f;
} else {
@@ -392,11 +392,11 @@ void RebuildComponent::SetTimeBeforeSmash(float value) {
}
}
void RebuildComponent::SetRepositionPlayer(bool value) {
void QuickBuildComponent::SetRepositionPlayer(bool value) {
m_RepositionPlayer = value;
}
void RebuildComponent::StartRebuild(Entity* user) {
void QuickBuildComponent::StartRebuild(Entity* user) {
if (m_State == eRebuildState::OPEN || m_State == eRebuildState::COMPLETED || m_State == eRebuildState::INCOMPLETE) {
m_Builder = user->GetObjectID();
@@ -429,7 +429,7 @@ void RebuildComponent::StartRebuild(Entity* user) {
}
}
void RebuildComponent::CompleteRebuild(Entity* user) {
void QuickBuildComponent::CompleteRebuild(Entity* user) {
if (user == nullptr) {
return;
}
@@ -439,7 +439,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
characterComponent->SetCurrentActivity(eGameActivity::NONE);
characterComponent->TrackRebuildComplete();
} else {
Game::logger->Log("RebuildComponent", "Some user tried to finish the rebuild but they didn't have a character somehow.");
Game::logger->Log("QuickBuildComponent", "Some user tried to finish the rebuild but they didn't have a character somehow.");
return;
}
@@ -521,7 +521,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
RenderComponent::PlayAnimation(user, u"rebuild-celebrate", 1.09f);
}
void RebuildComponent::ResetRebuild(bool failed) {
void QuickBuildComponent::ResetRebuild(bool failed) {
Entity* builder = GetBuilder();
if (m_State == eRebuildState::BUILDING && builder) {
@@ -556,7 +556,7 @@ void RebuildComponent::ResetRebuild(bool failed) {
}
}
void RebuildComponent::CancelRebuild(Entity* entity, eQuickBuildFailReason failReason, bool skipChecks) {
void QuickBuildComponent::CancelRebuild(Entity* entity, eQuickBuildFailReason failReason, bool skipChecks) {
if (m_State != eRebuildState::COMPLETED || skipChecks) {
m_Builder = LWOOBJID_EMPTY;
@@ -595,10 +595,10 @@ void RebuildComponent::CancelRebuild(Entity* entity, eQuickBuildFailReason failR
}
}
void RebuildComponent::AddRebuildCompleteCallback(const std::function<void(Entity* user)>& callback) {
void QuickBuildComponent::AddRebuildCompleteCallback(const std::function<void(Entity* user)>& callback) {
m_RebuildCompleteCallbacks.push_back(callback);
}
void RebuildComponent::AddRebuildStateCallback(const std::function<void(eRebuildState state)>& callback) {
void QuickBuildComponent::AddRebuildStateCallback(const std::function<void(eRebuildState state)>& callback) {
m_RebuildStateCallbacks.push_back(callback);
}

View File

@@ -1,5 +1,5 @@
#ifndef REBUILDCOMPONENT_H
#define REBUILDCOMPONENT_H
#ifndef __QUICKBUILDCOMPONENT__H__
#define __QUICKBUILDCOMPONENT__H__
#include <BitStream.h>
#include <vector>
@@ -20,12 +20,12 @@ 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
* that quick builds are also scripted activities so this shared some logic with the ScriptedActivityComponent.
*/
class RebuildComponent : public Component {
class QuickBuildComponent : public Component {
public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD;
RebuildComponent(Entity* entity);
~RebuildComponent() override;
QuickBuildComponent(Entity* entity);
~QuickBuildComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Update(float deltaTime) override;
@@ -362,4 +362,4 @@ private:
void CompleteRebuild(Entity* user);
};
#endif // REBUILDCOMPONENT_H
#endif //!__QUICKBUILDCOMPONENT__H__

View File

@@ -4,7 +4,7 @@
#include "CDRailActivatorComponent.h"
#include "Entity.h"
#include "GameMessages.h"
#include "RebuildComponent.h"
#include "QuickBuildComponent.h"
#include "Game.h"
#include "dLogger.h"
#include "RenderComponent.h"
@@ -43,13 +43,13 @@ RailActivatorComponent::RailActivatorComponent(Entity* parent, int32_t component
RailActivatorComponent::~RailActivatorComponent() = default;
void RailActivatorComponent::OnUse(Entity* originator) {
auto* rebuildComponent = m_ParentEntity->GetComponent<RebuildComponent>();
if (rebuildComponent != nullptr && rebuildComponent->GetState() != eRebuildState::COMPLETED)
auto* quickBuildComponent = m_ParentEntity->GetComponent<QuickBuildComponent>();
if (quickBuildComponent != nullptr && quickBuildComponent->GetState() != eRebuildState::COMPLETED)
return;
if (rebuildComponent != nullptr) {
if (quickBuildComponent != nullptr) {
// Don't want it to be destroyed while a player is using it
rebuildComponent->SetResetTime(rebuildComponent->GetResetTime() + 10.0f);
quickBuildComponent->SetResetTime(quickBuildComponent->GetResetTime() + 10.0f);
}
m_EntitiesOnRail.push_back(originator->GetObjectID());
@@ -59,7 +59,7 @@ void RailActivatorComponent::OnUse(Entity* originator) {
GameMessages::SendPlayFXEffect(originator->GetObjectID(), m_StartEffect.first, m_StartEffect.second,
std::to_string(m_StartEffect.first));
}
float animationLength = 0.5f;
if (!m_StartAnimation.empty()) {
animationLength = RenderComponent::PlayAnimation(originator, m_StartAnimation);
@@ -116,11 +116,11 @@ void RailActivatorComponent::OnCancelRailMovement(Entity* originator) {
true, true, true, true, true, true, true
);
auto* rebuildComponent = m_ParentEntity->GetComponent<RebuildComponent>();
auto* quickBuildComponent = m_ParentEntity->GetComponent<QuickBuildComponent>();
if (rebuildComponent != nullptr) {
if (quickBuildComponent != nullptr) {
// Set back reset time
rebuildComponent->SetResetTime(rebuildComponent->GetResetTime() - 10.0f);
quickBuildComponent->SetResetTime(quickBuildComponent->GetResetTime() - 10.0f);
}
if (std::find(m_EntitiesOnRail.begin(), m_EntitiesOnRail.end(), originator->GetObjectID()) != m_EntitiesOnRail.end()) {

View File

@@ -10,7 +10,7 @@ SwitchComponent::SwitchComponent(Entity* parent) : Component(parent) {
m_ResetTime = m_ParentEntity->GetVarAs<int32_t>(u"switch_reset_time");
m_Rebuild = m_ParentEntity->GetComponent<RebuildComponent>();
m_Rebuild = m_ParentEntity->GetComponent<QuickBuildComponent>();
}
SwitchComponent::~SwitchComponent() {

View File

@@ -5,7 +5,7 @@
#include "Entity.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "RebuildComponent.h"
#include "QuickBuildComponent.h"
#include "BouncerComponent.h"
#include <algorithm>
#include "Component.h"
@@ -75,7 +75,7 @@ private:
/**
* Attached rebuild component.
*/
RebuildComponent* m_Rebuild;
QuickBuildComponent* m_Rebuild;
/**
* If the switch is on or off.

View File

@@ -10,7 +10,7 @@
#include "MissionComponent.h"
#include "PhantomPhysicsComponent.h"
#include "Player.h"
#include "RebuildComponent.h"
#include "QuickBuildComponent.h"
#include "SkillComponent.h"
#include "eEndBehavior.h"
@@ -205,12 +205,12 @@ void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string arg
}
void TriggerComponent::HandleResetRebuild(Entity* targetEntity, std::string args){
auto* rebuildComponent = targetEntity->GetComponent<RebuildComponent>();
if (!rebuildComponent) {
auto* quickBuildComponent = targetEntity->GetComponent<QuickBuildComponent>();
if (!quickBuildComponent) {
Game::logger->LogDebug("TriggerComponent::HandleResetRebuild", "Rebuild component not found!");
return;
}
rebuildComponent->ResetRebuild(args == "1");
quickBuildComponent->ResetRebuild(args == "1");
}
void TriggerComponent::HandleMoveObject(Entity* targetEntity, std::vector<std::string> argArray){