mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-09-05 14:58:27 +00:00
feat: Add MovingAI pathing for NPCs without combatAI (#1509)
* remove goto * Update MovementAIComponent.cpp * convert to PathWaypoint Easier for usage with paths * add path parsing * ref removal, simplification of work * it works * Update MovementAIComponent.cpp * disable pathing for combat we just need it for npcs for now, combat ai can be done later * fixed stuttery enemies wow * start at ramped up speed * add pausing and resuming * Update MovementAIComponent.cpp * Update MovementAIComponent.h * Update CMakeLists.txt
This commit is contained in:
@@ -14,11 +14,14 @@
|
||||
#include "Logger.h"
|
||||
#include "Component.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "Zone.h"
|
||||
#include <vector>
|
||||
|
||||
class ControllablePhysicsComponent;
|
||||
class BaseCombatAIComponent;
|
||||
|
||||
struct Path;
|
||||
|
||||
/**
|
||||
* Information that describes the different variables used to make an entity move around
|
||||
*/
|
||||
@@ -61,6 +64,8 @@ public:
|
||||
|
||||
MovementAIComponent(Entity* parentEntity, MovementAIInfo info);
|
||||
|
||||
void SetPath(const std::string pathName);
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
|
||||
/**
|
||||
@@ -73,7 +78,7 @@ public:
|
||||
* Set a destination point for the entity to move towards
|
||||
* @param value the destination point to move towards
|
||||
*/
|
||||
void SetDestination(const NiPoint3& value);
|
||||
void SetDestination(const NiPoint3 value);
|
||||
|
||||
/**
|
||||
* Returns the current rotation this entity is moving towards
|
||||
@@ -189,7 +194,13 @@ public:
|
||||
* Sets a path to follow for the AI
|
||||
* @param path the path to follow
|
||||
*/
|
||||
void SetPath(std::vector<NiPoint3> path);
|
||||
void SetPath(std::vector<PathWaypoint> path);
|
||||
|
||||
void Pause();
|
||||
|
||||
void Resume();
|
||||
|
||||
NiPoint3 GetVelocity() const;
|
||||
|
||||
/**
|
||||
* Returns the base speed from the DB for a given LOT
|
||||
@@ -301,7 +312,15 @@ private:
|
||||
/**
|
||||
* The path from the current position to the destination.
|
||||
*/
|
||||
std::stack<NiPoint3> m_CurrentPath;
|
||||
std::stack<PathWaypoint> m_CurrentPath;
|
||||
|
||||
const Path* m_Path = nullptr;
|
||||
|
||||
NiPoint3 m_SourcePosition;
|
||||
|
||||
bool m_Paused;
|
||||
|
||||
NiPoint3 m_SavedVelocity;
|
||||
};
|
||||
|
||||
#endif // MOVEMENTAICOMPONENT_H
|
||||
|
Reference in New Issue
Block a user