Add file for u aronwk

This commit is contained in:
David Markowitz 2023-08-07 18:40:06 -07:00
parent d372278b25
commit ed0c979544
3 changed files with 26 additions and 4 deletions

View File

@ -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"

View File

@ -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,

View File

@ -0,0 +1,7 @@
#ifndef MOVEMENTAICOMPONENT_H
#include "MovementAIComponent.h"
#endif
void MovementAIComponent::HandleWaypointArrived() {
}