From 12efcd259c262ae5bb6e94a325466065face0fdd Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Thu, 1 Oct 2026 08:08:11 -0500 Subject: [PATCH] refactor(component): the switch reads its reset time and factions in LoadConfigData Co-Authored-By: Claude Opus 5.5 --- dGame/dComponents/SwitchComponent.cpp | 6 +++++- dGame/dComponents/SwitchComponent.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) 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;