]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix falsely showing damage color effect to entities that aren't allowed to be attacke...
authorDrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com>
Mon, 5 Aug 2024 03:14:01 +0000 (20:14 -0700)
committerGitHub <noreply@github.com>
Mon, 5 Aug 2024 03:14:01 +0000 (13:14 +1000)
Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs

index 72cf4ec550a797a4b2802ae976c996c11805bc57..ae0ebfe74caeb5e6787069d5ec12f8c31adf610d 100644 (file)
@@ -625,14 +625,18 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
 
         var appliedDamage = new DamageSpecifier();
 
-        foreach (var entity in targets)
+        for (var i = targets.Count - 1; i >= 0; i--)
         {
+            var entity = targets[i];
             // We raise an attack attempt here as well,
             // primarily because this was an untargeted wideswing: if a subscriber to that event cared about
             // the potential target (such as for pacifism), they need to be made aware of the target here.
             // In that case, just continue.
             if (!Blocker.CanAttack(user, entity, (weapon, component)))
+            {
+                targets.RemoveAt(i);
                 continue;
+            }
 
             var attackedEvent = new AttackedEvent(meleeUid, user, GetCoordinates(ev.Coordinates));
             RaiseLocalEvent(entity, attackedEvent);