refactor(component): the quickbuild reads its level config and spawns its activator in LoadConfigData

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-01 08:37:42 -05:00
parent db99190c31
commit e1c3c19c9a
2 changed files with 8 additions and 2 deletions

View File

@@ -33,7 +33,12 @@
QuickBuildComponent::QuickBuildComponent(Entity* const entity, const int32_t componentID) : Component{ entity, componentID } {
RegisterMsg(&QuickBuildComponent::OnRequestUse);
std::u16string checkPreconditions = entity->GetVar<std::u16string>(u"CheckPrecondition");
RegisterMsg(&QuickBuildComponent::OnGetObjectReportInfo);
}
// The level config: the precondition and the activator's position, then the activator
void QuickBuildComponent::LoadConfigData() {
std::u16string checkPreconditions = m_Parent->GetVar<std::u16string>(u"CheckPrecondition");
if (!checkPreconditions.empty()) {
m_Precondition = new PreconditionExpression(GeneralUtils::UTF16ToWTF8(checkPreconditions));
@@ -51,7 +56,6 @@ QuickBuildComponent::QuickBuildComponent(Entity* const entity, const int32_t com
}
SpawnActivator();
RegisterMsg(&QuickBuildComponent::OnGetObjectReportInfo);
}
QuickBuildComponent::~QuickBuildComponent() {

View File

@@ -25,6 +25,8 @@ public:
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD;
QuickBuildComponent(Entity* const entity, const int32_t componentID);
void LoadConfigData() override;
~QuickBuildComponent() override;
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;