mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-31 12:41:55 +00:00 
			
		
		
		
	add movementAI on load
This commit is contained in:
		| @@ -702,20 +702,20 @@ void Entity::Initialize() { | ||||
| 	const Path* path = Game::zoneManager->GetZone()->GetPath(pathName); | ||||
|  | ||||
| 	//Check to see if we have an attached path and add the appropiate component to handle it: | ||||
| 	if (path){ | ||||
| 	if (path) { | ||||
| 		// if we have a moving platform path, then we need a moving platform component | ||||
| 		if (path->pathType == PathType::MovingPlatform) { | ||||
| 			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) { | ||||
| 		} else if (path->pathType == PathType::Movement) { | ||||
| 			Game::logger->Log("Entity", "is movement %i", GetLOT()); | ||||
| 			auto movementAIcomp = GetComponent<MovementAIComponent>(); | ||||
| 			if (movementAIcomp){ | ||||
| 				// TODO: set path in existing movementAIComp | ||||
| 			} else { | ||||
| 				// TODO: create movementAIcomp and set path | ||||
| 			if (!movementAIcomp) { | ||||
| 				movementAIcomp = new MovementAIComponent(this, {}); | ||||
| 				m_Components.insert(std::make_pair(eReplicaComponentType::MOVEMENT_AI, movementAIcomp)); | ||||
| 			} | ||||
| 		}*/ | ||||
| 			movementAIcomp->SetupPath(pathName); | ||||
| 		} | ||||
| 	} else { | ||||
| 		// else we still need to setup moving platform if it has a moving platform comp but no path | ||||
| 		int32_t movingPlatformComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MOVING_PLATFORM, -1); | ||||
|   | ||||
| @@ -287,9 +287,11 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) { | ||||
| 			auto* enemy = Game::entityManager->CreateEntity(info, nullptr, self); | ||||
| 			Game::entityManager->ConstructEntity(enemy); | ||||
|  | ||||
| 			auto* movementAI = new MovementAIComponent(enemy, {}); | ||||
|  | ||||
| 			enemy->AddComponent(eReplicaComponentType::MOVEMENT_AI, movementAI); | ||||
| 			auto* movementAI = enemy->GetComponent<MovementAIComponent>(); | ||||
| 			if (!movementAI) { | ||||
| 				movementAI = new MovementAIComponent(enemy, {}); | ||||
| 				enemy->AddComponent(eReplicaComponentType::MOVEMENT_AI, movementAI); | ||||
| 			} | ||||
|  | ||||
| 			movementAI->SetMaxSpeed(toSpawn.initialSpeed); | ||||
| 			movementAI->SetCurrentSpeed(toSpawn.initialSpeed); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 David Markowitz
					David Markowitz