mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-14 20:28:21 +00:00
Use better height and path checking
Fix issue with paths entering infinite loop fix default position height being at height 0.
This commit is contained in:
parent
dd2338601e
commit
458db4682b
@ -648,7 +648,7 @@ void BaseCombatAIComponent::Wander() {
|
||||
const NiPoint3 delta =
|
||||
{
|
||||
radius * cos(theta),
|
||||
0,
|
||||
m_Parent->GetPosition().y,
|
||||
radius * sin(theta)
|
||||
};
|
||||
|
||||
|
@ -197,6 +197,7 @@ void MovementAIComponent::ReversePath() {
|
||||
}
|
||||
|
||||
bool MovementAIComponent::AdvancePathWaypointIndex() {
|
||||
if (m_CurrentPath.empty()) return false;
|
||||
m_CurrentPathWaypointIndex = m_NextPathWaypointIndex;
|
||||
if (m_IsInReverse) {
|
||||
if (m_CurrentPathWaypointIndex >= 0) m_NextPathWaypointIndex--;
|
||||
@ -469,7 +470,8 @@ void MovementAIComponent::HandleWaypointArrived(uint32_t commandIndex) {
|
||||
m_Parent->TriggerEvent(eTriggerEventType::ARRIVED_AT_DESIRED_WAYPOINT);
|
||||
if (!m_Path || commandIndex >= m_Path->pathWaypoints.at(m_CurrentPathWaypointIndex).commands.size()) {
|
||||
if (!AdvancePathWaypointIndex()) {
|
||||
if (m_Path) {
|
||||
// We only want to handle path logic if we actually have a path setup for following
|
||||
if (m_Path && !m_CurrentPath.empty()) {
|
||||
if (m_Path->pathBehavior == PathBehavior::Bounce) {
|
||||
ReversePath();
|
||||
} else if (m_Path->pathBehavior == PathBehavior::Loop) {
|
||||
|
Loading…
Reference in New Issue
Block a user