mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-16 00:35:27 +00:00
feat(entity): movement AI for scripted objects and ones with a path, as the client
ApplyMovementAiIfNeeded gives an object with a script (its registry's or a custom script) or an attached_path a movement AI component (id 0); 1843 LOTs gain one. It follows its attached path only when that is a movement path (a moving platform's path stays the platform's). Not on spawner objects, which the client never loads. Nothing sent changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "CDClientManager.h"
|
||||
#include "Game.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "Zone.h"
|
||||
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
@@ -97,7 +98,15 @@ void MovementAIComponent::LoadConfigData() {
|
||||
if (m_Info.wanderRadius > 8.0f) m_Info.wanderRadius = 8.0f;
|
||||
if (m_Info.wanderSpeed > 0.5f) m_Info.wanderSpeed *= 0.5f;
|
||||
|
||||
SetPath(m_Parent->GetVarAsString(u"attached_path"));
|
||||
// A movement AI the object has only because it is scripted or has a path (id 0) follows only a movement path: a
|
||||
// moving platform's path belongs to its moving platform
|
||||
const auto pathName = m_Parent->GetVarAsString(u"attached_path");
|
||||
if (m_ComponentID == 0) {
|
||||
if (pathName.empty()) return;
|
||||
const auto* const path = Game::zoneManager->GetZone()->GetPath(pathName);
|
||||
if (!path || path->pathType != PathType::Movement) return;
|
||||
}
|
||||
SetPath(pathName);
|
||||
}
|
||||
|
||||
void MovementAIComponent::SetPath(const std::string pathName) {
|
||||
|
||||
Reference in New Issue
Block a user