From 189d00d81163edd6b4e7f5b679946d0db4483178 Mon Sep 17 00:00:00 2001 From: Freagarach Date: Mon, 12 Apr 2021 12:41:35 +0000 Subject: [PATCH] Fix entities being able to attack allied structures in rare cases. Caused by not checking the attack type while performing an attack. Closes: #5511 Differential revision: D3840 References #3484 This was SVN commit r25242. --- binaries/data/mods/public/simulation/components/Attack.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binaries/data/mods/public/simulation/components/Attack.js b/binaries/data/mods/public/simulation/components/Attack.js index 392027becc..d0dcf54026 100644 --- a/binaries/data/mods/public/simulation/components/Attack.js +++ b/binaries/data/mods/public/simulation/components/Attack.js @@ -452,7 +452,7 @@ Attack.prototype.StartAttacking = function(target, type, callerIID) if (this.target) this.StopAttacking(); - if (!this.CanAttack(target)) + if (!this.CanAttack(target, [type])) return false; let timings = this.GetTimers(type); @@ -522,7 +522,7 @@ Attack.prototype.StopAttacking = function(reason) */ Attack.prototype.Attack = function(type, lateness) { - if (!this.CanAttack(this.target)) + if (!this.CanAttack(this.target, [type])) { this.StopAttacking("TargetInvalidated"); return;