From 7a424e40fdab18a20bdb6b671e92fa04977df5ef Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Sat, 3 Jun 2023 00:20:09 +1200 Subject: [PATCH] Add EntityUid fields to some physics events (#17055) --- .../Singularity/EntitySystems/EventHorizonSystem.cs | 2 +- Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs | 2 +- Content.Shared/Disposal/SharedDisposalUnitSystem.cs | 2 +- Content.Shared/Doors/Systems/SharedDoorSystem.cs | 2 +- Content.Shared/Physics/SharedPreventCollideSystem.cs | 4 +--- Content.Shared/Projectiles/SharedProjectileSystem.cs | 2 +- Content.Shared/Pulling/Systems/SharedPullingSystem.cs | 2 +- .../Singularity/EntitySystems/SharedEventHorizonSystem.cs | 2 +- Content.Shared/Throwing/ThrownItemSystem.cs | 2 +- 9 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs b/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs index 3f3c83b47e..28e77941dd 100644 --- a/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs +++ b/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs @@ -390,7 +390,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem if (base.PreventCollide(uid, comp, ref args) || args.Cancelled) return true; - args.Cancelled = !CanConsumeEntity(args.BodyB.Owner, comp); + args.Cancelled = !CanConsumeEntity(args.OtherEntity, comp); return false; } diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs index 405cce0ebe..8a06ce55c1 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs @@ -114,7 +114,7 @@ public abstract partial class SharedBuckleSystem private void OnBucklePreventCollide(EntityUid uid, BuckleComponent component, ref PreventCollideEvent args) { - if (args.BodyB.Owner != component.BuckledTo) + if (args.OtherEntity != component.BuckledTo) return; if (component.Buckled || component.DontCollide) diff --git a/Content.Shared/Disposal/SharedDisposalUnitSystem.cs b/Content.Shared/Disposal/SharedDisposalUnitSystem.cs index 470dbbc94c..cc573c4243 100644 --- a/Content.Shared/Disposal/SharedDisposalUnitSystem.cs +++ b/Content.Shared/Disposal/SharedDisposalUnitSystem.cs @@ -42,7 +42,7 @@ namespace Content.Shared.Disposal private void OnPreventCollide(EntityUid uid, SharedDisposalUnitComponent component, ref PreventCollideEvent args) { - var otherBody = args.BodyB.Owner; + var otherBody = args.OtherEntity; // Items dropped shouldn't collide but items thrown should if (EntityManager.HasComponent(otherBody) && diff --git a/Content.Shared/Doors/Systems/SharedDoorSystem.cs b/Content.Shared/Doors/Systems/SharedDoorSystem.cs index af4b9101cf..d607319eb3 100644 --- a/Content.Shared/Doors/Systems/SharedDoorSystem.cs +++ b/Content.Shared/Doors/Systems/SharedDoorSystem.cs @@ -464,7 +464,7 @@ public abstract class SharedDoorSystem : EntitySystem private void PreventCollision(EntityUid uid, DoorComponent component, ref PreventCollideEvent args) { - if (component.CurrentlyCrushing.Contains(args.BodyB.Owner)) + if (component.CurrentlyCrushing.Contains(args.OtherEntity)) { args.Cancelled = true; } diff --git a/Content.Shared/Physics/SharedPreventCollideSystem.cs b/Content.Shared/Physics/SharedPreventCollideSystem.cs index b28f900d14..805981fe31 100644 --- a/Content.Shared/Physics/SharedPreventCollideSystem.cs +++ b/Content.Shared/Physics/SharedPreventCollideSystem.cs @@ -30,9 +30,7 @@ public sealed class SharedPreventCollideSystem : EntitySystem private void OnPreventCollide(EntityUid uid, PreventCollideComponent component, ref PreventCollideEvent args) { - var otherUid = args.BodyB.Owner; - - if (component.Uid == otherUid) + if (component.Uid == args.OtherEntity) args.Cancelled = true; } diff --git a/Content.Shared/Projectiles/SharedProjectileSystem.cs b/Content.Shared/Projectiles/SharedProjectileSystem.cs index cd01b71cc0..9aed24144c 100644 --- a/Content.Shared/Projectiles/SharedProjectileSystem.cs +++ b/Content.Shared/Projectiles/SharedProjectileSystem.cs @@ -36,7 +36,7 @@ namespace Content.Shared.Projectiles private void PreventCollision(EntityUid uid, ProjectileComponent component, ref PreventCollideEvent args) { - if (component.IgnoreShooter && args.BodyB.Owner == component.Shooter) + if (component.IgnoreShooter && args.OtherEntity == component.Shooter) { args.Cancelled = true; } diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs index 6bacc338ec..c7f247452f 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs @@ -70,7 +70,7 @@ namespace Content.Shared.Pulling private void OnJointRemoved(EntityUid uid, SharedPullableComponent component, JointRemovedEvent args) { - if (component.Puller != args.OtherBody.Owner) + if (component.Puller != args.OtherEntity) return; // Do we have some other join with our Puller? diff --git a/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs b/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs index 6e7ade2493..01f6f586ff 100644 --- a/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs +++ b/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs @@ -181,7 +181,7 @@ public abstract class SharedEventHorizonSystem : EntitySystem /// A bool indicating whether the collision prevention has been handled. protected virtual bool PreventCollide(EntityUid uid, EventHorizonComponent comp, ref PreventCollideEvent args) { - var otherUid = args.BodyB.Owner; + var otherUid = args.OtherEntity; // For prediction reasons always want the client to ignore these. if (HasComp(otherUid) || diff --git a/Content.Shared/Throwing/ThrownItemSystem.cs b/Content.Shared/Throwing/ThrownItemSystem.cs index c6653c1550..1eb12938d7 100644 --- a/Content.Shared/Throwing/ThrownItemSystem.cs +++ b/Content.Shared/Throwing/ThrownItemSystem.cs @@ -82,7 +82,7 @@ namespace Content.Shared.Throwing private void PreventCollision(EntityUid uid, ThrownItemComponent component, ref PreventCollideEvent args) { - if (args.BodyB.Owner == component.Thrower) + if (args.OtherEntity == component.Thrower) { args.Cancelled = true; }