mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-19 18:25:27 +00:00
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:
@@ -33,7 +33,12 @@
|
|||||||
|
|
||||||
QuickBuildComponent::QuickBuildComponent(Entity* const entity, const int32_t componentID) : Component{ entity, componentID } {
|
QuickBuildComponent::QuickBuildComponent(Entity* const entity, const int32_t componentID) : Component{ entity, componentID } {
|
||||||
RegisterMsg(&QuickBuildComponent::OnRequestUse);
|
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()) {
|
if (!checkPreconditions.empty()) {
|
||||||
m_Precondition = new PreconditionExpression(GeneralUtils::UTF16ToWTF8(checkPreconditions));
|
m_Precondition = new PreconditionExpression(GeneralUtils::UTF16ToWTF8(checkPreconditions));
|
||||||
@@ -51,7 +56,6 @@ QuickBuildComponent::QuickBuildComponent(Entity* const entity, const int32_t com
|
|||||||
}
|
}
|
||||||
|
|
||||||
SpawnActivator();
|
SpawnActivator();
|
||||||
RegisterMsg(&QuickBuildComponent::OnGetObjectReportInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickBuildComponent::~QuickBuildComponent() {
|
QuickBuildComponent::~QuickBuildComponent() {
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ public:
|
|||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD;
|
||||||
|
|
||||||
QuickBuildComponent(Entity* const entity, const int32_t componentID);
|
QuickBuildComponent(Entity* const entity, const int32_t componentID);
|
||||||
|
|
||||||
|
void LoadConfigData() override;
|
||||||
~QuickBuildComponent() override;
|
~QuickBuildComponent() override;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user