mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-19 18:25:27 +00:00
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:
@@ -12,9 +12,13 @@ SwitchComponent::SwitchComponent(Entity* parent, const int32_t componentID) : Co
|
|||||||
RegisterMsg(&SwitchComponent::OnRequestUse);
|
RegisterMsg(&SwitchComponent::OnRequestUse);
|
||||||
m_Active = false;
|
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_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':');
|
const auto factions = GeneralUtils::SplitString(m_Parent->GetVar<std::u16string>(u"respond_to_faction"), u':');
|
||||||
for (const auto& faction : factions) {
|
for (const auto& faction : factions) {
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public:
|
|||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SWITCH;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SWITCH;
|
||||||
|
|
||||||
SwitchComponent(Entity* parent, const int32_t componentID);
|
SwitchComponent(Entity* parent, const int32_t componentID);
|
||||||
|
|
||||||
|
void LoadConfigData() override;
|
||||||
~SwitchComponent() override;
|
~SwitchComponent() override;
|
||||||
|
|
||||||
void Run(float deltaTime) override;
|
void Run(float deltaTime) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user