prevent pulse throw from throwing observers (#19704)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user