Nerf emitsoundoncollide (#16602)
This commit is contained in:
@@ -24,6 +24,7 @@ public sealed class GravityWellSystem : SharedGravityWellSystem
|
||||
[Dependency] private readonly IViewVariablesManager _vvManager = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
#endregion Dependencies
|
||||
|
||||
/// <summary>
|
||||
@@ -181,9 +182,12 @@ public sealed class GravityWellSystem : SharedGravityWellSystem
|
||||
|
||||
var epicenter = mapPos.Position;
|
||||
var minRange2 = MathF.Max(minRange * minRange, MinGravPulseRange); // Cache square value for speed. Also apply a sane minimum value to the minimum value so that div/0s don't happen.
|
||||
var bodyQuery = GetEntityQuery<PhysicsComponent>();
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
|
||||
foreach(var entity in _lookup.GetEntitiesInRange(mapPos.MapId, epicenter, maxRange, flags: LookupFlags.Dynamic | LookupFlags.Sundries))
|
||||
{
|
||||
if (!TryComp<PhysicsComponent>(entity, out var physics)
|
||||
if (!bodyQuery.TryGetComponent(entity, out var physics)
|
||||
|| physics.BodyType == BodyType.Static)
|
||||
{
|
||||
continue;
|
||||
@@ -192,7 +196,7 @@ public sealed class GravityWellSystem : SharedGravityWellSystem
|
||||
if(!CanGravPulseAffect(entity))
|
||||
continue;
|
||||
|
||||
var displacement = epicenter - Transform(entity).WorldPosition;
|
||||
var displacement = epicenter - _transform.GetWorldPosition(entity, xformQuery);
|
||||
var distance2 = displacement.LengthSquared;
|
||||
if (distance2 < minRange2)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user