From 1c5bb258d5110f8e953db0035557b4ba9f18f60a Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 24 Aug 2021 10:56:39 -0400 Subject: [PATCH] Core/CreatureAI: CheckBoundary -> IsInBoundary, better reflects what it does. Port From (https://github.com/TrinityCore/TrinityCore/commit/994121e671127ce11df4e631ab0a4c310234191f) --- Source/Game/AI/CoreAI/CreatureAI.cs | 12 ++++++------ Source/Game/AI/ScriptedAI/ScriptedAI.cs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/Game/AI/CoreAI/CreatureAI.cs b/Source/Game/AI/CoreAI/CreatureAI.cs index f2b5e7337..7d6f7930b 100644 --- a/Source/Game/AI/CoreAI/CreatureAI.cs +++ b/Source/Game/AI/CoreAI/CreatureAI.cs @@ -252,13 +252,13 @@ namespace Game.AI List> outOfBounds = new(); Position startPosition = owner.GetPosition(); - if (!CheckBoundary(startPosition)) // fall back to creature position + if (!IsInBoundary(startPosition)) // fall back to creature position { startPosition = me.GetPosition(); - if (!CheckBoundary(startPosition)) + if (!IsInBoundary(startPosition)) { startPosition = me.GetHomePosition(); - if (!CheckBoundary(startPosition)) // fall back to creature home position + if (!IsInBoundary(startPosition)) // fall back to creature home position return CypherStrings.CreatureNoInteriorPointFound; } } @@ -281,7 +281,7 @@ namespace Game.AI if (!alreadyChecked.Contains(next)) // never check a coordinate twice { Position nextPos = new(startPosition.GetPositionX() + next.Key * SharedConst.BoundaryVisualizeStepSize, startPosition.GetPositionY() + next.Value * SharedConst.BoundaryVisualizeStepSize, startPosition.GetPositionZ()); - if (CheckBoundary(nextPos)) + if (IsInBoundary(nextPos)) Q.Add(next); else { @@ -314,7 +314,7 @@ namespace Game.AI return boundsWarning ? CypherStrings.CreatureMovementMaybeUnbounded : 0; } - public bool CheckBoundary(Position who = null) + public bool IsInBoundary(Position who = null) { if (_boundary == null) return true; @@ -327,7 +327,7 @@ namespace Game.AI public bool CheckInRoom() { - if (CheckBoundary()) + if (IsInBoundary()) return true; else { diff --git a/Source/Game/AI/ScriptedAI/ScriptedAI.cs b/Source/Game/AI/ScriptedAI/ScriptedAI.cs index 458843aad..44961a860 100644 --- a/Source/Game/AI/ScriptedAI/ScriptedAI.cs +++ b/Source/Game/AI/ScriptedAI/ScriptedAI.cs @@ -529,7 +529,7 @@ namespace Game.AI foreach (var pair in me.GetCombatManager().GetPvECombatRefs()) { Unit target = pair.Value.GetOther(me); - if (target.IsControlledByPlayer() && !CheckBoundary(target)) + if (target.IsControlledByPlayer() && !IsInBoundary(target)) target.NearTeleportTo(x, y, z, 0); } } @@ -604,7 +604,7 @@ namespace Game.AI public override void JustDied(Unit killer) { _JustDied(); } public override void JustReachedHome() { _JustReachedHome(); } - public override bool CanAIAttack(Unit victim) { return CheckBoundary(victim); } + public override bool CanAIAttack(Unit victim) { return IsInBoundary(victim); } public void _JustReachedHome() { me.SetActive(false); } }