diff --git a/dGame/dComponents/SwitchComponent.cpp b/dGame/dComponents/SwitchComponent.cpp index 8f9ec044a..7c38fba11 100644 --- a/dGame/dComponents/SwitchComponent.cpp +++ b/dGame/dComponents/SwitchComponent.cpp @@ -12,9 +12,13 @@ SwitchComponent::SwitchComponent(Entity* parent, const int32_t componentID) : Co RegisterMsg(&SwitchComponent::OnRequestUse); m_Active = false; + m_QuickBuild = m_Parent->GetComponent(); +} + +// The level config: the reset time and the factions this responds to +void SwitchComponent::LoadConfigData() { m_ResetTime = m_Parent->GetVarAs(u"switch_reset_time"); - m_QuickBuild = m_Parent->GetComponent(); const auto factions = GeneralUtils::SplitString(m_Parent->GetVar(u"respond_to_faction"), u':'); for (const auto& faction : factions) { diff --git a/dGame/dComponents/SwitchComponent.h b/dGame/dComponents/SwitchComponent.h index 0054c07fd..88763647e 100644 --- a/dGame/dComponents/SwitchComponent.h +++ b/dGame/dComponents/SwitchComponent.h @@ -19,6 +19,8 @@ public: static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SWITCH; SwitchComponent(Entity* parent, const int32_t componentID); + + void LoadConfigData() override; ~SwitchComponent() override; void Run(float deltaTime) override;