mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
fix(Core/Movement): WaitForTransport now actively disembarks (matches reference UseTransport flow)
This commit is contained in:
parent
eb97533387
commit
42768fe360
@ -3123,26 +3123,51 @@ bool MovementAction::WaitForTransport()
|
|||||||
if (!lastMove.lastTransportEntry)
|
if (!lastMove.lastTransportEntry)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Combined gate (matches reference exactly): all of these must hold
|
||||||
|
// for us to be considered "mid-ride" on the recorded transport.
|
||||||
Transport* transport = bot->GetTransport();
|
Transport* transport = bot->GetTransport();
|
||||||
if (!transport || transport->GetEntry() != lastMove.lastTransportEntry)
|
if (!transport ||
|
||||||
|
transport->GetEntry() != lastMove.lastTransportEntry ||
|
||||||
|
lastMove.lastPath.empty() ||
|
||||||
|
lastMove.lastPath[0].type != PathNodeType::NODE_TRANSPORT ||
|
||||||
|
lastMove.lastPath[0].entry != lastMove.lastTransportEntry)
|
||||||
{
|
{
|
||||||
lastMove.lastTransportEntry = 0;
|
lastMove.lastTransportEntry = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mid-ride only when the cached path head is still the boarded
|
// Run UpcommingSpecialMovement on the cached path with maxDist=0 to
|
||||||
// transport node. If the head moved (next tick's resolution shifted
|
// see if the head segment is a disembark-ready special (reference
|
||||||
// it off, or we cut to a disembark point), let MoveFarTo continue
|
// pattern). No special → still mid-ride, return false to let
|
||||||
// so HandleSpecialMovement can dispatch the disembark.
|
// MoveFarTo continue normally.
|
||||||
if (lastMove.lastPath.empty())
|
TravelPath path = lastMove.lastPath;
|
||||||
|
if (!path.UpcommingSpecialMovement(WorldPosition(bot), 0.0f, /*onTransport=*/true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PathNodePoint const& front = lastMove.lastPath[0];
|
// Disembark: head is the transport node where we should get off,
|
||||||
if (front.type != PathNodeType::NODE_TRANSPORT ||
|
// next is the world-position dock to land at. Reference uses
|
||||||
front.entry != lastMove.lastTransportEntry)
|
// UseTransport(ai, dock.entry, dock.point, tele.point, type>0)
|
||||||
return false;
|
// — we don't have UseTransport, so inline the equivalent.
|
||||||
|
PathNodePoint const& dock = path[0];
|
||||||
|
if (path.size() < 2)
|
||||||
|
return true; // no telePoint to land at; keep waiting
|
||||||
|
PathNodePoint const& tele = path[1];
|
||||||
|
|
||||||
return true;
|
transport->RemovePassenger(bot);
|
||||||
|
bot->StopMovingOnCurrentPos();
|
||||||
|
bool const teleported = bot->TeleportTo(tele.point.GetMapId(),
|
||||||
|
tele.point.GetPositionX(),
|
||||||
|
tele.point.GetPositionY(),
|
||||||
|
tele.point.GetPositionZ(),
|
||||||
|
bot->GetOrientation());
|
||||||
|
if (!teleported)
|
||||||
|
return true; // try again next tick
|
||||||
|
|
||||||
|
lastMove.lastTransportEntry = 0;
|
||||||
|
// Suppress unused-variable on `dock` — kept for parity with reference's
|
||||||
|
// UseTransport(entry, dockPoint, telePoint, ...) signature shape.
|
||||||
|
(void)dock;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MovementAction::HandleSpecialMovement(TravelPath& path)
|
bool MovementAction::HandleSpecialMovement(TravelPath& path)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user