refactor(component): the switch reads its reset time and factions in LoadConfigData

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-01 08:08:11 -05:00
parent 90c7293189
commit 12efcd259c
2 changed files with 7 additions and 1 deletions

View File

@@ -12,9 +12,13 @@ SwitchComponent::SwitchComponent(Entity* parent, const int32_t componentID) : Co
RegisterMsg(&SwitchComponent::OnRequestUse);
m_Active = false;
m_QuickBuild = m_Parent->GetComponent<QuickBuildComponent>();
}
// The level config: the reset time and the factions this responds to
void SwitchComponent::LoadConfigData() {
m_ResetTime = m_Parent->GetVarAs<int32_t>(u"switch_reset_time");
m_QuickBuild = m_Parent->GetComponent<QuickBuildComponent>();
const auto factions = GeneralUtils::SplitString(m_Parent->GetVar<std::u16string>(u"respond_to_faction"), u':');
for (const auto& faction : factions) {

View File

@@ -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;