[Pathing] Improvements to handling tight corridors pathing, clipping detection and recovery (#2826)

This commit is contained in:
Chris Miles
2023-02-06 17:24:03 -06:00
committed by GitHub
parent 823e73336d
commit 404f7cada8
6 changed files with 62 additions and 12 deletions
+9 -2
View File
@@ -138,7 +138,7 @@ public:
return true;
}
//Send a movement packet when you start moving
//Send a movement packet when you start moving
double current_time = static_cast<double>(Timer::GetCurrentTime()) / 1000.0;
int current_speed = 0;
@@ -1053,6 +1053,13 @@ void MobMovementManager::FillCommandStruct(
position_update->delta_z = FloatToEQ13(delta_z);
position_update->delta_heading = FloatToEQ10(delta_heading);
position_update->animation = (mob->IsBot() ? (int) ((float) anim / 1.785714f) : anim);
if (RuleB(Map, MobPathingVisualDebug)) {
mob->DrawDebugCoordinateNode(
fmt::format("{} position update", mob->GetCleanName()),
mob->GetPosition()
);
}
}
/**
@@ -1093,7 +1100,7 @@ void MobMovementManager::UpdatePath(Mob *who, float x, float y, float z, MobMove
}
// Below for npcs that can traverse land or water so they don't sink
else if (who->GetFlyMode() == GravityBehavior::Water &&
zone->watermap->InLiquid(who->GetPosition()) &&
zone->watermap->InLiquid(who->GetPosition()) &&
zone->watermap->InLiquid(glm::vec3(x, y, z)) &&
zone->zonemap->CheckLoS(who->GetPosition(), glm::vec3(x, y, z))) {
auto iter = _impl->Entries.find(who);