mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-22 13:33:35 +00:00
Prevent adding movingplatform components to all entites with an attached_path (#829)
* Stop adding movingpla comps where they aren't needed * move stuff around to make it more congruent * invert if else block logic patter Since setting up the comp will be longer han just adding the path will make the readability flow better * address feedback
This commit is contained in:
parent
22e5d02400
commit
7429902a64
@ -317,15 +317,6 @@ void Entity::Initialize() {
|
||||
m_Components.insert(std::make_pair(COMPONENT_TYPE_SOUND_TRIGGER, comp));
|
||||
}
|
||||
|
||||
//Check to see if we have a moving platform component:
|
||||
//Which, for some reason didn't get added to the ComponentsRegistry so we have to check for a path manually here.
|
||||
std::string attachedPath = GetVarAsString(u"attached_path");
|
||||
|
||||
if (!attachedPath.empty() || compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_MOVING_PLATFORM, -1) != -1) {
|
||||
MovingPlatformComponent* plat = new MovingPlatformComponent(this, attachedPath);
|
||||
m_Components.insert(std::make_pair(COMPONENT_TYPE_MOVING_PLATFORM, plat));
|
||||
}
|
||||
|
||||
//Also check for the collectible id:
|
||||
m_CollectibleID = GetVarAs<int32_t>(u"collectible_id");
|
||||
|
||||
@ -696,6 +687,26 @@ void Entity::Initialize() {
|
||||
m_Components.insert(std::make_pair(COMPONENT_TYPE_MOVEMENT_AI, new MovementAIComponent(this, moveInfo)));
|
||||
}
|
||||
|
||||
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:
|
||||
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(COMPONENT_TYPE_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, COMPONENT_TYPE_PROXIMITY_MONITOR);
|
||||
if (proximityMonitorID > 0) {
|
||||
CDProximityMonitorComponentTable* proxCompTable = CDClientManager::Instance()->GetTable<CDProximityMonitorComponentTable>("ProximityMonitorComponent");
|
||||
|
Loading…
Reference in New Issue
Block a user