Skip to content

Commit a2e93ad

Browse files
committed
set NPC final pos to where they are instead of target
1 parent b0af254 commit a2e93ad

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Server/Components/NPCs/NPC/npc.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,7 +2280,10 @@ void NPC::advance(TimePoint now)
22802280
if (distanceToTarget <= stopRange_ || maxTravel >= distanceToTarget)
22812281
{
22822282
// Reached or about to overshoot target
2283-
auto targetPos = targetPosition_; // just copy this to use in setPosition, since stopMove resets it
2283+
// UPDATE: Since we have stopRange now, let's set NPC's position as where it is now, after reaching.
2284+
// As in, let's just use position, instead of targetPosition.
2285+
auto finalPos = position;
2286+
// auto finalPos = targetPosition_; // just copy this to use in setPosition, since stopMove resets it
22842287

22852288
// If following a player, check autoRestart setting
22862289
bool wasFollowingPlayer = followingPlayer_ != nullptr;
@@ -2304,7 +2307,7 @@ void NPC::advance(TimePoint now)
23042307
removeKey(Key::WALK);
23052308
}
23062309

2307-
setPosition(targetPos, false);
2310+
setPosition(finalPos, false);
23082311

23092312
// Check if the movement was triggered for entering a vehicle
23102313
float distanceToVehicle = 0.0f;

0 commit comments

Comments
 (0)