Lasers passover objects like projectiles unless the target is clicked on (#28768)

* uh...

* fix

* alright, there we go

* Revert "alright, there we go"

This reverts commit 448180bfa58cc24c42a4d59ef34c017b9941f37b.

* Make lasers not hit certain objects and lying mobs unless clicked on

* comment

* Update Content.Server/Weapons/Ranged/Systems/GunSystem.cs

* an l vanished?

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Cojoke
2024-06-13 21:04:45 -05:00
committed by GitHub
parent e481925ea4
commit 57858cd6a5

View File

@@ -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<RequireProjectileTargetComponent>(collide.HitEntity)?.Active == true)
{
continue;
}
result = collide;
break;
}
var hit = result.HitEntity;
lastHit = hit;