From ed0c9795443c3ca51aafa8b19d07a459fa811c96 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Mon, 7 Aug 2023 18:40:06 -0700 Subject: [PATCH] Add file for u aronwk --- dGame/dComponents/MovementAIComponent.cpp | 19 ++++++++++++++++--- dGame/dComponents/MovementAIComponent.h | 4 +++- .../dComponents/MovementAIComponentAronwk.cpp | 7 +++++++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 dGame/dComponents/MovementAIComponentAronwk.cpp diff --git a/dGame/dComponents/MovementAIComponent.cpp b/dGame/dComponents/MovementAIComponent.cpp index 824078dd..d1773f73 100644 --- a/dGame/dComponents/MovementAIComponent.cpp +++ b/dGame/dComponents/MovementAIComponent.cpp @@ -54,6 +54,21 @@ MovementAIComponent::MovementAIComponent(Entity* parent, MovementAIInfo info) : m_NextPathWaypointIndex = 0; } +void MovementAIComponent::SetupPath(const std::string& pathname) { + std::string path = pathname; + if (path.empty()) path = m_Parent->GetVarAsString(u"attached_path"); + if (path.empty()) { + Game::logger->Log("MovementAIComponent", "No path to load for %i:%llu", m_Parent->GetLOT(), m_Parent->GetObjectID()); + return; + } + const Path* pathData = Game::zoneManager->GetZone()->GetPath(path); + if (pathData) { + Game::logger->Log("MovementAIComponent", "found path %s", path.c_str()); + } else { + Game::logger->Log("MovementAIComponent", "No path found for %i:%llu", m_Parent->GetLOT(), m_Parent->GetObjectID()); + } +} + void MovementAIComponent::Update(const float deltaTime) { if (m_PullingToPoint) { const auto source = GetCurrentWaypoint(); @@ -407,6 +422,4 @@ void MovementAIComponent::SetMaxSpeed(const float value) { m_Acceleration = value / 5; } -void MovementAIComponent::HandleWaypointArrived() { - -} +#include "MovementAIComponentAronwk.cpp" diff --git a/dGame/dComponents/MovementAIComponent.h b/dGame/dComponents/MovementAIComponent.h index 69919769..b53cd02b 100644 --- a/dGame/dComponents/MovementAIComponent.h +++ b/dGame/dComponents/MovementAIComponent.h @@ -53,7 +53,7 @@ struct MovementAIInfo { /** * Component that handles the movement settings of an entity. Not to be confused with the BaseCombatAI component that - * actually handles attackig and following enemy entities. + * actually handles attacking and following enemy entities. */ class MovementAIComponent : public Component { public: @@ -194,6 +194,8 @@ public: void ReversePath(); void HandleWaypointArrived(); + + void SetupPath(const std::string& pathname); /** * Stops the current movement and moves the entity to a certain point. Will continue until it's close enough, diff --git a/dGame/dComponents/MovementAIComponentAronwk.cpp b/dGame/dComponents/MovementAIComponentAronwk.cpp new file mode 100644 index 00000000..d6f87d8d --- /dev/null +++ b/dGame/dComponents/MovementAIComponentAronwk.cpp @@ -0,0 +1,7 @@ +#ifndef MOVEMENTAICOMPONENT_H +#include "MovementAIComponent.h" +#endif + +void MovementAIComponent::HandleWaypointArrived() { + +}