refactor(Core/Travel): Remove dead spline-progress tracking and unused NODE_TELEPORT path

This commit is contained in:
bash 2026-05-30 19:56:41 +02:00
parent f328f455ca
commit e57dcf50c5
4 changed files with 6 additions and 109 deletions

View File

@ -3084,51 +3084,6 @@ bool MoveAwayFromPlayerWithDebuffAction::isPossible()
return bot->CanFreeMove();
}
bool MovementAction::CheckSplineProgress(TravelPlan& state)
{
if (!state.splineActive)
return false;
// walkPoints may have been cleared by a map transfer or external reset
// while the spline was still flagged active; bail out safely.
if (state.walkPoints.empty())
{
state.splineActive = false;
return false;
}
if (bot->movespline->Finalized())
{
G3D::Vector3 const& endPt = state.walkPoints.back();
float distToEnd = bot->GetExactDist(endPt.x, endPt.y, endPt.z);
if (distToEnd < 10.0f)
{
state.splineActive = false;
state.walkPoints.clear();
return true; // Arrived
}
// Spline finalized short of target — interrupted (combat/knockback/etc).
// Caller will re-launch.
state.splineActive = false;
return false;
}
// Stuck detection
if (state.splineStartTime &&
GetMSTimeDiffToNow(state.splineStartTime) > state.expectedDuration * 2 + (30 * IN_MILLISECONDS))
{
G3D::Vector3 const& endPt = state.walkPoints.back();
botAI->TeleportTo(WorldLocation(bot->GetMapId(), endPt.x, endPt.y, endPt.z));
state.splineActive = false;
state.walkPoints.clear();
return true;
}
return false; // Still moving
}
bool MovementAction::LaunchWalkSpline(TravelPlan& state)
{
if (state.walkPoints.size() < 2)
@ -3210,9 +3165,6 @@ bool MovementAction::LaunchWalkSpline(TravelPlan& state)
bot->GetMotionMaster()->MoveSplinePath(&state.walkPoints, FORCED_MOVEMENT_RUN);
state.splineStartTime = getMSTime();
state.splineActive = true;
G3D::Vector3 const& last = state.walkPoints.back();
// Update LastMovement so MoveFarTo's spline-active early-out
@ -3343,19 +3295,6 @@ bool MovementAction::ExecuteTravelPlan(TravelPlan& state)
// an executor-ran-this-tick label here would whisper every tick
// while the plan is active.
// Handle active spline
if (state.splineActive)
{
if (!CheckSplineProgress(state))
{
if (state.splineActive)
return true; // Still moving
else
LaunchWalkSpline(state); // Interrupted, re-launch
}
return true;
}
if (state.stepIdx >= state.steps.size())
{
state.Reset();
@ -3608,41 +3547,6 @@ bool MovementAction::ExecuteTravelPlan(TravelPlan& state)
return false;
}
case PathNodeType::NODE_TELEPORT:
{
// Teleport-spell node: hearthstone (spell 8690) or class
// teleport spells (mage/druid). `entry` holds the spell ID.
uint32 spellId = pt.entry;
if (!spellId)
{
state.Reset();
return false;
}
if (bot->IsInFlight() || bot->IsNonMeleeSpellCast(false))
return true; // wait
if (bot->IsMounted())
bot->Dismount();
botAI->RemoveShapeshift();
bool cast = false;
if (spellId == 8690)
cast = botAI->DoSpecificAction("hearthstone", Event(), true);
else if (bot->HasSpell(spellId) && !bot->HasSpellCooldown(spellId))
cast = botAI->CastSpell(spellId, bot);
if (!cast)
{
state.Reset();
return false;
}
// Cast started — advance past the teleport step.
state.stepIdx++;
return true;
}
case PathNodeType::NODE_TRANSPORT:
{
if (state.stepIdx + 1 >= state.steps.size())

View File

@ -104,7 +104,6 @@ protected:
private:
bool LaunchWalkSpline(TravelPlan& state);
bool CheckSplineProgress(TravelPlan& state);
bool MoveToSpline(TravelPlan& state, WorldPosition target);
// Per-segment mmap refinement of a travel-node-graph walk batch.
// The graph stores offline-baked coords whose straight-line

View File

@ -898,11 +898,6 @@ TravelPath TravelNodeRoute::BuildPath(std::vector<WorldPosition> pathToStart, st
// Full taxi waypoint route; same reasoning as transport.
travelPath.addPath(nodePath->GetPath(), PathNodeType::NODE_FLIGHTPATH, nodePath->getPathObject());
}
else if (nodePath->getPathType() == TravelNodePathType::teleportSpell)
{
travelPath.addPoint(*prevNode->getPosition(), PathNodeType::NODE_TELEPORT, nodePath->getPathObject());
travelPath.addPoint(*node->getPosition(), PathNodeType::NODE_TELEPORT, nodePath->getPathObject());
}
else
{
std::vector<WorldPosition> path = nodePath->GetPath();

View File

@ -93,7 +93,9 @@ enum class TravelNodePathType : uint8
areaTrigger = 2,
transport = 3,
flightPath = 4,
teleportSpell = 5,
// value 5 (teleportSpell) reserved — no generator emits it and no
// consumer handles it. Re-add when a teleport-spell edge generator
// / executor handler returns.
staticPortal = 6
};
@ -414,7 +416,8 @@ enum class PathNodeType : uint8
NODE_AREA_TRIGGER = 3,
NODE_TRANSPORT = 4,
NODE_FLIGHTPATH = 5,
NODE_TELEPORT = 6,
// value 6 (NODE_TELEPORT) reserved — no consumer; re-add when a
// teleport-spell handler / generator returns.
NODE_STATIC_PORTAL = 7
};
@ -561,9 +564,7 @@ struct TravelPlan
// Spline scratch (used by executor):
std::vector<G3D::Vector3> walkPoints;
bool splineActive{false};
uint32 splineStartTime{0};
uint32 expectedDuration{0};
uint32 expectedDuration{0}; // used to derive the lastMove delay
// Taxi scratch:
std::vector<uint32> route;
@ -576,8 +577,6 @@ struct TravelPlan
steps.clear();
stepIdx = 0;
walkPoints.clear();
splineActive = false;
splineStartTime = 0;
expectedDuration = 0;
route.clear();
}