Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename rebuild to quickbuild #1364

Merged
merged 2 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions dCommon/dEnums/eQuickBuildState.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef __EQUICKBUILDSTATE__H__
#define __EQUICKBUILDSTATE__H__

#include <cstdint>

enum class eQuickBuildState : uint32_t {
OPEN,
COMPLETED = 2,
RESETTING = 4,
BUILDING,
INCOMPLETE
};


#endif //!__EQUICKBUILDSTATE__H__
15 changes: 0 additions & 15 deletions dCommon/dEnums/eRebuildState.h

This file was deleted.

50 changes: 25 additions & 25 deletions dGame/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include "MovingPlatformComponent.h"
#include "MissionComponent.h"
#include "MissionOfferComponent.h"
#include "RebuildComponent.h"
#include "QuickBuildComponent.h"
#include "BuildBorderComponent.h"
#include "MovementAIComponent.h"
#include "VendorComponent.h"
Expand Down Expand Up @@ -327,11 +327,11 @@ void Entity::Initialize() {
* Multiple components require the destructible component.
*/
int buffComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BUFF);
int rebuildComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::QUICK_BUILD);
int quickBuildComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::QUICK_BUILD);

int componentID = -1;
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>();
Expand Down Expand Up @@ -521,50 +521,50 @@ void Entity::Initialize() {
}

if (int componentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::QUICK_BUILD) > 0) {
auto* rebuildComponent = AddComponent<RebuildComponent>();
auto* quickBuildComponent = AddComponent<QuickBuildComponent>();

CDRebuildComponentTable* rebCompTable = CDClientManager::Instance().GetTable<CDRebuildComponentTable>();
std::vector<CDRebuildComponent> rebCompData = rebCompTable->Query([=](CDRebuildComponent entry) { return (entry.id == rebuildComponentID); });
std::vector<CDRebuildComponent> rebCompData = rebCompTable->Query([=](CDRebuildComponent entry) { return (entry.id == quickBuildComponentID); });

if (rebCompData.size() > 0) {
rebuildComponent->SetResetTime(rebCompData[0].reset_time);
rebuildComponent->SetCompleteTime(rebCompData[0].complete_time);
rebuildComponent->SetTakeImagination(rebCompData[0].take_imagination);
rebuildComponent->SetInterruptible(rebCompData[0].interruptible);
rebuildComponent->SetSelfActivator(rebCompData[0].self_activator);
rebuildComponent->SetActivityId(rebCompData[0].activityID);
rebuildComponent->SetPostImaginationCost(rebCompData[0].post_imagination_cost);
rebuildComponent->SetTimeBeforeSmash(rebCompData[0].time_before_smash);
quickBuildComponent->SetResetTime(rebCompData[0].reset_time);
quickBuildComponent->SetCompleteTime(rebCompData[0].complete_time);
quickBuildComponent->SetTakeImagination(rebCompData[0].take_imagination);
quickBuildComponent->SetInterruptible(rebCompData[0].interruptible);
quickBuildComponent->SetSelfActivator(rebCompData[0].self_activator);
quickBuildComponent->SetActivityId(rebCompData[0].activityID);
quickBuildComponent->SetPostImaginationCost(rebCompData[0].post_imagination_cost);
quickBuildComponent->SetTimeBeforeSmash(rebCompData[0].time_before_smash);

const auto rebuildResetTime = GetVar<float>(u"rebuild_reset_time");

if (rebuildResetTime != 0.0f) {
rebuildComponent->SetResetTime(rebuildResetTime);
quickBuildComponent->SetResetTime(rebuildResetTime);

// Known bug with moving platform in FV that casues it to build at the end instead of the start.
// This extends the smash time so players can ride up the lift.
if (m_TemplateID == 9483) {
rebuildComponent->SetResetTime(rebuildComponent->GetResetTime() + 25);
quickBuildComponent->SetResetTime(quickBuildComponent->GetResetTime() + 25);
}
}

const auto activityID = GetVar<int32_t>(u"activityID");

if (activityID > 0) {
rebuildComponent->SetActivityId(activityID);
quickBuildComponent->SetActivityId(activityID);
Loot::CacheMatrix(activityID);
}

const auto timeBeforeSmash = GetVar<float>(u"tmeSmsh");

if (timeBeforeSmash > 0) {
rebuildComponent->SetTimeBeforeSmash(timeBeforeSmash);
quickBuildComponent->SetTimeBeforeSmash(timeBeforeSmash);
}

const auto compTime = GetVar<float>(u"compTime");

if (compTime > 0) {
rebuildComponent->SetCompleteTime(compTime);
quickBuildComponent->SetCompleteTime(compTime);
}
}
}
Expand Down Expand Up @@ -1125,14 +1125,14 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
baseCombatAiComponent->Serialize(outBitStream, bIsInitialUpdate);
}

