diff --git a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs index cb893299a9..7f7c7ba855 100644 --- a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs @@ -17,6 +17,7 @@ using Content.Shared.Weapons.Ranged.Components; using Content.Shared.Weapons.Ranged.Events; using Content.Shared.Weapons.Ranged.Systems; using Content.Shared.Weapons.Reflect; +using Content.Shared.Damage.Components; using Robust.Shared.Audio; using Robust.Shared.Map; using Robust.Shared.Physics; @@ -202,6 +203,20 @@ public sealed partial class GunSystem : SharedGunSystem break; var result = rayCastResults[0]; + + // Checks if the laser should pass over unless targeted by its user + foreach (var collide in rayCastResults) + { + if (collide.HitEntity != gun.Target && + CompOrNull(collide.HitEntity)?.Active == true) + { + continue; + } + + result = collide; + break; + } + var hit = result.HitEntity; lastHit = hit;