mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-15 04:38:21 +00:00
fixes and testing
Bounce works add null check and default
This commit is contained in:
parent
facc225b82
commit
a3b62d60f0
@ -70,7 +70,7 @@ void MovementAIComponent::SetupPath(const std::string& pathname) {
|
|||||||
waypoints.push_back(waypoint.position);
|
waypoints.push_back(waypoint.position);
|
||||||
}
|
}
|
||||||
SetPath(waypoints);
|
SetPath(waypoints);
|
||||||
SetMaxSpeed(3.0f);
|
SetMaxSpeed(30.0f);
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("MovementAIComponent", "No path found for %i:%llu", m_Parent->GetLOT(), m_Parent->GetObjectID());
|
Game::logger->Log("MovementAIComponent", "No path found for %i:%llu", m_Parent->GetLOT(), m_Parent->GetObjectID());
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ void MovementAIComponent::Update(const float deltaTime) {
|
|||||||
HandleWaypointArrived();
|
HandleWaypointArrived();
|
||||||
if (!AdvancePathWaypointIndex()) {
|
if (!AdvancePathWaypointIndex()) {
|
||||||
if (m_Path && m_Path->pathBehavior == PathBehavior::Bounce) {
|
if (m_Path && m_Path->pathBehavior == PathBehavior::Bounce) {
|
||||||
ReversePath(); // untested.
|
ReversePath();
|
||||||
} else if (m_Path && m_Path->pathBehavior == PathBehavior::Loop) {
|
} else if (m_Path && m_Path->pathBehavior == PathBehavior::Loop) {
|
||||||
m_CurrentPathWaypointIndex = 0;
|
m_CurrentPathWaypointIndex = 0;
|
||||||
m_NextPathWaypointIndex = 0;
|
m_NextPathWaypointIndex = 0;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "eWaypointCommandType.h"
|
#include "eWaypointCommandType.h"
|
||||||
|
|
||||||
void MovementAIComponent::HandleWaypointArrived() {
|
void MovementAIComponent::HandleWaypointArrived() {
|
||||||
|
if (!m_Path) return;
|
||||||
if (m_Path->pathWaypoints[m_CurrentPathWaypointIndex].commands.empty()) return;
|
if (m_Path->pathWaypoints[m_CurrentPathWaypointIndex].commands.empty()) return;
|
||||||
for(auto [command, data] : m_Path->pathWaypoints[m_CurrentPathWaypointIndex].commands){
|
for(auto [command, data] : m_Path->pathWaypoints[m_CurrentPathWaypointIndex].commands){
|
||||||
switch(command){
|
switch(command){
|
||||||
@ -75,6 +76,7 @@ void MovementAIComponent::HandleWaypointArrived() {
|
|||||||
Game::logger->Log("MovementAIComponentAronwk", "Unusable Command %i", command);
|
Game::logger->Log("MovementAIComponentAronwk", "Unusable Command %i", command);
|
||||||
break;
|
break;
|
||||||
case eWaypointCommandType::INVALID:
|
case eWaypointCommandType::INVALID:
|
||||||
|
default:
|
||||||
Game::logger->LogDebug("MovementAIComponentAronwk", "Got invalid waypoint command %i", command);
|
Game::logger->LogDebug("MovementAIComponentAronwk", "Got invalid waypoint command %i", command);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user