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,11 +1,9 @@
using Content.Server.Administration.Logs;
using Content.Server.Power.Components;
using Content.Server.Stack;
using Content.Shared.Database;
using Content.Shared.Interaction;
using Content.Shared.Maps;
using Content.Shared.Stacks;
using Robust.Shared.Map;
namespace Content.Server.Power.EntitySystems;
@@ -18,11 +16,14 @@ public sealed partial class CableSystem
SubscribeLocalEvent<CablePlacerComponent, AfterInteractEvent>(OnCablePlacerAfterInteract);
}
private void OnCablePlacerAfterInteract(EntityUid uid, CablePlacerComponent component, AfterInteractEvent args)
private void OnCablePlacerAfterInteract(Entity<CablePlacerComponent> placer, ref AfterInteractEvent args)
{
if (args.Handled || !args.CanReach) return;
if (args.Handled || !args.CanReach)
return;
if (component.CablePrototypeId == null) return;
var component = placer.Comp;
if (component.CablePrototypeId == null)
return;
if(!_mapManager.TryGetGrid(args.ClickLocation.GetGridUid(EntityManager), out var grid))
return;
@@ -39,7 +40,7 @@ public sealed partial class CableSystem
return;
}
if (TryComp<StackComponent>(component.Owner, out var stack) && !_stack.Use(component.Owner, 1, stack))
if (TryComp<StackComponent>(placer, out var stack) && !_stack.Use(placer, 1, stack))
return;
var newCable = EntityManager.SpawnEntity(component.CablePrototypeId, grid.GridTileToLocal(snapPos));