Remove 700 usages of Component.Owner (#21100)

This commit is contained in:
DrSmugleaf
2023-10-19 12:34:31 -07:00
committed by GitHub
parent 5825ffb95c
commit f560f88eb5
261 changed files with 2291 additions and 2036 deletions

View File

@@ -1,4 +1,3 @@
using System.Numerics;
using Content.Shared.Database;
using Content.Shared.Hands.Components;
using Content.Shared.Item;
@@ -202,7 +201,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
{
// TODO make this check upwards for any container, and parent to that.
// Currently this just checks the direct parent, so items can still teleport through containers.
ContainerSystem.AttachParentToContainerOrGrid(Transform(entity));
ContainerSystem.AttachParentToContainerOrGrid((entity, Transform(entity)));
}
}

View File

@@ -21,7 +21,7 @@ public abstract partial class SharedHandsSystem
[Dependency] private readonly SharedStorageSystem _storage = default!;
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
protected event Action<HandsComponent?>? OnHandSetActive;
protected event Action<Entity<HandsComponent>?>? OnHandSetActive;
public override void Initialize()
{
@@ -216,7 +216,7 @@ public abstract partial class SharedHandsSystem
}
handComp.ActiveHand = hand;
OnHandSetActive?.Invoke(handComp);
OnHandSetActive?.Invoke((uid, handComp));
if (hand.HeldEntity != null)
RaiseLocalEvent(hand.HeldEntity.Value, new HandSelectedEvent(uid));

View File

@@ -58,7 +58,7 @@ public abstract class SharedHandVirtualItemSystem : EntitySystem
{
if (TryComp(hand.HeldEntity, out HandVirtualItemComponent? virt) && virt.BlockingEntity == matching)
{
Delete(virt, user);
Delete((hand.HeldEntity.Value, virt), user);
}
}
}
@@ -80,16 +80,16 @@ public abstract class SharedHandVirtualItemSystem : EntitySystem
/// <summary>
/// Queues a deletion for a virtual item and notifies the blocking entity and user.
/// </summary>
public void Delete(HandVirtualItemComponent comp, EntityUid user)
public void Delete(Entity<HandVirtualItemComponent> item, EntityUid user)
{
if (_net.IsClient)
return;
var userEv = new VirtualItemDeletedEvent(comp.BlockingEntity, user);
var userEv = new VirtualItemDeletedEvent(item.Comp.BlockingEntity, user);
RaiseLocalEvent(user, userEv);
var targEv = new VirtualItemDeletedEvent(comp.BlockingEntity, user);
RaiseLocalEvent(comp.BlockingEntity, targEv);
var targEv = new VirtualItemDeletedEvent(item.Comp.BlockingEntity, user);
RaiseLocalEvent(item.Comp.BlockingEntity, targEv);
QueueDel(comp.Owner);
QueueDel(item);
}
}