This commit is contained in:
David Markowitz 2023-08-12 00:40:18 -07:00
parent 84ba38bd1d
commit 56ab6bd4c3
3 changed files with 15 additions and 11 deletions

View File

@ -399,6 +399,9 @@ void MovementAIComponent::SetDestination(const NiPoint3& destination) {
std::vector<NiPoint3> computedPath;
if (dpWorld::Instance().IsLoaded()) {
computedPath = dpWorld::Instance().GetNavMesh()->GetPath(m_Parent->GetPosition(), destination, m_Info.wanderSpeed);
} else {
// If we do not have a navmesh, we do not want an AI to be going towards points that are far below or above the map.
//
}
// Somehow failed

View File

@ -223,8 +223,11 @@ public:
*/
static float GetBaseSpeed(LOT lot);
void SetCurrentPathWaypointIndex(uint32_t value) { m_CurrentPathWaypointIndex = value; };
void SetNextPathWaypointIndex(uint32_t value) { m_NextPathWaypointIndex = value; };
private:
// TODO: Advance properly
void SetCurrentPathWaypointIndex(uint32_t value) { };
void SetNextPathWaypointIndex(uint32_t value) { };
void HandleWaypointCommandGroupEmote(std::string data);
void HandleWaypointCommandSetVariable(std::string data);
void HandleWaypointCommandCastSkill(std::string data);
@ -238,8 +241,6 @@ public:
void HandleWaypointCommandChangeWaypoint(std::string data);
void HandleWaypointCommandSpawnObject(std::string data);
private:
/**
* Sets the current position of the entity
* @param value the position to set

View File

@ -7,8 +7,8 @@
void MovementAIComponent::HandleWaypointArrived() {
if (!m_Path) return;
if (m_Path->pathWaypoints[m_CurrentPathWaypointIndex].commands.empty()) return;
for(auto [command, data] : m_Path->pathWaypoints[m_CurrentPathWaypointIndex].commands){
if (m_Path->pathWaypoints.at(m_CurrentPathWaypointIndex).commands.empty()) return;
for(auto [command, data] : m_Path->pathWaypoints.at(m_CurrentPathWaypointIndex).commands){
switch(command){
case eWaypointCommandType::STOP:
Stop();
@ -102,20 +102,20 @@ void MovementAIComponent::HandleWaypointCommandUnequipInventory(std::string data
}
void MovementAIComponent::HandleWaypointCommandDelay(std::string data) {
Pause();
std::remove_if(data.begin(), data.end(), isspace);
std::remove_if(data.begin(), data.end(), ::isspace);
// delay for time
}
void MovementAIComponent::HandleWaypointCommandEmote(std::string data) {
// pause fore animation time
// pause for animation time
auto delay = RenderComponent::PlayAnimation(m_Parent, data);
}
void MovementAIComponent::HandleWaypointCommandTeleport(std::string data) {
auto posString = GeneralUtils::SplitString(data, ',');
if (posString.size() == 0) return;
auto newPos = NiPoint3();
if (posString.size() == 1) GeneralUtils::TryParse<float>(posString[0], newPos.x);
if (posString.size() == 2) GeneralUtils::TryParse<float>(posString[1], newPos.y);
if (posString.size() == 3) GeneralUtils::TryParse<float>(posString[2], newPos.z);
if (posString.size() == 1) GeneralUtils::TryParse<float>(posString.at(0), newPos.x);
if (posString.size() == 2) GeneralUtils::TryParse<float>(posString.at(1), newPos.y);
if (posString.size() == 3) GeneralUtils::TryParse<float>(posString.at(2), newPos.z);
GameMessages::SendTeleport(m_Parent->GetObjectID(), newPos, NiQuaternion::IDENTITY, UNASSIGNED_SYSTEM_ADDRESS);
}
void MovementAIComponent::HandleWaypointCommandPathSpeed(std::string data) {