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
18 changes: 18 additions & 0 deletions Intersect.Server.Core/Entities/Npc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,24 @@ public override void Update(long timeMs)
var targetY = 0;
var targetZ = 0;

// If target is on a different instance, clear it immediately
if (tempTarget != null && tempTarget.MapInstanceId != MapInstanceId)
{
RemoveTarget();
tempTarget = null;

// Also clear aggro center since target is unreachable
if (AggroCenterMap != null)
{
AggroCenterMap = null;
AggroCenterX = 0;
AggroCenterY = 0;
AggroCenterZ = 0;
mPathFinder?.SetTarget(null);
mResetting = false;
}
}

if (tempTarget != null && (tempTarget.IsDead || !InRangeOf(tempTarget, Options.Instance.Map.MapWidth * 2) || !CanTarget(tempTarget)))
{
_ = TryFindNewTarget(Timing.Global.Milliseconds, tempTarget.Id, !CanTarget(tempTarget));
Expand Down
Loading