mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-10 17:38:08 +00:00
chore: Small movementAiComponent cleanup (#1145)
* rename and cleanup file * more * fix broken function * Further naming fixes t Revert "Further naming fixes" This reverts commit 057189982ba56788d48f9265d815e6c562ba6328. * next step * undo all testing changes * minor tweaks
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Darkflame Universe
|
||||
* Copyright 2018
|
||||
* Copyright 2023
|
||||
*/
|
||||
|
||||
#ifndef MOVEMENTAICOMPONENT_H
|
||||
@@ -60,7 +60,6 @@ public:
|
||||
static const eReplicaComponentType ComponentType = eReplicaComponentType::MOVEMENT_AI;
|
||||
|
||||
MovementAIComponent(Entity* parentEntity, MovementAIInfo info);
|
||||
~MovementAIComponent() override;
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
|
||||
@@ -86,61 +85,55 @@ public:
|
||||
* Sets the max speed at which this entity may run
|
||||
* @param value the speed value to set
|
||||
*/
|
||||
void SetSpeed(float value);
|
||||
|
||||
/**
|
||||
* Returns the max speed at which this entity may run
|
||||
* @return the max speed at which this entity may run
|
||||
*/
|
||||
float GetSpeed() const;
|
||||
void SetMaxSpeed(float value);
|
||||
|
||||
/**
|
||||
* Sets how fast the entity will accelerate when not running at full speed
|
||||
* @param value the acceleration to set
|
||||
*/
|
||||
void SetAcceleration(float value);
|
||||
void SetAcceleration(float value) { m_Acceleration = value; };
|
||||
|
||||
/**
|
||||
* Returns the current speed at which this entity accelerates when not running at full speed
|
||||
* @return the current speed at which this entity accelerates when not running at full speed
|
||||
*/
|
||||
float GetAcceleration() const;
|
||||
float GetAcceleration() const { return m_Acceleration; };
|
||||
|
||||
/**
|
||||
* Sets the halting distance (the distance at which we consider the target to be reached)
|
||||
* @param value the halting distance to set
|
||||
*/
|
||||
void SetHaltDistance(float value);
|
||||
void SetHaltDistance(float value) { m_HaltDistance = value; }
|
||||
|
||||
/**
|
||||
* Returns the current halting distance (the distance at which we consider the target to be reached)
|
||||
* @return the current halting distance
|
||||
*/
|
||||
float GetHaltDistance() const;
|
||||
float GetHaltDistance() const { return m_HaltDistance; }
|
||||
|
||||
/**
|
||||
* Sets the speed the entity is currently running at
|
||||
* @param value the speed value to set
|
||||
*/
|
||||
void SetCurrentSpeed(float value);
|
||||
void SetCurrentSpeed(float value) { m_CurrentSpeed = value; }
|
||||
|
||||
/**
|
||||
* Returns the speed the entity is currently running at
|
||||
* @return the speed the entity is currently running at
|
||||
*/
|
||||
float GetCurrentSpeed() const;
|
||||
float GetCurrentSpeed() const { return m_CurrentSpeed; }
|
||||
|
||||
/**
|
||||
* Locks the rotation of this entity in place, depending on the argument
|
||||
* @param value if true, the entity will be rotationally locked
|
||||
*/
|
||||
void SetLockRotation(bool value);
|
||||
void SetLockRotation(bool value) { m_LockRotation = value; }
|
||||
|
||||
/**
|
||||
* Returns whether this entity is currently rotationally locked
|
||||
* @return true if the entity is rotationally locked, false otherwise
|
||||
*/
|
||||
bool GetLockRotation() const;
|
||||
bool GetLockRotation() const { return m_LockRotation; };
|
||||
|
||||
/**
|
||||
* Attempts to update the waypoint index, making the entity move to the next waypoint
|
||||
@@ -158,13 +151,7 @@ public:
|
||||
* Returns the waypoint this entity is supposed to move towards next
|
||||
* @return the waypoint this entity is supposed to move towards next
|
||||
*/
|
||||
NiPoint3 GetNextWaypoint() const;
|
||||
|
||||
/**
|
||||
* Returns the current position of this entity
|
||||
* @return the current position of this entity
|
||||
*/
|
||||
NiPoint3 GetCurrentPosition() const;
|
||||
NiPoint3 GetNextWaypoint() const { return m_NextWaypoint; }
|
||||
|
||||
/**
|
||||
* Returns the approximate current location of the entity, including y coordinates
|
||||
@@ -180,17 +167,11 @@ public:
|
||||
*/
|
||||
bool Warp(const NiPoint3& point);
|
||||
|
||||
/**
|
||||
* Returns the time it will take to reach the final waypoint according to the current speed
|
||||
* @return the time it will take to reach the final waypoint according to the current speed
|
||||
*/
|
||||
float GetTimer() const;
|
||||
|
||||
/**
|
||||
* Returns if the entity is at its final waypoint
|
||||
* @return if the entity is at its final waypoint
|
||||
*/
|
||||
bool AtFinalWaypoint() const;
|
||||
bool AtFinalWaypoint() const { return m_AtFinalWaypoint; }
|
||||
|
||||
/**
|
||||
* Renders the entity stationary
|
||||
@@ -250,17 +231,12 @@ private:
|
||||
/**
|
||||
* The max speed this entity may move at
|
||||
*/
|
||||
float m_Speed;
|
||||
float m_MaxSpeed;
|
||||
|
||||
/**
|
||||
* The time it will take to reach the next waypoint using the current speed
|
||||
*/
|
||||
float m_Timer;
|
||||
|
||||
/**
|
||||
* The total time it will take to reach the waypoint form its starting point
|
||||
*/
|
||||
float m_TotalTime;
|
||||
float m_TimeTravelled;
|
||||
|
||||
/**
|
||||
* The path this entity is currently traversing
|
||||
@@ -270,7 +246,7 @@ private:
|
||||
/**
|
||||
* If the entity has reached it last waypoint
|
||||
*/
|
||||
bool m_Done;
|
||||
bool m_AtFinalWaypoint;
|
||||
|
||||
/**
|
||||
* The speed the entity is currently moving at
|
||||
@@ -287,6 +263,11 @@ private:
|
||||
*/
|
||||
float m_HaltDistance;
|
||||
|
||||
/**
|
||||
* The total time it will take to reach the waypoint form its starting point
|
||||
*/
|
||||
float m_TimeToTravel;
|
||||
|
||||
/**
|
||||
* The base speed this entity has
|
||||
*/
|
||||
@@ -295,7 +276,7 @@ private:
|
||||
/**
|
||||
* If the AI is currently turned of (e.g. when teleporting to some location)
|
||||
*/
|
||||
bool m_Interrupted;
|
||||
bool m_PullingToPoint;
|
||||
|
||||
/**
|
||||
* A position that the entity is currently moving towards while being interrupted
|
||||
@@ -315,17 +296,12 @@ private:
|
||||
/**
|
||||
* The path the entity is currently following
|
||||
*/
|
||||
std::vector<NiPoint3> m_CurrentPath;
|
||||
std::vector<NiPoint3> m_InterpolatedWaypoints;
|
||||
|
||||
/**
|
||||
* Queue of positions to traverse
|
||||
* The path from the current position to the destination.
|
||||
*/
|
||||
std::stack<NiPoint3> m_Queue;
|
||||
|
||||
/**
|
||||
* Cache of all lots and their respective speeds
|
||||
*/
|
||||
static std::map<LOT, float> m_PhysicsSpeedCache;
|
||||
std::stack<NiPoint3> m_CurrentPath;
|
||||
};
|
||||
|
||||
#endif // MOVEMENTAICOMPONENT_H
|
||||
|
Reference in New Issue
Block a user