Keep clientless flight moving across spline handoffs
Replace ordinary flight splines before they finish while retaining collision checks, terminal landing and conservative return behavior. Measure actual travelled distance, cover handoff timing with a production Update regression test, retire Arthoran's automatic ship test and document visual acceptance of the travel milestone.
This commit is contained in:
1 parent
8df9591c99
commit
ca656403bb
5 files changed
+149
-12
No files matched your search
@@ -13,6 +13,7 @@
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
#include "MoveSplineInit.h"
|
||||
#include "MoveSpline.h"
|
||||
#include "PhasingHandler.h"
|
||||
#include "Player.h"
|
||||
#include "PathGenerator.h"
|
||||
@@ -213,6 +214,7 @@ bool ClientlessFlightMgr::Start(Player * player, Position const & target, std::s
|
||||
record.Status.MapId = player->GetMapId();
|
||||
record.Status.Target = target;
|
||||
record.Start.Relocate(player);
|
||||
record.LastPosition.Relocate(player);
|
||||
record.Settings.Clearance = std::clamp(sConfigMgr->GetFloatDefault("Clientless.Flight.Clearance", 60), 20.0f, 200.0f);
|
||||
auto origin = Sample(player, record, player->GetPositionX(), player->GetPositionY());
|
||||
if (! origin.Valid || std::fabs(origin.Ground - player->GetPositionZ()) > 3)
|
||||
@@ -297,7 +299,7 @@ void ClientlessFlightMgr::Fail(Player * player, Record & record, std::string con
|
||||
TC_LOG_WARN("server.adventurebot.navigation", "FLIGHT_FAILED guid=%u map=%u pos=(%.2f %.2f %.2f) reason='%s'", player->GetGUID().GetCounter(), player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), reason.c_str());
|
||||
}
|
||||
|
||||
bool ClientlessFlightMgr::Advance(Player * player, Record & record)
|
||||
bool ClientlessFlightMgr::Advance(Player * player, Record & record, bool handoff)
|
||||
{
|
||||
Point current = PointOf(* player), goal = PointOf(record.Returning ? record.Start : record.Status.Landing);
|
||||
auto sample =[&](float x, float y)
|
||||
@@ -334,7 +336,18 @@ bool ClientlessFlightMgr::Advance(Player * player, Record & record)
|
||||
back, Corridor(current, back, goal, record.Settings, sample, ray, true), true, false
|
||||
};
|
||||
}
|
||||
else next = Next(current, goal, record.Settings, record.Memory, sample, ray);
|
||||
else
|
||||
{
|
||||
auto const memory = record.Memory;
|
||||
next = Next(current, goal, record.Settings, record.Memory, sample, ray);
|
||||
// Reissuing the same endpoint would only restart its final milliseconds.
|
||||
// Let that spline finish instead; keep planning memory unchanged.
|
||||
if (handoff && next.Valid && Distance(next.Next, PointOf(record.Segment)) < 1)
|
||||
{
|
||||
record.Memory = memory;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (! next.Valid ||(! record.Returning && record.Status.Travelled > Distance(PointOf(record.Start), goal) * 2 + 500))
|
||||
{
|
||||
Fail(player, record, "no safe bounded flight corridor; holding position mounted");
|
||||
@@ -357,9 +370,9 @@ bool ClientlessFlightMgr::Advance(Player * player, Record & record)
|
||||
record.SegmentElapsed = 0;
|
||||
++ record.Status.Segments;
|
||||
record.Status.Avoidances += next.Avoiding ? 1 : 0;
|
||||
record.Status.Travelled += Distance(current, next.Next);
|
||||
if (handoff) ++record.Status.Handoffs;
|
||||
record.Status.Detail = next.Avoiding ? "obstacle avoidance" : next.Landing ? "landing approach" : next.Next.Z < current.Z - 0.25f ? "diagonal descent" : next.Next.Z > current.Z + 0.25f ? "diagonal climb" : "terrain-smoothed cruise";
|
||||
TC_LOG_INFO("server.adventurebot.navigation", "FLIGHT_SEGMENT guid=%u n=%u avoid=%u target=(%.2f %.2f %.2f) detail='%s'", player->GetGUID().GetCounter(), record.Status.Segments, next.Avoiding ? 1 : 0, next.Next.X, next.Next.Y, next.Next.Z, record.Status.Detail.c_str());
|
||||
TC_LOG_INFO("server.adventurebot.navigation", "FLIGHT_SEGMENT guid=%u n=%u avoid=%u handoff=%u target=(%.2f %.2f %.2f) detail='%s'", player->GetGUID().GetCounter(), record.Status.Segments, next.Avoiding ? 1 : 0, handoff ? 1 : 0, next.Next.X, next.Next.Y, next.Next.Z, record.Status.Detail.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -378,6 +391,9 @@ void ClientlessFlightMgr::Update(uint32 diff)
|
||||
Fail(player, record, "flight player/map state changed");
|
||||
continue;
|
||||
}
|
||||
// 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::Mounting)
|
||||
{
|
||||
if (player->IsMounted() && player->CanFly()) record.Status.State = ClientlessFlightState::Flying;
|
||||
@@ -420,6 +436,14 @@ void ClientlessFlightMgr::Update(uint32 diff)
|
||||
record.Moving = false;
|
||||
Advance(player, record);
|
||||
}
|
||||
else if (!record.Returning && player->movespline->timeRemaining() <= 600 &&
|
||||
Distance(PointOf(record.Segment), PointOf(record.Status.Landing)) > 0.1f)
|
||||
{
|
||||
// Replace a still-running spline from its native current position.
|
||||
// No StopMoving/arrival packet between ordinary flight segments.
|
||||
// Landing and conservative breadcrumb return finish their endpoint.
|
||||
Advance(player, record, true);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
record.Moving = false;
|
||||
@@ -496,6 +520,6 @@ bool ClientlessFlightMgr::Command(ChatHandler * handler, char const * args)
|
||||
return false;
|
||||
}
|
||||
if (! status) handler->SendSysMessage("No free-flight state for this character.");
|
||||
else handler->PSendSysMessage("Flight GUID %u: state=%s map=%u mountSpell=%u segments=%u avoidances=%u travelled=%.1f detail='%s'", guid, StateName(status->State), status->MapId, status->MountSpell, status->Segments, status->Avoidances, status->Travelled, status->Detail.c_str());
|
||||
else handler->PSendSysMessage("Flight GUID %u: state=%s map=%u mountSpell=%u segments=%u avoidances=%u handoffs=%u travelled=%.1f detail='%s'", guid, StateName(status->State), status->MapId, status->MountSpell, status->Segments, status->Avoidances, status->Handoffs, status->Travelled, status->Detail.c_str());
|
||||
return true;
|
||||
}
|
||||
Reference in new issue
Block a user