From b6da21fd3eb7a399fc6dbaace64b86692b07f5a0 Mon Sep 17 00:00:00 2001 From: qwerltaz <69696513+qwerltaz@users.noreply.github.com> Date: Mon, 4 Sep 2023 06:52:11 +0200 Subject: [PATCH] prevent pulse throw from throwing observers (#19704) --- .../Effects/Systems/ThrowArtifactSystem.cs | 8 ++++++++ .../Anomaly/Effects/SharedGravityAnomalySystem.cs | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs index 55159feebb..85783b552d 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs @@ -2,9 +2,12 @@ using Content.Server.Maps; using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; using Content.Server.Xenoarchaeology.XenoArtifacts.Events; +using Content.Shared.Ghost; using Content.Shared.Maps; +using Content.Shared.Physics; using Content.Shared.Throwing; using Robust.Shared.Map; +using Robust.Shared.Physics.Components; using Robust.Shared.Random; namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; @@ -41,8 +44,13 @@ public sealed class ThrowArtifactSystem : EntitySystem } var lookup = _lookup.GetEntitiesInRange(uid, component.Range, LookupFlags.Dynamic | LookupFlags.Sundries); + var physQuery = GetEntityQuery(); foreach (var ent in lookup) { + if (physQuery.TryGetComponent(ent, out var phys) + && (phys.CollisionMask & (int) CollisionGroup.GhostImpassable) != 0) + continue; + var tempXform = Transform(ent); var foo = tempXform.MapPosition.Position - xform.MapPosition.Position; diff --git a/Content.Shared/Anomaly/Effects/SharedGravityAnomalySystem.cs b/Content.Shared/Anomaly/Effects/SharedGravityAnomalySystem.cs index 1f9b2fbce5..eca71e6fd7 100644 --- a/Content.Shared/Anomaly/Effects/SharedGravityAnomalySystem.cs +++ b/Content.Shared/Anomaly/Effects/SharedGravityAnomalySystem.cs @@ -1,8 +1,11 @@ using System.Linq; using Content.Shared.Anomaly.Components; using Content.Shared.Anomaly.Effects.Components; +using Content.Shared.Ghost; using Content.Shared.Throwing; using Robust.Shared.Map; +using Content.Shared.Physics; +using Robust.Shared.Physics.Components; namespace Content.Shared.Anomaly.Effects; @@ -28,9 +31,14 @@ public abstract class SharedGravityAnomalySystem : EntitySystem var lookup = _lookup.GetEntitiesInRange(uid, range, LookupFlags.Dynamic | LookupFlags.Sundries); var xformQuery = GetEntityQuery(); var worldPos = _xform.GetWorldPosition(xform, xformQuery); + var physQuery = GetEntityQuery(); foreach (var ent in lookup) { + if (physQuery.TryGetComponent(ent, out var phys) + && (phys.CollisionMask & (int) CollisionGroup.GhostImpassable) != 0) + continue; + var foo = _xform.GetWorldPosition(ent, xformQuery) - worldPos; _throwing.TryThrow(ent, foo * 10, strength, uid, 0); } @@ -51,9 +59,14 @@ public abstract class SharedGravityAnomalySystem : EntitySystem var strength = component.MaxThrowStrength * 2; var lookup = _lookup.GetEntitiesInRange(uid, range, LookupFlags.Dynamic | LookupFlags.Sundries); var xformQuery = GetEntityQuery(); + var physQuery = GetEntityQuery(); foreach (var ent in lookup) { + if (physQuery.TryGetComponent(ent, out var phys) + && (phys.CollisionMask & (int) CollisionGroup.GhostImpassable) != 0) + continue; + var foo = _xform.GetWorldPosition(ent, xformQuery) - worldPos; _throwing.TryThrow(ent, foo * 5, strength, uid, 0); }