From 7dfcd22a2eec9bf91998146b827faa765d5ca629 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Wed, 15 Jun 2022 22:59:30 -0700 Subject: [PATCH] Properly place build activator The build activator as a result of the previous changes was spawning at the wrong position. This commit pulls the activators position from the settings (should they exist) and sets them accordingly. --- dGame/dComponents/RebuildComponent.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dGame/dComponents/RebuildComponent.cpp b/dGame/dComponents/RebuildComponent.cpp index abee5e16..538fdeed 100644 --- a/dGame/dComponents/RebuildComponent.cpp +++ b/dGame/dComponents/RebuildComponent.cpp @@ -22,6 +22,16 @@ RebuildComponent::RebuildComponent(Entity* entity) : Component(entity) { { m_Precondition = new PreconditionExpression(GeneralUtils::UTF16ToWTF8(checkPreconditions)); } + + auto positionAsVector = GeneralUtils::SplitString(m_Parent->GetVarAsString(u"rebuild_activators"), 31); + if (positionAsVector.size() == 3) { + m_ActivatorPosition.x = std::stof(positionAsVector[0]); + m_ActivatorPosition.y = std::stof(positionAsVector[1]); + m_ActivatorPosition.z = std::stof(positionAsVector[2]); + } else { + m_ActivatorPosition = m_Parent->GetPosition(); + } + SpawnActivator(); } RebuildComponent::~RebuildComponent() {