diff options
| author | Meji <alvaro.megias@outlook.com> | 2023-04-07 20:54:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-07 20:54:03 +0200 |
| commit | 7d5d3cf655b3e701d8a570b03499a388476cbdf9 (patch) | |
| tree | 2ffb77b97e32506ab910b4d8ce150171d0d3bd6d | |
| parent | 422d5216679f53f454218f052786816163c395eb (diff) | |
Core/Units: Prevent backward melee attacks (#28895)
| -rw-r--r-- | src/server/game/AI/CoreAI/UnitAI.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index 81077ab5565..bf7fe72bd5a 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -68,6 +68,10 @@ void UnitAI::DoMeleeAttackIfReady() if (!me->IsWithinMeleeRange(victim)) return; + // Check that the victim is in front of the unit + if (!me->HasInArc(2 * float(M_PI) / 3, victim)) + return; + //Make sure our attack is ready and we aren't currently casting before checking distance if (me->isAttackReady()) { |
