diff --git a/Content.Client/CharacterInterface/CharacterInterfaceComponent.cs b/Content.Client/CharacterInterface/CharacterInterfaceComponent.cs index f071c03269..f034a9ed30 100644 --- a/Content.Client/CharacterInterface/CharacterInterfaceComponent.cs +++ b/Content.Client/CharacterInterface/CharacterInterfaceComponent.cs @@ -42,7 +42,7 @@ namespace Content.Client.CharacterInterface base.Initialize(); //Use all the character ui interfaced components to create the character window - _uiComponents = Owner.GetAllComponents().ToList(); + _uiComponents = IoCManager.Resolve().GetComponents(Owner.Uid).ToList(); if (_uiComponents.Count == 0) { return; diff --git a/Content.Client/DragDrop/DragDropSystem.cs b/Content.Client/DragDrop/DragDropSystem.cs index e55f43e3bc..fae9133131 100644 --- a/Content.Client/DragDrop/DragDropSystem.cs +++ b/Content.Client/DragDrop/DragDropSystem.cs @@ -142,7 +142,7 @@ namespace Content.Client.DragDrop } var canDrag = false; - foreach (var draggable in entity.GetAllComponents()) + foreach (var draggable in IoCManager.Resolve().GetComponents(entity.Uid)) { var dragEventArgs = new StartDragDropEvent(dragger, entity); @@ -422,7 +422,7 @@ namespace Content.Client.DragDrop bool? valid = null; - foreach (var comp in eventArgs.Target.GetAllComponents()) + foreach (var comp in IoCManager.Resolve().GetComponents(eventArgs.Target.Uid)) { if (!comp.CanDragDropOn(eventArgs)) { @@ -440,7 +440,7 @@ namespace Content.Client.DragDrop // Need at least one IDraggable to return true or else we can't do shit valid = false; - foreach (var comp in eventArgs.User.GetAllComponents()) + foreach (var comp in IoCManager.Resolve().GetComponents(eventArgs.User.Uid)) { if (!comp.CanDrop(eventArgs)) continue; valid = true; diff --git a/Content.Client/Items/UI/ItemStatusPanel.cs b/Content.Client/Items/UI/ItemStatusPanel.cs index 7e9911f2a6..8afa76be4d 100644 --- a/Content.Client/Items/UI/ItemStatusPanel.cs +++ b/Content.Client/Items/UI/ItemStatusPanel.cs @@ -185,7 +185,7 @@ namespace Content.Client.Items.UI ClearOldStatus(); - foreach (var statusComponent in _entity!.GetAllComponents()) + foreach (var statusComponent in IoCManager.Resolve().GetComponents(_entity!.Uid)) { var control = statusComponent.MakeControl(); _statusContents.AddChild(control); diff --git a/Content.Server/Actions/Actions/DisarmAction.cs b/Content.Server/Actions/Actions/DisarmAction.cs index bc0caf804f..d60828fcc6 100644 --- a/Content.Server/Actions/Actions/DisarmAction.cs +++ b/Content.Server/Actions/Actions/DisarmAction.cs @@ -21,6 +21,7 @@ using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; using System; +using System.Collections.Generic; using System.Linq; using Content.Server.Administration.Logs; using Content.Server.Popups; @@ -48,7 +49,7 @@ namespace Content.Server.Actions.Actions public void DoTargetEntityAction(TargetEntityActionEventArgs args) { - var disarmedActs = args.Target.GetAllComponents().ToArray(); + var disarmedActs = IoCManager.Resolve().GetComponents(args.Target.Uid).ToArray(); if (!args.Performer.InRangeUnobstructed(args.Target)) return; diff --git a/Content.Server/Administration/Commands/RemoveExtraComponents.cs b/Content.Server/Administration/Commands/RemoveExtraComponents.cs index 4d3d0200c2..13a88a937c 100644 --- a/Content.Server/Administration/Commands/RemoveExtraComponents.cs +++ b/Content.Server/Administration/Commands/RemoveExtraComponents.cs @@ -1,4 +1,5 @@ -using Content.Shared.Administration; +using System.Collections.Generic; +using Content.Shared.Administration; using Robust.Shared.Console; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -39,7 +40,7 @@ namespace Content.Server.Administration.Commands var modified = false; - foreach (var component in entity.GetAllComponents()) + foreach (var component in IoCManager.Resolve().GetComponents(entity.Uid)) { if (IoCManager.Resolve().GetComponent(entity.Uid).EntityPrototype.Components.ContainsKey(component.Name)) continue; diff --git a/Content.Server/Chat/Commands/SuicideCommand.cs b/Content.Server/Chat/Commands/SuicideCommand.cs index d4c32071be..7ec59dab58 100644 --- a/Content.Server/Chat/Commands/SuicideCommand.cs +++ b/Content.Server/Chat/Commands/SuicideCommand.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Linq; using Content.Server.Act; using Content.Server.Administration; @@ -91,7 +92,7 @@ namespace Content.Server.Chat.Commands var itemComponent = handsComponent.GetActiveHand; if (itemComponent != null) { - var suicide = itemComponent.Owner.GetAllComponents().FirstOrDefault(); + var suicide = IoCManager.Resolve().GetComponents(itemComponent.Owner.Uid).FirstOrDefault(); if (suicide != null) { @@ -108,7 +109,7 @@ namespace Content.Server.Chat.Commands { if (entity.HasComponent()) continue; - var suicide = entity.GetAllComponents().FirstOrDefault(); + var suicide = IoCManager.Resolve().GetComponents(entity.Uid).FirstOrDefault(); if (suicide != null) { DealDamage(suicide, chat, owner); diff --git a/Content.Server/Construction/Components/MachineComponent.cs b/Content.Server/Construction/Components/MachineComponent.cs index 516bc57110..cdcba94efd 100644 --- a/Content.Server/Construction/Components/MachineComponent.cs +++ b/Content.Server/Construction/Components/MachineComponent.cs @@ -39,7 +39,7 @@ namespace Content.Server.Construction.Components public void RefreshParts() { - foreach (var refreshable in Owner.GetAllComponents()) + foreach (var refreshable in IoCManager.Resolve().GetComponents(Owner.Uid)) { refreshable.RefreshParts(GetAllParts()); } diff --git a/Content.Server/Interaction/InteractionSystem.cs b/Content.Server/Interaction/InteractionSystem.cs index 516d8e8f55..e39f2a418c 100644 --- a/Content.Server/Interaction/InteractionSystem.cs +++ b/Content.Server/Interaction/InteractionSystem.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; @@ -176,7 +177,7 @@ namespace Content.Server.Interaction // trigger dragdrops on the dropped entity RaiseLocalEvent(dropped.Uid, interactionArgs); - foreach (var dragDrop in dropped.GetAllComponents()) + foreach (var dragDrop in IoCManager.Resolve().GetComponents(dropped.Uid)) { if (dragDrop.CanDrop(interactionArgs) && dragDrop.Drop(interactionArgs)) @@ -187,7 +188,7 @@ namespace Content.Server.Interaction // trigger dragdropons on the targeted entity RaiseLocalEvent(target.Uid, interactionArgs, false); - foreach (var dragDropOn in target.GetAllComponents()) + foreach (var dragDropOn in IoCManager.Resolve().GetComponents(target.Uid)) { if (dragDropOn.CanDragDropOn(interactionArgs) && dragDropOn.DragDropOn(interactionArgs)) @@ -404,7 +405,7 @@ namespace Content.Server.Interaction var interactHandEventArgs = new InteractHandEventArgs(user, target); - var interactHandComps = target.GetAllComponents().ToList(); + var interactHandComps = IoCManager.Resolve().GetComponents(target.Uid).ToList(); foreach (var interactHandComp in interactHandComps) { // If an InteractHand returns a status completion we finish our interaction @@ -434,7 +435,7 @@ namespace Content.Server.Interaction if (rangedMsg.Handled) return true; - var rangedInteractions = target.GetAllComponents().ToList(); + var rangedInteractions = IoCManager.Resolve().GetComponents(target.Uid).ToList(); var rangedInteractionEventArgs = new RangedInteractEventArgs(user, used, clickLocation); // See if we have a ranged interaction diff --git a/Content.Server/Inventory/Components/InventoryComponent.cs b/Content.Server/Inventory/Components/InventoryComponent.cs index cfe7fe626d..551f21ec5b 100644 --- a/Content.Server/Inventory/Components/InventoryComponent.cs +++ b/Content.Server/Inventory/Components/InventoryComponent.cs @@ -545,7 +545,7 @@ namespace Content.Server.Inventory.Components { foreach (var entity in slot.ContainedEntities) { - var exActs = entity.GetAllComponents().ToList(); + var exActs = IoCManager.Resolve().GetComponents(entity.Uid).ToList(); foreach (var exAct in exActs) { exAct.OnExplosion(eventArgs); diff --git a/Content.Server/Items/ItemComponent.cs b/Content.Server/Items/ItemComponent.cs index 63c5fad6a2..8d1050259e 100644 --- a/Content.Server/Items/ItemComponent.cs +++ b/Content.Server/Items/ItemComponent.cs @@ -1,6 +1,8 @@ +using System.Collections.Generic; using Content.Shared.Item; using Robust.Server.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.Server.Items { @@ -10,7 +12,7 @@ namespace Content.Server.Items { public override void RemovedFromSlot() { - foreach (var component in Owner.GetAllComponents()) + foreach (var component in IoCManager.Resolve().GetComponents(Owner.Uid)) { component.Visible = true; } @@ -18,7 +20,7 @@ namespace Content.Server.Items public override void EquippedToSlot() { - foreach (var component in Owner.GetAllComponents()) + foreach (var component in IoCManager.Resolve().GetComponents(Owner.Uid)) { component.Visible = false; } diff --git a/Content.Server/Power/NodeGroups/BaseNetConnectorNodeGroup.cs b/Content.Server/Power/NodeGroups/BaseNetConnectorNodeGroup.cs index 9bdee30633..bc33637424 100644 --- a/Content.Server/Power/NodeGroups/BaseNetConnectorNodeGroup.cs +++ b/Content.Server/Power/NodeGroups/BaseNetConnectorNodeGroup.cs @@ -3,6 +3,8 @@ using System.Linq; using Content.Server.NodeContainer.NodeGroups; using Content.Server.NodeContainer.Nodes; using Content.Server.Power.Components; +using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.Server.Power.NodeGroups { @@ -14,8 +16,7 @@ namespace Content.Server.Power.NodeGroups foreach (var node in groupNodes) { - var newNetConnectorComponents = node.Owner - .GetAllComponents>() + var newNetConnectorComponents = IoCManager.Resolve().GetComponents>(node.Owner.Uid) .Where(powerComp => (powerComp.NodeId == null || powerComp.NodeId == node.Name) && (NodeGroupID) powerComp.Voltage == node.NodeGroupID) .ToList(); diff --git a/Content.Server/Radiation/RadiationPulseSystem.cs b/Content.Server/Radiation/RadiationPulseSystem.cs index 6f5eb0497e..39588c0dbc 100644 --- a/Content.Server/Radiation/RadiationPulseSystem.cs +++ b/Content.Server/Radiation/RadiationPulseSystem.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Linq; using Content.Shared.Radiation; using Content.Shared.Sound; @@ -41,7 +42,7 @@ namespace Content.Server.Radiation // Note: Radiation is liable for a refactor (stinky Sloth coding a basic version when he did StationEvents) // so this ToArray doesn't really matter. - foreach (var radiation in entity.GetAllComponents().ToArray()) + foreach (var radiation in IoCManager.Resolve().GetComponents(entity.Uid).ToArray()) { radiation.RadiationAct(RadiationCooldown, comp); } diff --git a/Content.Server/Storage/Components/EntityStorageComponent.cs b/Content.Server/Storage/Components/EntityStorageComponent.cs index f822bcb769..ed87d921a8 100644 --- a/Content.Server/Storage/Components/EntityStorageComponent.cs +++ b/Content.Server/Storage/Components/EntityStorageComponent.cs @@ -463,7 +463,7 @@ namespace Content.Server.Storage.Components var containedEntities = Contents.ContainedEntities.ToList(); foreach (var entity in containedEntities) { - var exActs = entity.GetAllComponents().ToArray(); + var exActs = IoCManager.Resolve().GetComponents(entity.Uid).ToArray(); foreach (var exAct in exActs) { exAct.OnExplosion(eventArgs); diff --git a/Content.Server/Storage/Components/ServerStorageComponent.cs b/Content.Server/Storage/Components/ServerStorageComponent.cs index 2780e55c30..48df420e95 100644 --- a/Content.Server/Storage/Components/ServerStorageComponent.cs +++ b/Content.Server/Storage/Components/ServerStorageComponent.cs @@ -685,7 +685,7 @@ namespace Content.Server.Storage.Components foreach (var entity in storedEntities) { - var exActs = entity.GetAllComponents().ToArray(); + var exActs = IoCManager.Resolve().GetComponents(entity.Uid).ToArray(); foreach (var exAct in exActs) { exAct.OnExplosion(eventArgs); diff --git a/Content.Server/WireHacking/WiresComponent.cs b/Content.Server/WireHacking/WiresComponent.cs index 46b956fc50..ab419859c3 100644 --- a/Content.Server/WireHacking/WiresComponent.cs +++ b/Content.Server/WireHacking/WiresComponent.cs @@ -230,7 +230,7 @@ namespace Content.Server.WireHacking hackingSystem.TryGetLayout(_layoutId, out layout); } - foreach (var wiresProvider in Owner.GetAllComponents()) + foreach (var wiresProvider in IoCManager.Resolve().GetComponents(Owner.Uid)) { var builder = new WiresBuilder(this, wiresProvider, layout); wiresProvider.RegisterWires(builder); diff --git a/Content.Shared/Body/Components/SharedBodyComponent.cs b/Content.Shared/Body/Components/SharedBodyComponent.cs index 8caafb5251..f9f622908b 100644 --- a/Content.Shared/Body/Components/SharedBodyComponent.cs +++ b/Content.Shared/Body/Components/SharedBodyComponent.cs @@ -147,7 +147,7 @@ namespace Content.Shared.Body.Components var argsAdded = new BodyPartAddedEventArgs(slot.Id, part); EntitySystem.Get().BodyPartAdded(OwnerUid, argsAdded); - foreach (var component in Owner.GetAllComponents().ToArray()) + foreach (var component in IoCManager.Resolve().GetComponents(Owner.Uid).ToArray()) { component.BodyPartAdded(argsAdded); } @@ -175,7 +175,7 @@ namespace Content.Shared.Body.Components EntitySystem.Get().BodyPartRemoved(OwnerUid, args); - foreach (var component in Owner.GetAllComponents()) + foreach (var component in IoCManager.Resolve().GetComponents(Owner.Uid)) { component.BodyPartRemoved(args); } diff --git a/Content.Shared/Examine/ExamineSystemShared.cs b/Content.Shared/Examine/ExamineSystemShared.cs index 5298ddab19..473b868836 100644 --- a/Content.Shared/Examine/ExamineSystemShared.cs +++ b/Content.Shared/Examine/ExamineSystemShared.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using Content.Shared.DragDrop; using Content.Shared.Interaction; @@ -226,7 +227,7 @@ namespace Content.Shared.Examine RaiseLocalEvent(entity.Uid, examinedEvent); //Add component statuses from components that report one - foreach (var examineComponent in entity.GetAllComponents()) + foreach (var examineComponent in IoCManager.Resolve().GetComponents(entity.Uid)) { var subMessage = new FormattedMessage(); examineComponent.Examine(subMessage, isInDetailsRange); diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index f004646cdc..31acf61a9a 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Content.Shared.ActionBlocker; @@ -391,7 +392,7 @@ namespace Content.Shared.Interaction var interactUsingEventArgs = new InteractUsingEventArgs(user, clickLocation, used, target); - var interactUsings = target.GetAllComponents().OrderByDescending(x => x.Priority); + var interactUsings = IoCManager.Resolve().GetComponents(target.Uid).OrderByDescending(x => x.Priority); foreach (var interactUsing in interactUsings) { // If an InteractUsing returns a status completion we finish our interaction @@ -414,7 +415,7 @@ namespace Content.Shared.Interaction return true; var afterInteractEventArgs = new AfterInteractEventArgs(user, clickLocation, target, canReach); - var afterInteracts = used.GetAllComponents().OrderByDescending(x => x.Priority).ToList(); + var afterInteracts = IoCManager.Resolve().GetComponents(used.Uid).OrderByDescending(x => x.Priority).ToList(); foreach (var afterInteract in afterInteracts) { @@ -515,7 +516,7 @@ namespace Content.Shared.Interaction if (useMsg.Handled) return; - var uses = used.GetAllComponents().ToList(); + var uses = IoCManager.Resolve().GetComponents(used.Uid).ToList(); // Try to use item on any components which have the interface foreach (var use in uses) @@ -556,7 +557,7 @@ namespace Content.Shared.Interaction return; } - var comps = thrown.GetAllComponents().ToList(); + var comps = IoCManager.Resolve().GetComponents(thrown.Uid).ToList(); var args = new ThrownEventArgs(user); // Call Thrown on all components that implement the interface @@ -580,7 +581,7 @@ namespace Content.Shared.Interaction if (equipMsg.Handled) return; - var comps = equipped.GetAllComponents().ToList(); + var comps = IoCManager.Resolve().GetComponents(equipped.Uid).ToList(); // Call Thrown on all components that implement the interface foreach (var comp in comps) @@ -600,7 +601,7 @@ namespace Content.Shared.Interaction if (unequipMsg.Handled) return; - var comps = equipped.GetAllComponents().ToList(); + var comps = IoCManager.Resolve().GetComponents(equipped.Uid).ToList(); // Call Thrown on all components that implement the interface foreach (var comp in comps) @@ -621,7 +622,7 @@ namespace Content.Shared.Interaction if (equippedHandMessage.Handled) return; - var comps = item.GetAllComponents().ToList(); + var comps = IoCManager.Resolve().GetComponents(item.Uid).ToList(); foreach (var comp in comps) { @@ -640,7 +641,7 @@ namespace Content.Shared.Interaction if (unequippedHandMessage.Handled) return; - var comps = item.GetAllComponents().ToList(); + var comps = IoCManager.Resolve().GetComponents(item.Uid).ToList(); foreach (var comp in comps) { @@ -679,7 +680,7 @@ namespace Content.Shared.Interaction item.Transform.LocalRotation = Angle.Zero; - var comps = item.GetAllComponents().ToList(); + var comps = IoCManager.Resolve().GetComponents(item.Uid).ToList(); // Call Land on all components that implement the interface foreach (var comp in comps) @@ -702,7 +703,7 @@ namespace Content.Shared.Interaction if (handSelectedMsg.Handled) return; - var comps = item.GetAllComponents().ToList(); + var comps = IoCManager.Resolve().GetComponents(item.Uid).ToList(); // Call Land on all components that implement the interface foreach (var comp in comps) @@ -722,7 +723,7 @@ namespace Content.Shared.Interaction if (handDeselectedMsg.Handled) return; - var comps = item.GetAllComponents().ToList(); + var comps = IoCManager.Resolve().GetComponents(item.Uid).ToList(); // Call Land on all components that implement the interface foreach (var comp in comps)