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,8 +1,5 @@
using System.Linq;
using System.Text; // todo: remove this stinky LINQy
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Timing;
using System.Text;
using Content.Server.Paper;
using Content.Server.Popups;
using Content.Server.UserInterface;
@@ -11,6 +8,10 @@ using Content.Shared.Forensics;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Timing;
// todo: remove this stinky LINQy
namespace Content.Server.Forensics
{
@@ -83,7 +84,7 @@ namespace Content.Server.Forensics
scanner.LastScannedName = MetaData(args.Args.Target.Value).EntityName;
}
OpenUserInterface(args.Args.User, scanner);
OpenUserInterface(args.Args.User, (uid, scanner));
}
/// <remarks>
@@ -160,14 +161,14 @@ namespace Content.Server.Forensics
UpdateUserInterface(uid, component);
}
private void OpenUserInterface(EntityUid user, ForensicScannerComponent component)
private void OpenUserInterface(EntityUid user, Entity<ForensicScannerComponent> scanner)
{
if (!TryComp<ActorComponent>(user, out var actor))
return;
UpdateUserInterface(component.Owner, component);
UpdateUserInterface(scanner, scanner.Comp);
_uiSystem.TryOpen(component.Owner, ForensicScannerUiKey.Key, actor.PlayerSession);
_uiSystem.TryOpen(scanner, ForensicScannerUiKey.Key, actor.PlayerSession);
}
private void OnPrint(EntityUid uid, ForensicScannerComponent component, ForensicScannerPrintMessage args)
@@ -192,7 +193,7 @@ namespace Content.Server.Forensics
var printed = EntityManager.SpawnEntity(component.MachineOutput, Transform(uid).Coordinates);
_handsSystem.PickupOrDrop(args.Session.AttachedEntity, printed, checkActionBlocker: false);
if (!TryComp<PaperComponent>(printed, out var paper))
if (!HasComp<PaperComponent>(printed))
{
_sawmill.Error("Printed paper did not have PaperComponent.");
return;