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.
This commit is contained in:
EmosewaMC 2022-06-15 22:59:30 -07:00
parent 8bdd5b6e2c
commit 7dfcd22a2e

View File

@ -22,6 +22,16 @@ RebuildComponent::RebuildComponent(Entity* entity) : Component(entity) {
{ {
m_Precondition = new PreconditionExpression(GeneralUtils::UTF16ToWTF8(checkPreconditions)); 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() { RebuildComponent::~RebuildComponent() {