Add EntityUid fields to some physics events (#17055)

This commit is contained in:
Leon Friedrich
2023-06-03 00:20:09 +12:00
committed by GitHub
parent 82575f6d4a
commit 7a424e40fd
9 changed files with 9 additions and 11 deletions

View File

@@ -390,7 +390,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
if (base.PreventCollide(uid, comp, ref args) || args.Cancelled) if (base.PreventCollide(uid, comp, ref args) || args.Cancelled)
return true; return true;
args.Cancelled = !CanConsumeEntity(args.BodyB.Owner, comp); args.Cancelled = !CanConsumeEntity(args.OtherEntity, comp);
return false; return false;
} }

View File

@@ -114,7 +114,7 @@ public abstract partial class SharedBuckleSystem
private void OnBucklePreventCollide(EntityUid uid, BuckleComponent component, ref PreventCollideEvent args) private void OnBucklePreventCollide(EntityUid uid, BuckleComponent component, ref PreventCollideEvent args)
{ {
if (args.BodyB.Owner != component.BuckledTo) if (args.OtherEntity != component.BuckledTo)
return; return;
if (component.Buckled || component.DontCollide) if (component.Buckled || component.DontCollide)

View File

@@ -42,7 +42,7 @@ namespace Content.Shared.Disposal
private void OnPreventCollide(EntityUid uid, SharedDisposalUnitComponent component, private void OnPreventCollide(EntityUid uid, SharedDisposalUnitComponent component,
ref PreventCollideEvent args) ref PreventCollideEvent args)
{ {
var otherBody = args.BodyB.Owner; var otherBody = args.OtherEntity;
// Items dropped shouldn't collide but items thrown should // Items dropped shouldn't collide but items thrown should
if (EntityManager.HasComponent<ItemComponent>(otherBody) && if (EntityManager.HasComponent<ItemComponent>(otherBody) &&

View File

@@ -464,7 +464,7 @@ public abstract class SharedDoorSystem : EntitySystem
private void PreventCollision(EntityUid uid, DoorComponent component, ref PreventCollideEvent args) 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; args.Cancelled = true;
} }

View File

@@ -30,9 +30,7 @@ public sealed class SharedPreventCollideSystem : EntitySystem
private void OnPreventCollide(EntityUid uid, PreventCollideComponent component, ref PreventCollideEvent args) private void OnPreventCollide(EntityUid uid, PreventCollideComponent component, ref PreventCollideEvent args)
{ {
var otherUid = args.BodyB.Owner; if (component.Uid == args.OtherEntity)
if (component.Uid == otherUid)
args.Cancelled = true; args.Cancelled = true;
} }

View File

@@ -36,7 +36,7 @@ namespace Content.Shared.Projectiles
private void PreventCollision(EntityUid uid, ProjectileComponent component, ref PreventCollideEvent args) 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; args.Cancelled = true;
} }

View File

@@ -70,7 +70,7 @@ namespace Content.Shared.Pulling
private void OnJointRemoved(EntityUid uid, SharedPullableComponent component, JointRemovedEvent args) private void OnJointRemoved(EntityUid uid, SharedPullableComponent component, JointRemovedEvent args)
{ {
if (component.Puller != args.OtherBody.Owner) if (component.Puller != args.OtherEntity)
return; return;
// Do we have some other join with our Puller? // Do we have some other join with our Puller?

View File

@@ -181,7 +181,7 @@ public abstract class SharedEventHorizonSystem : EntitySystem
/// <returns>A bool indicating whether the collision prevention has been handled.</returns> /// <returns>A bool indicating whether the collision prevention has been handled.</returns>
protected virtual bool PreventCollide(EntityUid uid, EventHorizonComponent comp, ref PreventCollideEvent args) 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. // For prediction reasons always want the client to ignore these.
if (HasComp<MapGridComponent>(otherUid) || if (HasComp<MapGridComponent>(otherUid) ||

View File

@@ -82,7 +82,7 @@ namespace Content.Shared.Throwing
private void PreventCollision(EntityUid uid, ThrownItemComponent component, ref PreventCollideEvent args) private void PreventCollision(EntityUid uid, ThrownItemComponent component, ref PreventCollideEvent args)
{ {
if (args.BodyB.Owner == component.Thrower) if (args.OtherEntity == component.Thrower)
{ {
args.Cancelled = true; args.Cancelled = true;
} }