Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Server/Components/NPCs/NPC/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2591,6 +2591,13 @@ void NPC::advance(TimePoint now)
auto finalPos = position;
// auto finalPos = targetPosition_; // just copy this to use in setPosition, since stopMove resets it

// long tick: move the rest of the way to the stop range, same as the node playback above
const float distanceToArrival = std::max(0.0f, distanceToTarget - std::max(0.0f, stopRange_));
if (distanceToArrival > FLT_EPSILON)
{
finalPos = position + (toTarget / distanceToTarget) * distanceToArrival;
}

// If following a player, check autoRestart setting
bool wasFollowingPlayer = followingPlayer_ != nullptr;
if (!wasFollowingPlayer && !movingByPath_)
Expand Down