diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index 79512737..16b2f0af 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -562,19 +562,6 @@ void Entity::Initialize() comp->SetPostImaginationCost(rebCompData[0].post_imagination_cost); comp->SetTimeBeforeSmash(rebCompData[0].time_before_smash); - const auto rebuildActivatorValue = GetVarAsString(u"rebuild_activators"); - - if (!rebuildActivatorValue.empty()) { - std::vector split = GeneralUtils::SplitString(rebuildActivatorValue, 0x1f); - NiPoint3 pos; - - pos.x = std::stof(split[0]); - pos.y = std::stof(split[1]); - pos.z = std::stof(split[2]); - - comp->SetActivatorPosition(pos); - } - const auto rebuildResetTime = GetVar(u"rebuild_reset_time"); if (rebuildResetTime != 0.0f) { @@ -977,8 +964,8 @@ void Entity::WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacke } // Only serialize parent / child info should the info be dirty (changed) or if this is the construction of the entity. - outBitStream->Write((m_ParentEntity != nullptr || m_ChildEntities.size() > 0) && (m_IsParentChildDirty || packetType == PACKET_TYPE_CONSTRUCTION)); - if ((m_ParentEntity != nullptr || m_ChildEntities.size() > 0) && (m_IsParentChildDirty || packetType == PACKET_TYPE_CONSTRUCTION)) { + outBitStream->Write(m_IsParentChildDirty || packetType == PACKET_TYPE_CONSTRUCTION); + if (m_IsParentChildDirty || packetType == PACKET_TYPE_CONSTRUCTION) { m_IsParentChildDirty = false; outBitStream->Write(m_ParentEntity != nullptr); if (m_ParentEntity) { diff --git a/dGame/dComponents/RebuildComponent.cpp b/dGame/dComponents/RebuildComponent.cpp index 25b7eb1b..5e313a7a 100644 --- a/dGame/dComponents/RebuildComponent.cpp +++ b/dGame/dComponents/RebuildComponent.cpp @@ -24,15 +24,17 @@ RebuildComponent::RebuildComponent(Entity* entity) : Component(entity) { } // Should a setting that has the build activator position exist, fetch that setting here and parse it for position. - // It is assumed that the user who sets this setting uses the correct character delimiter (character 31) - 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]); + // It is assumed that the user who sets this setting uses the correct character delimiter (character 31 or in hex 0x1F) + auto positionAsVector = GeneralUtils::SplitString(m_Parent->GetVarAsString(u"rebuild_activators"), 0x1F); + if (positionAsVector.size() == 3 && + GeneralUtils::TryParse(positionAsVector[0], m_ActivatorPosition.x) && + GeneralUtils::TryParse(positionAsVector[1], m_ActivatorPosition.y) && + GeneralUtils::TryParse(positionAsVector[2], m_ActivatorPosition.z)) { } else { + Game::logger->Log("RebuildComponent", "Failed to find activator position for lot %i. Defaulting to parents position.\n", m_Parent->GetLOT()); m_ActivatorPosition = m_Parent->GetPosition(); } + SpawnActivator(); }