Merge pull request #1088 from EmosewaMC/movingPlatformsFix

Fix deserialization errors for MovingPlatforms
This commit is contained in:
Gie "Max" Vanommeslaeghe 2023-05-13 14:03:24 +02:00 committed by GitHub
commit 8a8006bee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -690,23 +690,11 @@ void Entity::Initialize() {
} }
std::string pathName = GetVarAsString(u"attached_path"); std::string pathName = GetVarAsString(u"attached_path");
const Path* path = dZoneManager::Instance()->GetZone()->GetPath(pathName);
//Check to see if we have an attached path and add the appropiate component to handle it: int32_t movingPlatformComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MOVING_PLATFORM, -1);
if (path){ if (movingPlatformComponentId >= 0 || !pathName.empty()) {
// if we have a moving platform path, then we need a moving platform component MovingPlatformComponent* plat = new MovingPlatformComponent(this, pathName);
if (path->pathType == PathType::MovingPlatform) { m_Components.insert(std::make_pair(eReplicaComponentType::MOVING_PLATFORM, plat));
MovingPlatformComponent* plat = new MovingPlatformComponent(this, pathName);
m_Components.insert(std::make_pair(eReplicaComponentType::MOVING_PLATFORM, plat));
// else if we are a movement path
} /*else if (path->pathType == PathType::Movement) {
auto movementAIcomp = GetComponent<MovementAIComponent>();
if (movementAIcomp){
// TODO: set path in existing movementAIComp
} else {
// TODO: create movementAIcomp and set path
}
}*/
} }
int proximityMonitorID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROXIMITY_MONITOR); int proximityMonitorID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROXIMITY_MONITOR);