diff --git a/JotunnModStub/Alfar/AlfarDroneAI.cs b/JotunnModStub/Alfar/AlfarDroneAI.cs index 59d8fea..9da8077 100644 --- a/JotunnModStub/Alfar/AlfarDroneAI.cs +++ b/JotunnModStub/Alfar/AlfarDroneAI.cs @@ -301,7 +301,11 @@ namespace RacesOfValheim else if (Time.time >= m_nextFightScan) { m_nextFightScan = Time.time + FightScanInterval; - if (BaseAI.FindClosestEnemy(m_character, transform.position, FightRange) != null) + // FindClosestEnemy takes its first match at ANY distance (it only compares against + // maxDistance once it holds one), so with a deer anywhere in the loaded zones it never + // returned null and vanilla kept the tick: the drone idled about instead of working. + Character enemy = BaseAI.FindClosestEnemy(m_character, transform.position, FightRange); + if (enemy != null && Vector3.Distance(enemy.transform.position, transform.position) <= FightRange) { m_fightUntil = Time.time + FightLinger; } diff --git a/JotunnModStub/Butler/BoneServantAI.cs b/JotunnModStub/Butler/BoneServantAI.cs index db77b6d..073d718 100644 --- a/JotunnModStub/Butler/BoneServantAI.cs +++ b/JotunnModStub/Butler/BoneServantAI.cs @@ -270,7 +270,11 @@ namespace RacesOfValheim else if (Time.time >= m_nextFightScan) { m_nextFightScan = Time.time + FightScanInterval; - if (BaseAI.FindClosestEnemy(m_character, transform.position, FightRange) != null) + // FindClosestEnemy takes its first match at ANY distance (it only compares against + // maxDistance once it holds one), so with a deer anywhere in the loaded zones it never + // returned null and vanilla kept the tick: the worker idled about instead of working. + Character enemy = BaseAI.FindClosestEnemy(m_character, transform.position, FightRange); + if (enemy != null && Vector3.Distance(enemy.transform.position, transform.position) <= FightRange) { m_fightUntil = Time.time + FightLinger; }