diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs index 8a40308a39..9c9ad5bddb 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs @@ -93,10 +93,11 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan var userPosition = user.Transform.WorldPosition; //Remember world positions are ephemeral and can only be used instantaneously var angle = new Angle(clickLocation.Position - userPosition); - var ray = new CollisionRay(userPosition, angle.ToVec(), (int)(CollisionGroup.Impassable | CollisionGroup.MobImpassable)); - var rayCastResults = IoCManager.Resolve().IntersectRay(user.Transform.MapID, ray, MaxLength, user).ToList(); + var ray = new CollisionRay(userPosition, angle.ToVec(), (int)(CollisionGroup.Opaque)); + var rayCastResults = IoCManager.Resolve().IntersectRay(user.Transform.MapID, ray, MaxLength, user, returnOnFirstHit: false).ToList(); - if (rayCastResults.Count == 1) + //The first result is guaranteed to be the closest one + if (rayCastResults.Count >= 1) { Hit(rayCastResults[0], energyModifier, user); AfterEffects(user, rayCastResults[0], angle, energyModifier); diff --git a/Resources/Prototypes/Entities/Mobs/human.yml b/Resources/Prototypes/Entities/Mobs/human.yml index 46ec5304f9..2f66e88fdd 100644 --- a/Resources/Prototypes/Entities/Mobs/human.yml +++ b/Resources/Prototypes/Entities/Mobs/human.yml @@ -109,6 +109,7 @@ - VaultImpassable - SmallImpassable layer: + - Opaque - MobImpassable - type: Input context: "human"