Recover stalled flights locally and fly rejected route approaches
clang PCH / build (push) Canceled after 0s
GCC PCH / build (push) Canceled after 0s

This commit is contained in:
Nico committed 2026-11-04 01:14:02 +01:00
1 parent f8ee1d0ff6
commit ba2a4e629c
8 files changed
+573 -4

No files matched your search

+25 -3
View File
@@ -780,7 +780,8 @@ bool ClientlessFlightMgr::Advance(Player * player, Record & record, bool handoff
init.SetFly();
init.SetWalk(false);
init.SetVelocity(player->GetSpeed(MOVE_FLIGHT));
if (init.Launch() <= 0)
int32 const duration = init.Launch();
if (duration <= 0)
{
Fail(player, record, "flight spline rejected");
return false;
@@ -790,6 +791,7 @@ bool ClientlessFlightMgr::Advance(Player * player, Record & record, bool handoff
record.SegmentUnderOverhang=next.UnderOverhang;
record.Moving = true;
record.SegmentElapsed = 0;
record.Progress.Begin(Distance(current, next.Next), uint32(duration));
++ record.Status.Segments;
record.Status.Avoidances += next.Avoiding ? 1 : 0;
if (handoff) ++record.Status.Handoffs;
@@ -837,6 +839,8 @@ void ClientlessFlightMgr::Update(uint32 diff)
// Count actual motion, not overlapping issued spline lengths.
record.Status.Travelled += Distance(PointOf(record.LastPosition), PointOf(*player));
record.LastPosition.Relocate(player);
if (record.Status.State == ClientlessFlightState::Flying && record.Moving)
record.Progress.Observe(Distance(PointOf(*player), PointOf(record.Segment)), diff);
if (record.Status.State == ClientlessFlightState::Mounting)
{
if (player->IsMounted() && player->CanFly()) record.Status.State = ClientlessFlightState::Flying;
@@ -882,9 +886,27 @@ void ClientlessFlightMgr::Update(uint32 diff)
}
if (record.Moving && player->IsSplineEnabled())
{
if (record.SegmentElapsed > 10000)
if (record.Progress.Stalled())
{
Fail(player, record, "flight segment made no confirmed progress");
TC_LOG_WARN("server.adventurebot.navigation",
"FLIGHT_STALLED guid=%u idleMs=%u segmentMs=%u expectedMs=%u overdue=%u recovery=%u",
guid, record.Progress.IdleMs, record.Progress.ElapsedMs, record.Progress.ExpectedMs,
record.Progress.Overdue()?1u:0u, record.StallRecoveries);
if (record.Returning || record.StallRecoveries >= 2)
{
Fail(player, record, "flight stalled for 60 seconds; local recovery exhausted");
continue;
}
++record.StallRecoveries;
player->StopMoving();
record.Moving = false;
// Keep the leader trail and destination. Re-evaluate the local
// join/corridor; never replace the macro route or return yet.
record.Join = {};
bool const departed = record.Memory.Departed;
record.Memory = {};
record.Memory.Departed = departed;
Advance(player, record);
continue;
}
auto ray =[&](Point const & a, Point const & b)