prevent pulse throw from throwing observers (#19704)

This commit is contained in:
qwerltaz
2023-09-04 06:52:11 +02:00
committed by GitHub
parent 5fe9e06ef3
commit b6da21fd3e
2 changed files with 21 additions and 0 deletions

View File

@@ -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<PhysicsComponent>();
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;

View File

@@ -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<TransformComponent>();
var worldPos = _xform.GetWorldPosition(xform, xformQuery);
var physQuery = GetEntityQuery<PhysicsComponent>();
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<TransformComponent>();
var physQuery = GetEntityQuery<PhysicsComponent>();
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);
}