RebuildComponent* rebuildComponent;
if (TryGetComponent(eReplicaComponentType::QUICK_BUILD, rebuildComponent)) {
QuickBuildComponent* quickBuildComponent;
if (TryGetComponent(eReplicaComponentType::QUICK_BUILD, quickBuildComponent)) {
DestroyableComponent* destroyableComponent;
if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate);
}
destroyableSerialized = true;
rebuildComponent->Serialize(outBitStream, bIsInitialUpdate);
quickBuildComponent->Serialize(outBitStream, bIsInitialUpdate);
}

MovingPlatformComponent* movingPlatformComponent;
Expand Down Expand Up @@ -1588,10 +1588,10 @@ void Entity::AddCollisionPhantomCallback(const std::function<void(Entity* target
m_PhantomCollisionCallbacks.push_back(callback);
}

void Entity::AddRebuildCompleteCallback(const std::function<void(Entity* user)>& callback) const {
auto* rebuildComponent = GetComponent<RebuildComponent>();
if (rebuildComponent != nullptr) {
rebuildComponent->AddRebuildCompleteCallback(callback);
void Entity::AddQuickBuildCompleteCallback(const std::function<void(Entity* user)>& callback) const {
auto* quickBuildComponent = GetComponent<QuickBuildComponent>();
if (quickBuildComponent != nullptr) {
quickBuildComponent->AddQuickBuildCompleteCallback(callback);
}
}

Expand Down
2 changes: 1 addition & 1 deletion dGame/Entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class Entity {

void Smash(const LWOOBJID source = LWOOBJID_EMPTY, const eKillType killType = eKillType::VIOLENT, const std::u16string& deathType = u"");
void Kill(Entity* murderer = nullptr, const eKillType killType = eKillType::SILENT);
void AddRebuildCompleteCallback(const std::function<void(Entity* user)>& callback) const;
void AddQuickBuildCompleteCallback(const std::function<void(Entity* user)>& callback) const;
void AddCollisionPhantomCallback(const std::function<void(Entity* target)>& callback);
void AddDieCallback(const std::function<void()>& callback);
void Resurrect();
Expand Down
2 changes: 1 addition & 1 deletion dGame/dBehaviors/AreaOfEffectBehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "Logger.h"
#include "BehaviorBranchContext.h"
#include "BehaviorContext.h"
#include "RebuildComponent.h"
aronwk-aaron marked this conversation as resolved.
Show resolved Hide resolved
#include "QuickBuildComponent.h"
#include "DestroyableComponent.h"
#include "Game.h"
#include "Logger.h"
Expand Down
6 changes: 3 additions & 3 deletions dGame/dBehaviors/BehaviorContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "DestroyableComponent.h"
#include "EchoSyncSkill.h"
#include "PhantomPhysicsComponent.h"
#include "RebuildComponent.h"
#include "QuickBuildComponent.h"
#include "eReplicaComponentType.h"
#include "TeamManager.h"
#include "eConnectionType.h"
Expand Down Expand Up @@ -412,8 +412,8 @@ bool BehaviorContext::CheckTargetingRequirements(const Entity* target) const {
if (!target) return false;

// ignore quickbuilds that aren't completed
auto* targetQuickbuildComponent = target->GetComponent<RebuildComponent>();
if (targetQuickbuildComponent && targetQuickbuildComponent->GetState() != eRebuildState::COMPLETED) return false;
auto* targetQuickbuildComponent = target->GetComponent<QuickBuildComponent>();
if (targetQuickbuildComponent && targetQuickbuildComponent->GetState() != eQuickBuildState::COMPLETED) return false;

return true;
}
Expand Down
8 changes: 4 additions & 4 deletions dGame/dBehaviors/SpawnBehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "Game.h"
#include "Logger.h"
#include "DestroyableComponent.h"
#include "RebuildComponent.h"
#include "QuickBuildComponent.h"
#include "Entity.h"
#include "EntityInfo.h"
#include "eReplicaComponentType.h"
Expand Down Expand Up @@ -53,10 +53,10 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
entity->SetOwnerOverride(context->originator);

// Unset the flag to reposition the player, this makes it harder to glitch out of the map
auto* rebuildComponent = entity->GetComponent<RebuildComponent>();
auto* quickBuildComponent = entity->GetComponent<QuickBuildComponent>();

if (rebuildComponent != nullptr) {
rebuildComponent->SetRepositionPlayer(false);
if (quickBuildComponent != nullptr) {
quickBuildComponent->SetRepositionPlayer(false);
}

Game::entityManager->ConstructEntity(entity);
Expand Down
2 changes: 1 addition & 1 deletion dGame/dBehaviors/TacArcBehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "BehaviorContext.h"
#include "BaseCombatAIComponent.h"
#include "EntityManager.h"
#include "RebuildComponent.h"
aronwk-aaron marked this conversation as resolved.
Show resolved Hide resolved
#include "QuickBuildComponent.h"
#include "DestroyableComponent.h"

#include <vector>
Expand Down
10 changes: 5 additions & 5 deletions dGame/dComponents/BaseCombatAIComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <vector>

#include "SkillComponent.h"
#include "RebuildComponent.h"
#include "QuickBuildComponent.h"
#include "DestroyableComponent.h"
#include "Metrics.hpp"
#include "CDComponentsRegistryTable.h"
Expand Down Expand Up @@ -243,12 +243,12 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
bool hadRemainingDowntime = m_SkillTime > 0.0f;
if (m_SkillTime > 0.0f) m_SkillTime -= deltaTime;

auto* rebuild = m_Parent->GetComponent<RebuildComponent>();
auto* rebuild = m_Parent->GetComponent<QuickBuildComponent>();

if (rebuild != nullptr) {
const auto state = rebuild->GetState();

if (state != eRebuildState::COMPLETED) {
if (state != eQuickBuildState::COMPLETED) {
return;
}
}
Expand Down Expand Up @@ -559,12 +559,12 @@ 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();

if (state != eRebuildState::COMPLETED) {
if (state != eQuickBuildState::COMPLETED) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion dGame/dComponents/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set(DGAME_DCOMPONENTS_SOURCES "BaseCombatAIComponent.cpp"
"ProximityMonitorComponent.cpp"
"RacingControlComponent.cpp"
"RailActivatorComponent.cpp"
"RebuildComponent.cpp"
"QuickBuildComponent.cpp"
"RenderComponent.cpp"
"RigidbodyPhantomPhysicsComponent.cpp"
"MultiZoneEntranceComponent.cpp"
Expand Down
2 changes: 1 addition & 1 deletion dGame/dComponents/CharacterComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ void CharacterComponent::TrackArmorDelta(int32_t armor) {
}
}

void CharacterComponent::TrackRebuildComplete() {
void CharacterComponent::TrackQuickBuildComplete() {
UpdatePlayerStatistic(QuickBuildsCompleted);

const auto mapID = Game::zoneManager->GetZoneID().GetMapID();
Expand Down
2 changes: 1 addition & 1 deletion dGame/dComponents/CharacterComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class CharacterComponent : public Component {
/**
* Handles completing a rebuild by updating the statistics
*/
void TrackRebuildComplete();
void TrackQuickBuildComplete();

/**
* Tracks a player completing the race, also updates stats
Expand Down
6 changes: 3 additions & 3 deletions dGame/dComponents/DestroyableComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -85,11 +85,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>();
Expand Down
4 changes: 2 additions & 2 deletions dGame/dComponents/MovingPlatformComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ void MovingPlatformComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
}
}

void MovingPlatformComponent::OnRebuildInitilized() {
void MovingPlatformComponent::OnQuickBuildInitilized() {
StopPathing();
}

void MovingPlatformComponent::OnCompleteRebuild() {
void MovingPlatformComponent::OnCompleteQuickBuild() {
if (m_NoAutoStart)
return;

Expand Down
4 changes: 2 additions & 2 deletions dGame/dComponents/MovingPlatformComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ class MovingPlatformComponent : public Component {
/**
* Stops all pathing, called when an entity starts a quick build associated with this platform
*/
void OnRebuildInitilized();
void OnQuickBuildInitilized();

/**
* Starts the pathing, called when an entity completed a quick build associated with this platform
*/
void OnCompleteRebuild();
void OnCompleteQuickBuild();

/**
* Updates the movement state for the moving platform
Expand Down
Loading
Loading