diff --git a/Content.Client/AME/Visualizers/AMEControllerVisualizer.cs b/Content.Client/AME/Visualizers/AMEControllerVisualizer.cs index 99243fdb37..f84fb0bbd7 100644 --- a/Content.Client/AME/Visualizers/AMEControllerVisualizer.cs +++ b/Content.Client/AME/Visualizers/AMEControllerVisualizer.cs @@ -1,6 +1,7 @@ using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using static Content.Shared.AME.SharedAMEControllerComponent; namespace Content.Client.AME.Visualizers @@ -11,7 +12,7 @@ namespace Content.Client.AME.Visualizers public override void InitializeEntity(IEntity entity) { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); sprite.LayerMapSet(Layers.Display, sprite.AddLayerState("control_on")); sprite.LayerSetVisible(Layers.Display, false); @@ -20,7 +21,7 @@ namespace Content.Client.AME.Visualizers public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (component.TryGetData(AMEControllerVisuals.DisplayState, out var state)) { switch (state) diff --git a/Content.Client/AME/Visualizers/AMEVisualizer.cs b/Content.Client/AME/Visualizers/AMEVisualizer.cs index eaf691cba0..12eaf91fbd 100644 --- a/Content.Client/AME/Visualizers/AMEVisualizer.cs +++ b/Content.Client/AME/Visualizers/AMEVisualizer.cs @@ -1,6 +1,7 @@ using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using static Content.Shared.AME.SharedAMEShieldComponent; namespace Content.Client.AME.Visualizers @@ -11,7 +12,7 @@ namespace Content.Client.AME.Visualizers public override void InitializeEntity(IEntity entity) { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); sprite.LayerMapSet(Layers.Core, sprite.AddLayerState("core")); sprite.LayerSetVisible(Layers.Core, false); sprite.LayerMapSet(Layers.CoreState, sprite.AddLayerState("core_weak")); @@ -21,7 +22,7 @@ namespace Content.Client.AME.Visualizers public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (component.TryGetData(AMEShieldVisuals.Core, out var core)) { if (core == "isCore") diff --git a/Content.Client/Animations/AnimationsTestComponent.cs b/Content.Client/Animations/AnimationsTestComponent.cs index 234a509eb4..3673c60afe 100644 --- a/Content.Client/Animations/AnimationsTestComponent.cs +++ b/Content.Client/Animations/AnimationsTestComponent.cs @@ -3,6 +3,7 @@ using Robust.Client.Animations; using Robust.Client.GameObjects; using Robust.Shared.Animations; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; namespace Content.Client.Animations @@ -16,7 +17,7 @@ namespace Content.Client.Animations { base.Initialize(); - var animations = Owner.GetComponent(); + var animations = IoCManager.Resolve().GetComponent(Owner.Uid); animations.Play(new Animation { Length = TimeSpan.FromSeconds(20), diff --git a/Content.Client/Animations/ReusableAnimations.cs b/Content.Client/Animations/ReusableAnimations.cs index 8326c5feb4..f69626fd30 100644 --- a/Content.Client/Animations/ReusableAnimations.cs +++ b/Content.Client/Animations/ReusableAnimations.cs @@ -22,10 +22,10 @@ namespace Content.Client.Animations Logger.Error("Entity ({0}) couldn't be animated for pickup since it doesn't have a {1}!", entity.Name, nameof(SpriteComponent)); return; } - var sprite = animatableClone.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(animatableClone.Uid); sprite.CopyFrom(sprite0); - var animations = animatableClone.GetComponent(); + var animations = IoCManager.Resolve().GetComponent(animatableClone.Uid); animations.AnimationCompleted += (_) => { IoCManager.Resolve().DeleteEntity(animatableClone.Uid); }; diff --git a/Content.Client/Atmos/Visualizers/FireVisualizer.cs b/Content.Client/Atmos/Visualizers/FireVisualizer.cs index db7d36e1a2..2dc75bac94 100644 --- a/Content.Client/Atmos/Visualizers/FireVisualizer.cs +++ b/Content.Client/Atmos/Visualizers/FireVisualizer.cs @@ -3,6 +3,7 @@ using Content.Shared.Atmos.Components; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Client.Atmos.Visualizers @@ -26,7 +27,7 @@ namespace Content.Client.Atmos.Visualizers { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); sprite.LayerMapReserveBlank(FireVisualLayers.Fire); sprite.LayerSetVisible(FireVisualLayers.Fire, false); @@ -49,7 +50,7 @@ namespace Content.Client.Atmos.Visualizers private void SetOnFire(AppearanceComponent component, bool onFire, float fireStacks) { - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (_sprite != null) { diff --git a/Content.Client/Atmos/Visualizers/GasCanisterVisualizer.cs b/Content.Client/Atmos/Visualizers/GasCanisterVisualizer.cs index 916a8b8abf..a42799a81e 100644 --- a/Content.Client/Atmos/Visualizers/GasCanisterVisualizer.cs +++ b/Content.Client/Atmos/Visualizers/GasCanisterVisualizer.cs @@ -2,6 +2,7 @@ using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Client.Atmos.Visualizers @@ -19,7 +20,7 @@ namespace Content.Client.Atmos.Visualizers { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); sprite.LayerMapSet(Layers.PressureLight, sprite.AddLayerState(_statePressure[0])); sprite.LayerSetShader(Layers.PressureLight, "unshaded"); diff --git a/Content.Client/Atmos/Visualizers/GasPortableVisualizer.cs b/Content.Client/Atmos/Visualizers/GasPortableVisualizer.cs index 417d690d46..1bae2d07a0 100644 --- a/Content.Client/Atmos/Visualizers/GasPortableVisualizer.cs +++ b/Content.Client/Atmos/Visualizers/GasPortableVisualizer.cs @@ -2,6 +2,7 @@ using Content.Shared.Atmos.Piping.Unary.Components; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Client.Atmos.Visualizers @@ -16,7 +17,7 @@ namespace Content.Client.Atmos.Visualizers { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); if (_stateConnected != null) { diff --git a/Content.Client/Botany/PlantHolderVisualizer.cs b/Content.Client/Botany/PlantHolderVisualizer.cs index 2cd216d7d2..f5798fb867 100644 --- a/Content.Client/Botany/PlantHolderVisualizer.cs +++ b/Content.Client/Botany/PlantHolderVisualizer.cs @@ -2,6 +2,7 @@ using Content.Shared.Botany; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Utility; namespace Content.Client.Botany @@ -13,7 +14,7 @@ namespace Content.Client.Botany { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); sprite.LayerMapReserveBlank(PlantHolderLayers.Plant); sprite.LayerMapReserveBlank(PlantHolderLayers.HealthLight); @@ -55,7 +56,7 @@ namespace Content.Client.Botany { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (component.TryGetData(PlantHolderVisuals.Plant, out var specifier)) { diff --git a/Content.Client/Buckle/BuckleVisualizer.cs b/Content.Client/Buckle/BuckleVisualizer.cs index d53dea6bd3..ada75bfc34 100644 --- a/Content.Client/Buckle/BuckleVisualizer.cs +++ b/Content.Client/Buckle/BuckleVisualizer.cs @@ -5,6 +5,7 @@ using Robust.Client.Animations; using Robust.Client.GameObjects; using Robust.Shared.Animations; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; namespace Content.Client.Buckle @@ -30,7 +31,7 @@ namespace Content.Client.Buckle private void SetRotation(AppearanceComponent component, Angle rotation) { - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent? animation)) { diff --git a/Content.Client/Chemistry/Visualizers/VaporVisualizer.cs b/Content.Client/Chemistry/Visualizers/VaporVisualizer.cs index 83192c5709..05b20993ab 100644 --- a/Content.Client/Chemistry/Visualizers/VaporVisualizer.cs +++ b/Content.Client/Chemistry/Visualizers/VaporVisualizer.cs @@ -4,6 +4,7 @@ using JetBrains.Annotations; using Robust.Client.Animations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; @@ -53,7 +54,7 @@ namespace Content.Client.Chemistry.Visualizers { if (!state) return; - var animPlayer = component.Owner.GetComponent(); + var animPlayer = IoCManager.Resolve().GetComponent(component.Owner.Uid); if(!animPlayer.HasRunningAnimation(AnimationKey)) animPlayer.Play(VaporFlick, AnimationKey); @@ -61,7 +62,7 @@ namespace Content.Client.Chemistry.Visualizers private void SetColor(AppearanceComponent component, Color color) { - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); sprite.Color = color; } diff --git a/Content.Client/Computer/ComputerVisualizer.cs b/Content.Client/Computer/ComputerVisualizer.cs index 51485abdc4..91fa0c253c 100644 --- a/Content.Client/Computer/ComputerVisualizer.cs +++ b/Content.Client/Computer/ComputerVisualizer.cs @@ -2,6 +2,7 @@ using Content.Shared.Computer; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Client.Computer @@ -23,7 +24,7 @@ namespace Content.Client.Computer { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); sprite.LayerSetState(Layers.Screen, ScreenState); if (!string.IsNullOrEmpty(KeyboardState)) @@ -37,7 +38,7 @@ namespace Content.Client.Computer { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!component.TryGetData(ComputerVisuals.Powered, out bool powered)) { diff --git a/Content.Client/Construction/ConstructionSystem.cs b/Content.Client/Construction/ConstructionSystem.cs index 5e5d4755ba..fcafdba817 100644 --- a/Content.Client/Construction/ConstructionSystem.cs +++ b/Content.Client/Construction/ConstructionSystem.cs @@ -171,12 +171,12 @@ namespace Content.Client.Construction } var ghost = EntityManager.SpawnEntity("constructionghost", loc); - var comp = ghost.GetComponent(); + var comp = IoCManager.Resolve().GetComponent(ghost.Uid); comp.Prototype = prototype; comp.GhostId = _nextId++; ghost.Transform.LocalRotation = dir.ToAngle(); _ghosts.Add(comp.GhostId, comp); - var sprite = ghost.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(ghost.Uid); sprite.Color = new Color(48, 255, 48, 128); sprite.AddBlankLayer(0); // There is no way to actually check if this already exists, so we blindly insert a new one sprite.LayerSetSprite(0, prototype.Icon); diff --git a/Content.Client/Construction/MachineFrameVisualizer.cs b/Content.Client/Construction/MachineFrameVisualizer.cs index 86a3d9ce17..a356c47774 100644 --- a/Content.Client/Construction/MachineFrameVisualizer.cs +++ b/Content.Client/Construction/MachineFrameVisualizer.cs @@ -2,6 +2,7 @@ using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.Client.Construction { @@ -14,7 +15,7 @@ namespace Content.Client.Construction if (component.TryGetData(MachineFrameVisuals.State, out var data)) { - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); sprite.LayerSetState(0, $"box_{data}"); } diff --git a/Content.Client/ContextMenu/UI/EntityMenuPresenterGrouping.cs b/Content.Client/ContextMenu/UI/EntityMenuPresenterGrouping.cs index 2a2b4688b4..9c8f2ae3b0 100644 --- a/Content.Client/ContextMenu/UI/EntityMenuPresenterGrouping.cs +++ b/Content.Client/ContextMenu/UI/EntityMenuPresenterGrouping.cs @@ -57,7 +57,7 @@ namespace Content.Client.ContextMenu.UI e => { var hash = 0; - foreach (var element in e.GetComponent().AllLayers.Where(obj => obj.Visible).Select(s => s.RsiState.Name)) + foreach (var element in IoCManager.Resolve().GetComponent(e.Uid).AllLayers.Where(obj => obj.Visible).Select(s => s.RsiState.Name)) { hash ^= EqualityComparer.Default.GetHashCode(element!); } diff --git a/Content.Client/Crayon/CrayonDecalVisualizer.cs b/Content.Client/Crayon/CrayonDecalVisualizer.cs index 964792a56e..047e23e224 100644 --- a/Content.Client/Crayon/CrayonDecalVisualizer.cs +++ b/Content.Client/Crayon/CrayonDecalVisualizer.cs @@ -2,6 +2,7 @@ using Content.Shared.Crayon; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; namespace Content.Client.Crayon @@ -13,7 +14,7 @@ namespace Content.Client.Crayon { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (component.TryGetData(CrayonVisuals.State, out string state)) { diff --git a/Content.Client/Disposal/Visualizers/DisposalUnitVisualizer.cs b/Content.Client/Disposal/Visualizers/DisposalUnitVisualizer.cs index 59e3d282d7..aafbf4f3e0 100644 --- a/Content.Client/Disposal/Visualizers/DisposalUnitVisualizer.cs +++ b/Content.Client/Disposal/Visualizers/DisposalUnitVisualizer.cs @@ -4,6 +4,7 @@ using JetBrains.Annotations; using Robust.Client.Animations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; using static Content.Shared.Disposal.Components.SharedDisposalUnitComponent; @@ -88,7 +89,7 @@ namespace Content.Client.Disposal.Visualizers case VisualState.Flushing: sprite.LayerSetState(DisposalUnitVisualLayers.Base, _stateAnchored); - var animPlayer = appearance.Owner.GetComponent(); + var animPlayer = IoCManager.Resolve().GetComponent(appearance.Owner.Uid); if (!animPlayer.HasRunningAnimation(AnimationKey)) { diff --git a/Content.Client/Doors/AirlockVisualizer.cs b/Content.Client/Doors/AirlockVisualizer.cs index 9fc2185fd0..e9053bc8b9 100644 --- a/Content.Client/Doors/AirlockVisualizer.cs +++ b/Content.Client/Doors/AirlockVisualizer.cs @@ -122,8 +122,8 @@ namespace Content.Client.Doors { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); - var animPlayer = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var animPlayer = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!component.TryGetData(DoorVisuals.VisualState, out DoorVisualState state)) { state = DoorVisualState.Closed; diff --git a/Content.Client/DragDrop/DragDropSystem.cs b/Content.Client/DragDrop/DragDropSystem.cs index fae9133131..317d36f422 100644 --- a/Content.Client/DragDrop/DragDropSystem.cs +++ b/Content.Client/DragDrop/DragDropSystem.cs @@ -188,7 +188,7 @@ namespace Content.Client.DragDrop // pop up drag shadow under mouse var mousePos = _eyeManager.ScreenToMap(_dragDropHelper.MouseScreenPosition); _dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos); - var dragSprite = _dragShadow.GetComponent(); + var dragSprite = IoCManager.Resolve().GetComponent(_dragShadow.Uid); dragSprite.CopyFrom(draggedSprite); dragSprite.RenderOrder = EntityManager.CurrentTick.Value; dragSprite.Color = dragSprite.Color.WithAlpha(0.7f); diff --git a/Content.Client/Extinguisher/FireExtinguisherVisualizer.cs b/Content.Client/Extinguisher/FireExtinguisherVisualizer.cs index ea414509c2..8497592b86 100644 --- a/Content.Client/Extinguisher/FireExtinguisherVisualizer.cs +++ b/Content.Client/Extinguisher/FireExtinguisherVisualizer.cs @@ -2,6 +2,7 @@ using Content.Shared.Extinguisher; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Client.Extinguisher @@ -26,7 +27,7 @@ namespace Content.Client.Extinguisher private void SetSafety(AppearanceComponent component, bool safety) { - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); sprite.LayerSetState(FireExtinguisherVisualLayers.Base, safety ? _safetyOnState : _safetyOffState); } diff --git a/Content.Client/Gravity/GravityGeneratorVisualizer.cs b/Content.Client/Gravity/GravityGeneratorVisualizer.cs index e9e5c0766e..a20b1042bd 100644 --- a/Content.Client/Gravity/GravityGeneratorVisualizer.cs +++ b/Content.Client/Gravity/GravityGeneratorVisualizer.cs @@ -4,6 +4,7 @@ using Content.Shared.Gravity; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; @@ -52,7 +53,7 @@ namespace Content.Client.Gravity { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (component.TryGetData(GravityGeneratorVisuals.State, out GravityGeneratorStatus state)) { diff --git a/Content.Client/Gravity/UI/GravityGeneratorWindow.xaml.cs b/Content.Client/Gravity/UI/GravityGeneratorWindow.xaml.cs index 730b3dc678..03987cf823 100644 --- a/Content.Client/Gravity/UI/GravityGeneratorWindow.xaml.cs +++ b/Content.Client/Gravity/UI/GravityGeneratorWindow.xaml.cs @@ -7,6 +7,7 @@ using Robust.Client.GameObjects; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; +using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; @@ -33,7 +34,7 @@ namespace Content.Client.Gravity.UI OnButton.OnPressed += _ => _owner.SetPowerSwitch(true); OffButton.OnPressed += _ => _owner.SetPowerSwitch(false); - EntityView.Sprite = component.Owner.GetComponent(); + EntityView.Sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); } public void UpdateState(SharedGravityGeneratorComponent.GeneratorState state) diff --git a/Content.Client/IconSmoothing/IconSmoothComponent.cs b/Content.Client/IconSmoothing/IconSmoothComponent.cs index 7cc5bbc6a2..af57ceeeb5 100644 --- a/Content.Client/IconSmoothing/IconSmoothComponent.cs +++ b/Content.Client/IconSmoothing/IconSmoothComponent.cs @@ -63,7 +63,7 @@ namespace Content.Client.IconSmoothing { base.Initialize(); - Sprite = Owner.GetComponent(); + Sprite = IoCManager.Resolve().GetComponent(Owner.Uid); } /// diff --git a/Content.Client/Items/Managers/ItemSlotManager.cs b/Content.Client/Items/Managers/ItemSlotManager.cs index 76b8b7c85a..a14eeaf264 100644 --- a/Content.Client/Items/Managers/ItemSlotManager.cs +++ b/Content.Client/Items/Managers/ItemSlotManager.cs @@ -139,8 +139,8 @@ namespace Content.Client.Items.Managers // Set green / red overlay at 50% transparency var hoverEntity = _entityManager.SpawnEntity("hoverentity", MapCoordinates.Nullspace); - var hoverSprite = hoverEntity.GetComponent(); - hoverSprite.CopyFrom(entity.GetComponent()); + var hoverSprite = IoCManager.Resolve().GetComponent(hoverEntity.Uid); + hoverSprite.CopyFrom(IoCManager.Resolve().GetComponent(entity.Uid)); hoverSprite.Color = fits ? new Color(0, 255, 0, 127) : new Color(255, 0, 0, 127); button.HoverSpriteView.Sprite = hoverSprite; diff --git a/Content.Client/Kitchen/UI/GrinderMenu.xaml.cs b/Content.Client/Kitchen/UI/GrinderMenu.xaml.cs index 5e45ba25a7..ab2a006d36 100644 --- a/Content.Client/Kitchen/UI/GrinderMenu.xaml.cs +++ b/Content.Client/Kitchen/UI/GrinderMenu.xaml.cs @@ -8,6 +8,7 @@ using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; using Robust.Shared.Prototypes; @@ -98,7 +99,7 @@ namespace Content.Client.Kitchen.UI { return; } - var texture = entity.GetComponent().Icon?.Default; + var texture = IoCManager.Resolve().GetComponent(entity.Uid).Icon?.Default; var solidItem = ChamberContentBox.BoxContents.AddItem(entity.Name, texture); var solidIndex = ChamberContentBox.BoxContents.IndexOf(solidItem); diff --git a/Content.Client/Kitchen/Visualizers/MicrowaveVisualizer.cs b/Content.Client/Kitchen/Visualizers/MicrowaveVisualizer.cs index c0a3a68e8c..fcebd03e2c 100644 --- a/Content.Client/Kitchen/Visualizers/MicrowaveVisualizer.cs +++ b/Content.Client/Kitchen/Visualizers/MicrowaveVisualizer.cs @@ -5,6 +5,7 @@ using Content.Shared.Power; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Log; namespace Content.Client.Kitchen.Visualizers @@ -15,7 +16,7 @@ namespace Content.Client.Kitchen.Visualizers public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); var microwaveComponent = component.Owner.GetComponentOrNull(); diff --git a/Content.Client/Kitchen/Visualizers/ReagentGrinderVisualizer.cs b/Content.Client/Kitchen/Visualizers/ReagentGrinderVisualizer.cs index 7abc3509ca..96d026fe43 100644 --- a/Content.Client/Kitchen/Visualizers/ReagentGrinderVisualizer.cs +++ b/Content.Client/Kitchen/Visualizers/ReagentGrinderVisualizer.cs @@ -1,5 +1,6 @@ using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using static Content.Shared.Kitchen.Components.SharedReagentGrinderComponent; namespace Content.Client.Kitchen.Visualizers @@ -9,7 +10,7 @@ namespace Content.Client.Kitchen.Visualizers public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); component.TryGetData(ReagentGrinderVisualState.BeakerAttached, out bool hasBeaker); sprite.LayerSetState(0, $"juicer{(hasBeaker ? "1" : "0")}"); } diff --git a/Content.Client/Lathe/Visualizers/AutolatheVisualizer.cs b/Content.Client/Lathe/Visualizers/AutolatheVisualizer.cs index b6a0f7e1de..3bda991494 100644 --- a/Content.Client/Lathe/Visualizers/AutolatheVisualizer.cs +++ b/Content.Client/Lathe/Visualizers/AutolatheVisualizer.cs @@ -60,8 +60,8 @@ namespace Content.Client.Lathe.Visualizers { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); - var animPlayer = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var animPlayer = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state)) { state = LatheVisualState.Idle; diff --git a/Content.Client/Lathe/Visualizers/ProtolatheVisualizer.cs b/Content.Client/Lathe/Visualizers/ProtolatheVisualizer.cs index dc509b8d9c..d35711871f 100644 --- a/Content.Client/Lathe/Visualizers/ProtolatheVisualizer.cs +++ b/Content.Client/Lathe/Visualizers/ProtolatheVisualizer.cs @@ -60,8 +60,8 @@ namespace Content.Client.Lathe.Visualizers { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); - var animPlayer = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var animPlayer = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state)) { state = LatheVisualState.Idle; diff --git a/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs b/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs index 731271dba0..15b5546047 100644 --- a/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs +++ b/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs @@ -106,7 +106,7 @@ namespace Content.Client.Lobby.UI { return new() { - Sprite = entity.GetComponent(), + Sprite = IoCManager.Resolve().GetComponent(entity.Uid), OverrideDirection = direction, Scale = (2, 2) }; @@ -140,7 +140,7 @@ namespace Content.Client.Lobby.UI { var protoMan = IoCManager.Resolve(); - var inventory = dummy.GetComponent(); + var inventory = IoCManager.Resolve().GetComponent(dummy.Uid); var highPriorityJob = profile.JobPriorities.FirstOrDefault(p => p.Value == JobPriority.High).Key; diff --git a/Content.Client/MedicalScanner/MedicalScannerVisualizer.cs b/Content.Client/MedicalScanner/MedicalScannerVisualizer.cs index 3b4786a54a..bcc0c5f47a 100644 --- a/Content.Client/MedicalScanner/MedicalScannerVisualizer.cs +++ b/Content.Client/MedicalScanner/MedicalScannerVisualizer.cs @@ -2,6 +2,7 @@ using System; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent; using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent.MedicalScannerStatus; @@ -14,7 +15,7 @@ namespace Content.Client.MedicalScanner { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!component.TryGetData(MedicalScannerVisuals.Status, out MedicalScannerStatus status)) return; sprite.LayerSetState(MedicalScannerVisualLayers.Machine, StatusToMachineStateId(status)); sprite.LayerSetState(MedicalScannerVisualLayers.Terminal, StatusToTerminalStateId(status)); diff --git a/Content.Client/MobState/DamageStateVisualizer.cs b/Content.Client/MobState/DamageStateVisualizer.cs index 8586a9dbcc..5219da3d50 100644 --- a/Content.Client/MobState/DamageStateVisualizer.cs +++ b/Content.Client/MobState/DamageStateVisualizer.cs @@ -3,6 +3,7 @@ using Content.Shared.MobState; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; using DrawDepth = Content.Shared.DrawDepth.DrawDepth; @@ -51,7 +52,7 @@ namespace Content.Client.MobState public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!component.TryGetData(DamageStateVisuals.State, out DamageState data)) { return; diff --git a/Content.Client/Nutrition/Visualizers/CreamPiedVisualizer.cs b/Content.Client/Nutrition/Visualizers/CreamPiedVisualizer.cs index 3c509b110f..59d3da159b 100644 --- a/Content.Client/Nutrition/Visualizers/CreamPiedVisualizer.cs +++ b/Content.Client/Nutrition/Visualizers/CreamPiedVisualizer.cs @@ -2,6 +2,7 @@ using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Client.Nutrition.Visualizers @@ -16,7 +17,7 @@ namespace Content.Client.Nutrition.Visualizers { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); sprite.LayerMapReserveBlank(CreamPiedVisualLayers.Pie); sprite.LayerSetRSI(CreamPiedVisualLayers.Pie, "Effects/creampie.rsi"); @@ -35,7 +36,7 @@ namespace Content.Client.Nutrition.Visualizers private void SetPied(AppearanceComponent component, bool pied) { - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); sprite.LayerSetVisible(CreamPiedVisualLayers.Pie, pied); sprite.LayerSetState(CreamPiedVisualLayers.Pie, _state); diff --git a/Content.Client/PDA/PDAVisualizer.cs b/Content.Client/PDA/PDAVisualizer.cs index 927ad7f041..f1bd1cd6ce 100644 --- a/Content.Client/PDA/PDAVisualizer.cs +++ b/Content.Client/PDA/PDAVisualizer.cs @@ -3,6 +3,7 @@ using Content.Shared.PDA; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Client.PDA @@ -27,7 +28,7 @@ namespace Content.Client.PDA public override void InitializeEntity(IEntity entity) { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); if (_state != null) { @@ -45,7 +46,7 @@ namespace Content.Client.PDA { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); sprite.LayerSetVisible(PDAVisualLayers.Flashlight, false); if (component.TryGetData(UnpoweredFlashlightVisuals.LightOn, out bool isFlashlightOn)) { diff --git a/Content.Client/Pointing/RoguePointingArrowVisualizer.cs b/Content.Client/Pointing/RoguePointingArrowVisualizer.cs index 2f675d49fb..9eb17c8f75 100644 --- a/Content.Client/Pointing/RoguePointingArrowVisualizer.cs +++ b/Content.Client/Pointing/RoguePointingArrowVisualizer.cs @@ -5,6 +5,7 @@ using Robust.Client.Animations; using Robust.Client.GameObjects; using Robust.Shared.Animations; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; namespace Content.Client.Pointing @@ -24,7 +25,7 @@ namespace Content.Client.Pointing private void SetRotation(AppearanceComponent component, Angle rotation) { - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent? animation)) { diff --git a/Content.Client/Power/APC/ApcVisualizer.cs b/Content.Client/Power/APC/ApcVisualizer.cs index 85ed0e5d25..2a101eb79c 100644 --- a/Content.Client/Power/APC/ApcVisualizer.cs +++ b/Content.Client/Power/APC/ApcVisualizer.cs @@ -2,6 +2,7 @@ using Content.Shared.APC; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.Client.Power.APC { @@ -12,7 +13,7 @@ namespace Content.Client.Power.APC { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); sprite.LayerMapSet(Layers.ChargeState, sprite.AddLayerState("apco3-0")); sprite.LayerSetShader(Layers.ChargeState, "unshaded"); @@ -34,7 +35,7 @@ namespace Content.Client.Power.APC { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (component.TryGetData(ApcVisuals.ChargeState, out var state)) { switch (state) diff --git a/Content.Client/Power/SMES/SmesVisualizer.cs b/Content.Client/Power/SMES/SmesVisualizer.cs index 11fcbd41d5..aaa08031a2 100644 --- a/Content.Client/Power/SMES/SmesVisualizer.cs +++ b/Content.Client/Power/SMES/SmesVisualizer.cs @@ -3,6 +3,7 @@ using Content.Shared.SMES; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.Client.Power.SMES { @@ -13,7 +14,7 @@ namespace Content.Client.Power.SMES { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); sprite.LayerMapSet(Layers.Input, sprite.AddLayerState("smes-oc0")); sprite.LayerSetShader(Layers.Input, "unshaded"); @@ -28,7 +29,7 @@ namespace Content.Client.Power.SMES { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!component.TryGetData(SmesVisuals.LastChargeLevel, out var level) || level == 0) { sprite.LayerSetVisible(Layers.Charge, false); diff --git a/Content.Client/Power/Visualizers/PowerDeviceVisualizer.cs b/Content.Client/Power/Visualizers/PowerDeviceVisualizer.cs index e8aed1b15d..9f996da270 100644 --- a/Content.Client/Power/Visualizers/PowerDeviceVisualizer.cs +++ b/Content.Client/Power/Visualizers/PowerDeviceVisualizer.cs @@ -2,6 +2,7 @@ using Content.Shared.Power; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.Client.Power { @@ -12,7 +13,7 @@ namespace Content.Client.Power { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); var powered = component.TryGetData(PowerDeviceVisuals.Powered, out bool poweredVar) && poweredVar; sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered); } diff --git a/Content.Client/PowerCell/PowerCellVisualizer.cs b/Content.Client/PowerCell/PowerCellVisualizer.cs index 29052155f8..f5c9ae4110 100644 --- a/Content.Client/PowerCell/PowerCellVisualizer.cs +++ b/Content.Client/PowerCell/PowerCellVisualizer.cs @@ -2,6 +2,7 @@ using Content.Shared.PowerCell; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Client.PowerCell @@ -16,7 +17,7 @@ namespace Content.Client.PowerCell { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); if (_prefix != null) { @@ -29,7 +30,7 @@ namespace Content.Client.PowerCell { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (component.TryGetData(PowerCellVisuals.ChargeLevel, out byte level)) { var adjustedLevel = level * 25; diff --git a/Content.Client/PowerCell/PowerChargerVisualizer.cs b/Content.Client/PowerCell/PowerChargerVisualizer.cs index a6bd92a4e1..73214f2321 100644 --- a/Content.Client/PowerCell/PowerChargerVisualizer.cs +++ b/Content.Client/PowerCell/PowerChargerVisualizer.cs @@ -2,6 +2,7 @@ using Content.Shared.Power; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.Client.PowerCell { @@ -12,7 +13,7 @@ namespace Content.Client.PowerCell { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); // Base item sprite.LayerMapSet(Layers.Base, sprite.AddLayerState("empty")); @@ -26,7 +27,7 @@ namespace Content.Client.PowerCell { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); // Update base item if (component.TryGetData(CellVisual.Occupied, out bool occupied)) diff --git a/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs b/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs index 318df59db5..7b6a53732c 100644 --- a/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs +++ b/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs @@ -165,7 +165,7 @@ namespace Content.Client.Preferences.UI var view = new SpriteView { - Sprite = _previewDummy.GetComponent(), + Sprite = IoCManager.Resolve().GetComponent(_previewDummy.Uid), Scale = (2, 2), OverrideDirection = Direction.South }; diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs index 9b4467ec3b..76302080fb 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs @@ -438,7 +438,7 @@ namespace Content.Client.Preferences.UI #region Preview _previewDummy = entityManager.SpawnEntity("MobHumanDummy", MapCoordinates.Nullspace); - var sprite = _previewDummy.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(_previewDummy.Uid); // Front _previewSprite = new SpriteView diff --git a/Content.Client/Rotation/RotationVisualizer.cs b/Content.Client/Rotation/RotationVisualizer.cs index 05e5a852de..1105f16763 100644 --- a/Content.Client/Rotation/RotationVisualizer.cs +++ b/Content.Client/Rotation/RotationVisualizer.cs @@ -5,6 +5,7 @@ using Robust.Client.Animations; using Robust.Client.GameObjects; using Robust.Shared.Animations; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; namespace Content.Client.Rotation @@ -32,7 +33,7 @@ namespace Content.Client.Rotation private void SetRotation(AppearanceComponent component, Angle rotation) { - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent? animation)) { diff --git a/Content.Client/Trigger/TimerTriggerVisualizer.cs b/Content.Client/Trigger/TimerTriggerVisualizer.cs index 1d27d5b50f..437d8422e6 100644 --- a/Content.Client/Trigger/TimerTriggerVisualizer.cs +++ b/Content.Client/Trigger/TimerTriggerVisualizer.cs @@ -46,8 +46,8 @@ namespace Content.Client.Trigger public override void OnChangeData(AppearanceComponent component) { - var sprite = component.Owner.GetComponent(); - var animPlayer = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var animPlayer = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!component.TryGetData(TriggerVisuals.VisualState, out TriggerVisualState state)) { state = TriggerVisualState.Unprimed; diff --git a/Content.Client/VendingMachines/UI/VendingMachineVisualizer.cs b/Content.Client/VendingMachines/UI/VendingMachineVisualizer.cs index 9cef8db438..ba7e84622a 100644 --- a/Content.Client/VendingMachines/UI/VendingMachineVisualizer.cs +++ b/Content.Client/VendingMachines/UI/VendingMachineVisualizer.cs @@ -141,8 +141,8 @@ namespace Content.Client.VendingMachines.UI { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); - var animPlayer = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var animPlayer = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!component.TryGetData(VendingMachineVisuals.VisualState, out VendingMachineVisualState state)) { state = VendingMachineVisualState.Normal; diff --git a/Content.Client/Wall/Components/LowWallComponent.cs b/Content.Client/Wall/Components/LowWallComponent.cs index 5f41e63fd8..c10e3e8f7c 100644 --- a/Content.Client/Wall/Components/LowWallComponent.cs +++ b/Content.Client/Wall/Components/LowWallComponent.cs @@ -46,7 +46,7 @@ namespace Content.Client.Wall.Components _overlayEntity.Transform.AttachParent(Owner); _overlayEntity.Transform.LocalPosition = Vector2.Zero; - _overlaySprite = _overlayEntity.GetComponent(); + _overlaySprite = IoCManager.Resolve().GetComponent(_overlayEntity.Uid); var overState0 = $"{StateBase}over_0"; _overlaySprite.LayerMapSet(OverCornerLayers.SE, _overlaySprite.AddLayerState(overState0)); diff --git a/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs b/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs index 4502c1c424..21a4abfe31 100644 --- a/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs +++ b/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs @@ -22,7 +22,7 @@ namespace Content.Client.Weapons.Melee.Components { base.Initialize(); - _sprite = Owner.GetComponent(); + _sprite = IoCManager.Resolve().GetComponent(Owner.Uid); } public void SetData(MeleeWeaponAnimationPrototype prototype, Angle baseAngle, IEntity attacker, bool followAttacker = true) diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs index 27d329d839..4f725949f2 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs @@ -59,7 +59,7 @@ namespace Content.Client.Weapons.Melee var entity = EntityManager.SpawnEntity(weaponArc.Prototype, attacker.Transform.Coordinates); entity.Transform.LocalRotation = msg.Angle; - var weaponArcAnimation = entity.GetComponent(); + var weaponArcAnimation = IoCManager.Resolve().GetComponent(entity.Uid); weaponArcAnimation.SetData(weaponArc, msg.Angle, attacker, msg.ArcFollowAttacker); // Due to ISpriteComponent limitations, weapons that don't use an RSI won't have this effect. diff --git a/Content.Client/Weapons/Ranged/Barrels/Visualizers/BarrelBoltVisualizer.cs b/Content.Client/Weapons/Ranged/Barrels/Visualizers/BarrelBoltVisualizer.cs index f29a8e4a9d..6d435e95db 100644 --- a/Content.Client/Weapons/Ranged/Barrels/Visualizers/BarrelBoltVisualizer.cs +++ b/Content.Client/Weapons/Ranged/Barrels/Visualizers/BarrelBoltVisualizer.cs @@ -2,6 +2,7 @@ using Content.Shared.Weapons.Ranged.Barrels.Components; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.Client.Weapons.Ranged.Barrels.Visualizers { @@ -11,14 +12,14 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers public override void InitializeEntity(IEntity entity) { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); sprite.LayerSetState(RangedBarrelVisualLayers.Bolt, "bolt-open"); } public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!component.TryGetData(BarrelBoltVisuals.BoltOpen, out bool boltOpen)) { diff --git a/Content.Client/Weapons/Ranged/Barrels/Visualizers/MagVisualizer.cs b/Content.Client/Weapons/Ranged/Barrels/Visualizers/MagVisualizer.cs index 89d1180306..424da8b7df 100644 --- a/Content.Client/Weapons/Ranged/Barrels/Visualizers/MagVisualizer.cs +++ b/Content.Client/Weapons/Ranged/Barrels/Visualizers/MagVisualizer.cs @@ -3,6 +3,7 @@ using Content.Shared.Weapons.Ranged.Barrels.Components; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Client.Weapons.Ranged.Barrels.Visualizers @@ -21,7 +22,7 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers public override void InitializeEntity(IEntity entity) { base.InitializeEntity(entity); - var sprite = entity.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(entity.Uid); if (sprite.LayerMapTryGet(RangedBarrelVisualLayers.Mag, out _)) { @@ -44,7 +45,7 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers // 1.If no mag then hide it OR // 2. If step 0 isn't visible then hide it (mag or unshaded) // 3. Otherwise just do mag / unshaded as is - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); component.TryGetData(MagazineBarrelVisuals.MagLoaded, out _magLoaded); diff --git a/Content.Client/Weapons/Ranged/Barrels/Visualizers/SpentAmmoVisualizer.cs b/Content.Client/Weapons/Ranged/Barrels/Visualizers/SpentAmmoVisualizer.cs index e4beb23ea2..f6f99c2a79 100644 --- a/Content.Client/Weapons/Ranged/Barrels/Visualizers/SpentAmmoVisualizer.cs +++ b/Content.Client/Weapons/Ranged/Barrels/Visualizers/SpentAmmoVisualizer.cs @@ -2,6 +2,7 @@ using Content.Shared.Weapons.Ranged.Barrels.Components; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.Client.Weapons.Ranged.Barrels.Visualizers { @@ -11,7 +12,7 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (!component.TryGetData(AmmoVisuals.Spent, out bool spent)) { diff --git a/Content.Client/Wires/Visualizers/WiresVisualizer.cs b/Content.Client/Wires/Visualizers/WiresVisualizer.cs index 713329abfb..e0ade4bf4a 100644 --- a/Content.Client/Wires/Visualizers/WiresVisualizer.cs +++ b/Content.Client/Wires/Visualizers/WiresVisualizer.cs @@ -1,5 +1,6 @@ using Robust.Client.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using static Content.Shared.Wires.SharedWiresComponent; namespace Content.Client.Wires.Visualizers @@ -9,7 +10,7 @@ namespace Content.Client.Wires.Visualizers public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = component.Owner.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); if (component.TryGetData(WiresVisuals.MaintenancePanelState, out var state)) { sprite.LayerSetVisible(WiresVisualLayers.MaintenancePanel, state); diff --git a/Content.IntegrationTests/Tests/ClickableTest.cs b/Content.IntegrationTests/Tests/ClickableTest.cs index 4d24722b49..6379bc0e97 100644 --- a/Content.IntegrationTests/Tests/ClickableTest.cs +++ b/Content.IntegrationTests/Tests/ClickableTest.cs @@ -7,6 +7,7 @@ using NUnit.Framework; using Robust.Server.GameObjects; using Robust.Shared; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; @@ -80,7 +81,7 @@ namespace Content.IntegrationTests.Tests var ent = serverEntManager.SpawnEntity(prototype, new EntityCoordinates(gridEnt, 0f, 0f)); ent.Transform.LocalRotation = angle; - ent.GetComponent().Scale = (scale, scale); + IoCManager.Resolve().GetComponent(ent.Uid).Scale = (scale, scale); entity = ent.Uid; }); @@ -92,7 +93,7 @@ namespace Content.IntegrationTests.Tests await _client.WaitPost(() => { var ent = clientEntManager.GetEntity(entity); - var clickable = ent.GetComponent(); + var clickable = IoCManager.Resolve().GetComponent(ent.Uid); hit = clickable.CheckClick((clickPosX, clickPosY) + worldPos!.Value, out _, out _); }); diff --git a/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs b/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs index 9a55c5eaf4..940b312ff3 100644 --- a/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs +++ b/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs @@ -83,7 +83,7 @@ namespace Content.IntegrationTests.Tests var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos); dummyUid = dummy.Uid; - container.GetComponent().Insert(dummy); + IoCManager.Resolve().GetComponent(container.Uid).Insert(dummy); }); await RunTicksSync(c, s, 5); @@ -91,8 +91,8 @@ namespace Content.IntegrationTests.Tests c.Assert(() => { var dummy = IoCManager.Resolve().GetEntity(dummyUid); - var sprite = dummy.GetComponent(); - var light = dummy.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(dummy.Uid); + var light = IoCManager.Resolve().GetComponent(dummy.Uid); Assert.True(sprite.ContainerOccluded); Assert.True(light.ContainerOccluded); }); @@ -114,7 +114,7 @@ namespace Content.IntegrationTests.Tests var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos); dummyUid = dummy.Uid; - container.GetComponent().Insert(dummy); + IoCManager.Resolve().GetComponent(container.Uid).Insert(dummy); }); await RunTicksSync(c, s, 5); @@ -122,8 +122,8 @@ namespace Content.IntegrationTests.Tests c.Assert(() => { var dummy = IoCManager.Resolve().GetEntity(dummyUid); - var sprite = dummy.GetComponent(); - var light = dummy.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(dummy.Uid); + var light = IoCManager.Resolve().GetComponent(dummy.Uid); Assert.False(sprite.ContainerOccluded); Assert.False(light.ContainerOccluded); }); @@ -146,8 +146,8 @@ namespace Content.IntegrationTests.Tests var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos); dummyUid = dummy.Uid; - containerA.GetComponent().Insert(containerB); - containerB.GetComponent().Insert(dummy); + IoCManager.Resolve().GetComponent(containerA.Uid).Insert(containerB); + IoCManager.Resolve().GetComponent(containerB.Uid).Insert(dummy); }); await RunTicksSync(c, s, 5); @@ -155,8 +155,8 @@ namespace Content.IntegrationTests.Tests c.Assert(() => { var dummy = IoCManager.Resolve().GetEntity(dummyUid); - var sprite = dummy.GetComponent(); - var light = dummy.GetComponent(); + var sprite = IoCManager.Resolve().GetComponent(dummy.Uid); + var light = IoCManager.Resolve().GetComponent(dummy.Uid); Assert.True(sprite.ContainerOccluded); Assert.True(light.ContainerOccluded); }); diff --git a/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs b/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs index b3a20f9cf2..17c334ec96 100644 --- a/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs +++ b/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs @@ -5,6 +5,7 @@ using Content.Shared.Damage.Prototypes; using Content.Shared.FixedPoint; using NUnit.Framework; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Prototypes; @@ -118,7 +119,7 @@ namespace Content.IntegrationTests.Tests.Damageable sMapManager.CreateMap(mapId); sDamageableEntity = sEntityManager.SpawnEntity("TestDamageableEntityId", coordinates); - sDamageableComponent = sDamageableEntity.GetComponent(); + sDamageableComponent = IoCManager.Resolve().GetComponent(sDamageableEntity.Uid); sDamageableSystem = sEntitySystemManager.GetEntitySystem(); group1 = sPrototypeManager.Index("TestGroup1"); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs index 3b5addc1a1..ea0f6ed8d3 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs @@ -5,6 +5,7 @@ using Content.Shared.Damage.Prototypes; using Content.Shared.FixedPoint; using NUnit.Framework; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Prototypes; using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes; @@ -42,7 +43,7 @@ namespace Content.IntegrationTests.Tests.Destructible var coordinates = new EntityCoordinates(gridId, 0, 0); sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageGroupEntityId, coordinates); - sDamageableComponent = sDestructibleEntity.GetComponent(); + sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity.Uid); sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem(); sTestThresholdListenerSystem.ThresholdsReached.Clear(); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs index 313e6ad549..e235bfa5e2 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs @@ -41,7 +41,7 @@ namespace Content.IntegrationTests.Tests.Destructible var coordinates = new EntityCoordinates(gridId, 0, 0); sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageTypeEntityId, coordinates); - sDamageableComponent = sDestructibleEntity.GetComponent(); + sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity.Uid); sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem(); sDamageableSystem = sEntitySystemManager.GetEntitySystem(); }); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs index 663f6c8cf0..83428a257b 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs @@ -40,7 +40,7 @@ namespace Content.IntegrationTests.Tests.Destructible var coordinates = new EntityCoordinates(gridId, 0, 0); sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDestructionEntityId, coordinates); - sDamageableComponent = sDestructibleEntity.GetComponent(); + sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity.Uid); sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem(); }); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs index 90fb064fd5..ae70d2abe5 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs @@ -9,6 +9,7 @@ using Content.Shared.Damage.Prototypes; using Content.Shared.FixedPoint; using NUnit.Framework; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Prototypes; using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes; @@ -47,8 +48,8 @@ namespace Content.IntegrationTests.Tests.Destructible var coordinates = new EntityCoordinates(gridId, 0, 0); sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleEntityId, coordinates); - sDamageableComponent = sDestructibleEntity.GetComponent(); - sDestructibleComponent = sDestructibleEntity.GetComponent(); + sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity.Uid); + sDestructibleComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity.Uid); sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem(); sTestThresholdListenerSystem.ThresholdsReached.Clear(); diff --git a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs index c9016c5cbf..89eca86557 100644 --- a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs +++ b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs @@ -151,7 +151,7 @@ namespace Content.IntegrationTests.Tests.Doors for (var i = 0; i < 240; i += 10) { // Keep the airlock awake so they collide - server.Post(() => airlock.GetComponent().WakeBody()); + server.Post(() => IoCManager.Resolve().GetComponent(airlock.Uid).WakeBody()); await server.WaitRunTicks(10); await server.WaitIdleAsync(); diff --git a/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs b/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs index 6c25190407..029dcde6c7 100644 --- a/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs +++ b/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs @@ -132,7 +132,7 @@ namespace Content.IntegrationTests.Tests.Fluids // Check that the puddle was created Assert.NotNull(puddle); - evaporation = puddle.Owner.GetComponent(); + evaporation = IoCManager.Resolve().GetComponent(puddle.Owner.Uid); IoCManager.Resolve().GetComponent(puddle.Owner.Uid).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1445 diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs index 85da3e7612..a91919bfb2 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs @@ -15,6 +15,7 @@ using Robust.Client.UserInterface; using Robust.Server.Player; using Robust.Shared; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Timing; using Robust.Shared.Utility; @@ -71,7 +72,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs await server.WaitAssertion(() => { var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity; - var actionsComponent = playerEnt!.GetComponent(); + var actionsComponent = IoCManager.Resolve().GetComponent(playerEnt!.Uid); // player should begin with their innate actions granted innateActions.AddRange(actionsComponent.InnateActions); @@ -98,7 +99,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { var local = clientPlayerMgr.LocalPlayer; var controlled = local!.ControlledEntity; - var actionsComponent = controlled!.GetComponent(); + var actionsComponent = IoCManager.Resolve().GetComponent(controlled!.Uid); // we should have our innate actions and debug1. foreach (var innateAction in innateActions) @@ -153,7 +154,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs await server.WaitAssertion(() => { var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity; - var actionsComponent = playerEnt!.GetComponent(); + var actionsComponent = IoCManager.Resolve().GetComponent(playerEnt!.Uid); actionsComponent.Revoke(ActionType.DebugInstant); }); @@ -164,7 +165,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { var local = clientPlayerMgr.LocalPlayer; var controlled = local!.ControlledEntity; - var actionsComponent = controlled!.GetComponent(); + var actionsComponent = IoCManager.Resolve().GetComponent(controlled!.Uid); // we should have our innate actions, but debug1 should be revoked foreach (var innateAction in innateActions) @@ -245,7 +246,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs await server.WaitAssertion(() => { serverPlayerEnt = serverPlayerManager.Sessions.Single().AttachedEntity; - serverActionsComponent = serverPlayerEnt!.GetComponent(); + serverActionsComponent = IoCManager.Resolve().GetComponent(serverPlayerEnt!.Uid); // spawn and give them an item that has actions serverFlashlight = serverEntManager.SpawnEntity("TestFlashlight", @@ -259,7 +260,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs // grant an extra item action, before pickup, initially disabled itemActions.GrantOrUpdate(ItemActionType.DebugToggle, false); - serverPlayerEnt.GetComponent().PutInHand(serverFlashlight.GetComponent(), false); + IoCManager.Resolve().GetComponent(serverPlayerEnt.Uid).PutInHand(IoCManager.Resolve().GetComponent(serverFlashlight.Uid), false); // grant an extra item action, after pickup, with a cooldown itemActions.GrantOrUpdate(ItemActionType.DebugInstant, cooldown: cooldown); @@ -285,7 +286,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { var local = clientPlayerMgr.LocalPlayer; var controlled = local!.ControlledEntity; - clientActionsComponent = controlled!.GetComponent(); + clientActionsComponent = IoCManager.Resolve().GetComponent(controlled!.Uid); var lightEntry = clientActionsComponent.ItemActionStates() .Where(entry => entry.Value.ContainsKey(ItemActionType.ToggleLight)) @@ -333,7 +334,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs await server.WaitAssertion(() => { // drop the item, and the item actions should go away - serverPlayerEnt.GetComponent() + IoCManager.Resolve().GetComponent(serverPlayerEnt.Uid) .TryDropEntity(serverFlashlight, serverPlayerEnt.Transform.Coordinates, false); Assert.That(serverActionsComponent.ItemActionStates().ContainsKey(serverFlashlight.Uid), Is.False); }); @@ -351,7 +352,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { // pick the item up again, the states should be back to what they were when dropped, // as the states "stick" with the item - serverPlayerEnt.GetComponent().PutInHand(serverFlashlight.GetComponent(), false); + IoCManager.Resolve().GetComponent(serverPlayerEnt.Uid).PutInHand(IoCManager.Resolve().GetComponent(serverFlashlight.Uid), false); Assert.That(serverActionsComponent.ItemActionStates().TryGetValue(serverFlashlight.Uid, out var lightStates)); Assert.That(lightStates.TryGetValue(ItemActionType.ToggleLight, out var lightState)); Assert.That(lightState.Equals(new ActionState(true, toggledOn: true))); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/AlertsComponentTests.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/AlertsComponentTests.cs index d5e42d1aff..c4ac544863 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/AlertsComponentTests.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/AlertsComponentTests.cs @@ -7,6 +7,8 @@ using Content.Shared.Alert; using NUnit.Framework; using Robust.Client.UserInterface; using Robust.Server.Player; +using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { @@ -29,7 +31,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity; Assert.NotNull(playerEnt); - var alertsComponent = playerEnt.GetComponent(); + var alertsComponent = IoCManager.Resolve().GetComponent(playerEnt.Uid); Assert.NotNull(alertsComponent); // show 2 alerts @@ -49,7 +51,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs Assert.NotNull(local); var controlled = local.ControlledEntity; Assert.NotNull(controlled); - var alertsComponent = controlled.GetComponent(); + var alertsComponent = IoCManager.Resolve().GetComponent(controlled.Uid); Assert.NotNull(alertsComponent); // find the alertsui @@ -69,7 +71,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity; Assert.NotNull(playerEnt); - var alertsComponent = playerEnt.GetComponent(); + var alertsComponent = IoCManager.Resolve().GetComponent(playerEnt.Uid); Assert.NotNull(alertsComponent); alertsComponent.ClearAlert(AlertType.Debug1); @@ -84,7 +86,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs Assert.NotNull(local); var controlled = local.ControlledEntity; Assert.NotNull(controlled); - var alertsComponent = controlled.GetComponent(); + var alertsComponent = IoCManager.Resolve().GetComponent(controlled.Uid); Assert.NotNull(alertsComponent); // find the alertsui diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs index f1fad255fa..0ef1d70637 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs @@ -60,7 +60,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement // Now let's make the player enter a climbing transitioning state. climbing.IsClimbing = true; climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition); - var body = human.GetComponent(); + var body = IoCManager.Resolve().GetComponent(human.Uid); // TODO: Check it's climbing // Force the player out of climb state. It should immediately remove the ClimbController. diff --git a/Content.IntegrationTests/Tests/GravityGridTest.cs b/Content.IntegrationTests/Tests/GravityGridTest.cs index d1e2a9c9c2..a7767b27da 100644 --- a/Content.IntegrationTests/Tests/GravityGridTest.cs +++ b/Content.IntegrationTests/Tests/GravityGridTest.cs @@ -53,15 +53,15 @@ namespace Content.IntegrationTests.Tests Assert.That(generator.HasComponent()); Assert.That(generator.HasComponent()); - var powerComponent = generator.GetComponent(); + var powerComponent = IoCManager.Resolve().GetComponent(generator.Uid); powerComponent.NeedsPower = false; }); server.RunTicks(1); server.Assert(() => { - var generatorComponent = generator.GetComponent(); - var powerComponent = generator.GetComponent(); + var generatorComponent = IoCManager.Resolve().GetComponent(generator.Uid); + var powerComponent = IoCManager.Resolve().GetComponent(generator.Uid); Assert.That(generatorComponent.GravityActive, Is.True); @@ -69,8 +69,8 @@ namespace Content.IntegrationTests.Tests var grid1Entity = entityMan.GetEntity(grid1.GridEntityId); var grid2Entity = entityMan.GetEntity(grid2.GridEntityId); - Assert.That(!grid1Entity.GetComponent().Enabled); - Assert.That(grid2Entity.GetComponent().Enabled); + Assert.That(!IoCManager.Resolve().GetComponent(grid1Entity.Uid).Enabled); + Assert.That(IoCManager.Resolve().GetComponent(grid2Entity.Uid).Enabled); // Re-enable needs power so it turns off again. // Charge rate is ridiculously high so it finishes in one tick. @@ -79,14 +79,14 @@ namespace Content.IntegrationTests.Tests server.RunTicks(1); server.Assert(() => { - var generatorComponent = generator.GetComponent(); + var generatorComponent = IoCManager.Resolve().GetComponent(generator.Uid); Assert.That(generatorComponent.GravityActive, Is.False); var entityMan = IoCManager.Resolve(); var grid2Entity = entityMan.GetEntity(grid2.GridEntityId); - Assert.That(grid2Entity.GetComponent().Enabled, Is.False); + Assert.That(IoCManager.Resolve().GetComponent(grid2Entity.Uid).Enabled, Is.False); }); await server.WaitIdleAsync(); diff --git a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs index ce62679255..1e3b0b9cb1 100644 --- a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs +++ b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs @@ -81,7 +81,7 @@ namespace Content.IntegrationTests.Tests pocketItem = entityMan.SpawnEntity("FlashlightDummy", MapCoordinates.Nullspace); var tooBigItem = entityMan.SpawnEntity("ToolboxDummy", MapCoordinates.Nullspace); - inventory = human.GetComponent(); + inventory = IoCManager.Resolve().GetComponent(human.Uid); Assert.That(inventory.CanEquip(Slots.INNERCLOTHING, uniform)); diff --git a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs index ee1e5cc6f2..7fd08bc699 100644 --- a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs +++ b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs @@ -96,7 +96,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click Assert.That(interactHand); Assert.That(user.TryGetComponent(out var hands)); - Assert.That(hands.PutInHand(item.GetComponent())); + Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); Assert.That(interactUsing); @@ -168,7 +168,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click Assert.That(interactHand, Is.False); Assert.That(user.TryGetComponent(out var hands)); - Assert.That(hands.PutInHand(item.GetComponent())); + Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); Assert.That(interactUsing, Is.False); @@ -237,7 +237,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click Assert.That(interactHand); Assert.That(user.TryGetComponent(out var hands)); - Assert.That(hands.PutInHand(item.GetComponent())); + Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); Assert.That(interactUsing); @@ -307,7 +307,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click Assert.That(interactHand, Is.False); Assert.That(user.TryGetComponent(out var hands)); - Assert.That(hands.PutInHand(item.GetComponent())); + Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); Assert.That(interactUsing, Is.False); @@ -392,7 +392,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click Assert.That(interactHand); Assert.That(user.TryGetComponent(out var hands)); - Assert.That(hands.PutInHand(item.GetComponent())); + Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); Assert.That(interactUsing, Is.False); diff --git a/Content.IntegrationTests/Tests/InventoryHelpersTest.cs b/Content.IntegrationTests/Tests/InventoryHelpersTest.cs index 275d24c002..ffb2f13610 100644 --- a/Content.IntegrationTests/Tests/InventoryHelpersTest.cs +++ b/Content.IntegrationTests/Tests/InventoryHelpersTest.cs @@ -62,7 +62,7 @@ namespace Content.IntegrationTests.Tests var entityMan = IoCManager.Resolve(); human = entityMan.SpawnEntity("InventoryStunnableDummy", MapCoordinates.Nullspace); - inventory = human.GetComponent(); + inventory = IoCManager.Resolve().GetComponent(human.Uid); // Can't do the test if this human doesn't have the slots for it. Assert.That(inventory.HasSlot(Slots.INNERCLOTHING)); diff --git a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs index 4aa754a755..6b825a2e5d 100644 --- a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs +++ b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs @@ -112,8 +112,8 @@ namespace Content.IntegrationTests.Tests.Networking await client.WaitPost(() => { - clientComponent = cEntityManager.GetEntity(serverEnt.Uid) - .GetComponent(); + IEntity tempQualifier = cEntityManager.GetEntity(serverEnt.Uid); + clientComponent = IoCManager.Resolve().GetComponent(tempQualifier.Uid); }); Assert.That(clientComponent.Foo, Is.False); @@ -457,7 +457,7 @@ namespace Content.IntegrationTests.Tests.Networking private void HandleMessage(SetFooMessage message, EntitySessionEventArgs args) { var entity = EntityManager.GetEntity(message.Uid); - var component = entity.GetComponent(); + var component = IoCManager.Resolve().GetComponent(entity.Uid); var old = component.Foo; if (Allow) { diff --git a/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs b/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs index 18ba577046..c770c4b621 100644 --- a/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs +++ b/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs @@ -9,6 +9,7 @@ using Content.Shared.Containers.ItemSlots; using NUnit.Framework; using Robust.Server.Player; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.IntegrationTests.Tests.PDA { @@ -70,13 +71,13 @@ namespace Content.IntegrationTests.Tests.PDA // Put PDA in hand var dummyPda = sEntityManager.SpawnEntity(PdaDummy, player.Transform.MapPosition); - var pdaItemComponent = dummyPda.GetComponent(); - player.GetComponent().PutInHand(pdaItemComponent); + var pdaItemComponent = IoCManager.Resolve().GetComponent(dummyPda.Uid); + IoCManager.Resolve().GetComponent(player.Uid).PutInHand(pdaItemComponent); - var pdaComponent = dummyPda.GetComponent(); + var pdaComponent = IoCManager.Resolve().GetComponent(dummyPda.Uid); var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition); - var itemSlots = dummyPda.GetComponent(); + var itemSlots = IoCManager.Resolve().GetComponent(dummyPda.Uid); sEntityManager.EntitySysManager.GetEntitySystem() .TryInsert(dummyPda.Uid, pdaComponent.IdSlot, pdaIdCard); var pdaContainedId = pdaComponent.ContainedID; @@ -90,10 +91,10 @@ namespace Content.IntegrationTests.Tests.PDA // Put ID card in hand var idDummy = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition); - var idItemComponent = idDummy.GetComponent(); - player.GetComponent().PutInHand(idItemComponent); + var idItemComponent = IoCManager.Resolve().GetComponent(idDummy.Uid); + IoCManager.Resolve().GetComponent(player.Uid).PutInHand(idItemComponent); - var idCardComponent = idDummy.GetComponent(); + var idCardComponent = IoCManager.Resolve().GetComponent(idDummy.Uid); // The ID in the hand should be found first Assert.NotNull(player.GetHeldId()); @@ -102,7 +103,7 @@ namespace Content.IntegrationTests.Tests.PDA Assert.That(id, Is.EqualTo(idCardComponent)); // Remove all IDs and PDAs - var inventory = player.GetComponent(); + var inventory = IoCManager.Resolve().GetComponent(player.Uid); foreach (var slot in inventory.Slots) { @@ -119,7 +120,7 @@ namespace Content.IntegrationTests.Tests.PDA } } - var hands = player.GetComponent(); + var hands = IoCManager.Resolve().GetComponent(player.Uid); hands.Drop(dummyPda, false); hands.Drop(idDummy, false); diff --git a/Content.IntegrationTests/Tests/Power/PowerTest.cs b/Content.IntegrationTests/Tests/Power/PowerTest.cs index 759f61f425..d880fbd973 100644 --- a/Content.IntegrationTests/Tests/Power/PowerTest.cs +++ b/Content.IntegrationTests/Tests/Power/PowerTest.cs @@ -8,6 +8,7 @@ using Content.Server.Power.Nodes; using Content.Shared.Coordinates; using NUnit.Framework; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Timing; @@ -204,9 +205,9 @@ namespace Content.IntegrationTests.Tests.Power var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1)); var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2)); - supplier = generatorEnt.GetComponent(); - consumer1 = consumerEnt1.GetComponent(); - consumer2 = consumerEnt2.GetComponent(); + supplier = IoCManager.Resolve().GetComponent(generatorEnt.Uid); + consumer1 = IoCManager.Resolve().GetComponent(consumerEnt1.Uid); + consumer2 = IoCManager.Resolve().GetComponent(consumerEnt2.Uid); // Plenty of surplus and tolerance supplier.MaxSupply = loadPower * 4; @@ -258,9 +259,9 @@ namespace Content.IntegrationTests.Tests.Power var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1)); var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2)); - supplier = generatorEnt.GetComponent(); - consumer1 = consumerEnt1.GetComponent(); - consumer2 = consumerEnt2.GetComponent(); + supplier = IoCManager.Resolve().GetComponent(generatorEnt.Uid); + consumer1 = IoCManager.Resolve().GetComponent(consumerEnt1.Uid); + consumer2 = IoCManager.Resolve().GetComponent(consumerEnt2.Uid); // Too little supply, both consumers should get 33% power. supplier.MaxSupply = loadPower; @@ -305,8 +306,8 @@ namespace Content.IntegrationTests.Tests.Power var generatorEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates()); var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2)); - supplier = generatorEnt.GetComponent(); - consumer = consumerEnt.GetComponent(); + supplier = IoCManager.Resolve().GetComponent(generatorEnt.Uid); + consumer = IoCManager.Resolve().GetComponent(consumerEnt.Uid); // Supply has enough total power but needs to ramp up to match. supplier.MaxSupply = 400; @@ -375,9 +376,9 @@ namespace Content.IntegrationTests.Tests.Power var generatorEnt = _entityManager.SpawnEntity("DischargingBatteryDummy", grid.ToCoordinates()); var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2)); - netBattery = generatorEnt.GetComponent(); - battery = generatorEnt.GetComponent(); - consumer = consumerEnt.GetComponent(); + netBattery = IoCManager.Resolve().GetComponent(generatorEnt.Uid); + battery = IoCManager.Resolve().GetComponent(generatorEnt.Uid); + consumer = IoCManager.Resolve().GetComponent(consumerEnt.Uid); battery.MaxCharge = startingCharge; battery.CurrentCharge = startingCharge; @@ -453,9 +454,9 @@ namespace Content.IntegrationTests.Tests.Power var generatorEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates()); var batteryEnt = _entityManager.SpawnEntity("ChargingBatteryDummy", grid.ToCoordinates(0, 2)); - supplier = generatorEnt.GetComponent(); - var netBattery = batteryEnt.GetComponent(); - battery = batteryEnt.GetComponent(); + supplier = IoCManager.Resolve().GetComponent(generatorEnt.Uid); + var netBattery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); + battery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); supplier.MaxSupply = 500; supplier.SupplyRampTolerance = 500; @@ -504,10 +505,10 @@ namespace Content.IntegrationTests.Tests.Power var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0)); var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3)); - consumer = consumerEnt.GetComponent(); - supplier = supplyEnt.GetComponent(); - netBattery = batteryEnt.GetComponent(); - battery = batteryEnt.GetComponent(); + consumer = IoCManager.Resolve().GetComponent(consumerEnt.Uid); + supplier = IoCManager.Resolve().GetComponent(supplyEnt.Uid); + netBattery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); + battery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); // Consumer needs 1000 W, supplier can only provide 800, battery fills in the remaining 200. consumer.DrawRate = 1000; @@ -572,10 +573,10 @@ namespace Content.IntegrationTests.Tests.Power var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0)); var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3)); - consumer = consumerEnt.GetComponent(); - supplier = supplyEnt.GetComponent(); - netBattery = batteryEnt.GetComponent(); - battery = batteryEnt.GetComponent(); + consumer = IoCManager.Resolve().GetComponent(consumerEnt.Uid); + supplier = IoCManager.Resolve().GetComponent(supplyEnt.Uid); + netBattery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); + battery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); // Consumer needs 1000 W, supply and battery can only provide 400 each. // BUT the battery has 50% input efficiency, so 50% of the power of the supply gets lost. @@ -650,13 +651,13 @@ namespace Content.IntegrationTests.Tests.Power var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 0)); var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 4)); - consumer1 = consumerEnt1.GetComponent(); - consumer2 = consumerEnt2.GetComponent(); - supplier = supplyEnt.GetComponent(); - var netBattery1 = batteryEnt1.GetComponent(); - var netBattery2 = batteryEnt2.GetComponent(); - var battery1 = batteryEnt1.GetComponent(); - var battery2 = batteryEnt2.GetComponent(); + consumer1 = IoCManager.Resolve().GetComponent(consumerEnt1.Uid); + consumer2 = IoCManager.Resolve().GetComponent(consumerEnt2.Uid); + supplier = IoCManager.Resolve().GetComponent(supplyEnt.Uid); + var netBattery1 = IoCManager.Resolve().GetComponent(batteryEnt1.Uid); + var netBattery2 = IoCManager.Resolve().GetComponent(batteryEnt2.Uid); + var battery1 = IoCManager.Resolve().GetComponent(batteryEnt1.Uid); + var battery2 = IoCManager.Resolve().GetComponent(batteryEnt2.Uid); // There are two loads, 500 W and 1000 W respectively. // The 500 W load is behind a 50% efficient battery, @@ -737,13 +738,13 @@ namespace Content.IntegrationTests.Tests.Power var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 0)); var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 4)); - consumer1 = consumerEnt1.GetComponent(); - consumer2 = consumerEnt2.GetComponent(); - supplier = supplyEnt.GetComponent(); - var netBattery1 = batteryEnt1.GetComponent(); - var netBattery2 = batteryEnt2.GetComponent(); - var battery1 = batteryEnt1.GetComponent(); - var battery2 = batteryEnt2.GetComponent(); + consumer1 = IoCManager.Resolve().GetComponent(consumerEnt1.Uid); + consumer2 = IoCManager.Resolve().GetComponent(consumerEnt2.Uid); + supplier = IoCManager.Resolve().GetComponent(supplyEnt.Uid); + var netBattery1 = IoCManager.Resolve().GetComponent(batteryEnt1.Uid); + var netBattery2 = IoCManager.Resolve().GetComponent(batteryEnt2.Uid); + var battery1 = IoCManager.Resolve().GetComponent(batteryEnt1.Uid); + var battery2 = IoCManager.Resolve().GetComponent(batteryEnt2.Uid); consumer1.DrawRate = 500; consumer2.DrawRate = 1000; @@ -805,10 +806,10 @@ namespace Content.IntegrationTests.Tests.Power var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0)); var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3)); - consumer = consumerEnt.GetComponent(); - supplier = supplyEnt.GetComponent(); - netBattery = batteryEnt.GetComponent(); - var battery = batteryEnt.GetComponent(); + consumer = IoCManager.Resolve().GetComponent(consumerEnt.Uid); + supplier = IoCManager.Resolve().GetComponent(supplyEnt.Uid); + netBattery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); + var battery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); // Consumer needs 1000 W, supplier can only provide 800, battery fills in the remaining 200. consumer.DrawRate = 1000; @@ -881,10 +882,10 @@ namespace Content.IntegrationTests.Tests.Power terminal.Transform.LocalRotation = Angle.FromDegrees(180); var battery = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); - var batteryNodeContainer = battery.GetComponent(); + var batteryNodeContainer = IoCManager.Resolve().GetComponent(battery.Uid); - leftNode = leftEnt.GetComponent().GetNode("power"); - rightNode = rightEnt.GetComponent().GetNode("power"); + leftNode = IoCManager.Resolve().GetComponent(leftEnt.Uid).GetNode("power"); + rightNode = IoCManager.Resolve().GetComponent(rightEnt.Uid).GetNode("power"); batteryInput = batteryNodeContainer.GetNode("input"); batteryOutput = batteryNodeContainer.GetNode("output"); @@ -930,9 +931,9 @@ namespace Content.IntegrationTests.Tests.Power var substationEnt = _entityManager.SpawnEntity("SubstationDummy", grid.ToCoordinates(0, 1)); var apcEnt = _entityManager.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 2)); - var generatorSupplier = generatorEnt.GetComponent(); - substationNetBattery = substationEnt.GetComponent(); - apcBattery = apcEnt.GetComponent(); + var generatorSupplier = IoCManager.Resolve().GetComponent(generatorEnt.Uid); + substationNetBattery = IoCManager.Resolve().GetComponent(substationEnt.Uid); + apcBattery = IoCManager.Resolve().GetComponent(apcEnt.Uid); generatorSupplier.MaxSupply = 1000; generatorSupplier.SupplyRampTolerance = 1000; @@ -972,9 +973,9 @@ namespace Content.IntegrationTests.Tests.Power var apcExtensionEnt = _entityManager.SpawnEntity("CableApcExtension", grid.ToCoordinates(0, 0)); var powerReceiverEnt = _entityManager.SpawnEntity("ApcPowerReceiverDummy", grid.ToCoordinates(0, 2)); - receiver = powerReceiverEnt.GetComponent(); - var battery = apcEnt.GetComponent(); - apcNetBattery = apcEnt.GetComponent(); + receiver = IoCManager.Resolve().GetComponent(powerReceiverEnt.Uid); + var battery = IoCManager.Resolve().GetComponent(apcEnt.Uid); + apcNetBattery = IoCManager.Resolve().GetComponent(apcEnt.Uid); _extensionCableSystem.SetProviderTransferRange(apcExtensionEnt.Uid, 5); _extensionCableSystem.SetReceiverReceptionRange(powerReceiverEnt.Uid, 5); diff --git a/Content.IntegrationTests/Tests/Tag/TagTest.cs b/Content.IntegrationTests/Tests/Tag/TagTest.cs index 1fe45f374d..1d1cabb746 100644 --- a/Content.IntegrationTests/Tests/Tag/TagTest.cs +++ b/Content.IntegrationTests/Tests/Tag/TagTest.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Content.Shared.Tag; using NUnit.Framework; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Prototypes; @@ -60,7 +61,7 @@ namespace Content.IntegrationTests.Tests.Tag { sMapManager.CreateNewMapEntity(MapId.Nullspace); sTagDummy = sEntityManager.SpawnEntity(TagEntityId, MapCoordinates.Nullspace); - sTagComponent = sTagDummy.GetComponent(); + sTagComponent = IoCManager.Resolve().GetComponent(sTagDummy.Uid); }); await server.WaitAssertion(() => diff --git a/Content.IntegrationTests/Tests/Utility/EntityWhitelistTest.cs b/Content.IntegrationTests/Tests/Utility/EntityWhitelistTest.cs index c7352d98c4..a64bee8bab 100644 --- a/Content.IntegrationTests/Tests/Utility/EntityWhitelistTest.cs +++ b/Content.IntegrationTests/Tests/Utility/EntityWhitelistTest.cs @@ -4,6 +4,7 @@ using Content.Shared.Containers.ItemSlots; using Content.Shared.Whitelist; using NUnit.Framework; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; namespace Content.IntegrationTests.Tests.Utility @@ -98,7 +99,7 @@ namespace Content.IntegrationTests.Tests.Utility // Test from serialized var dummy = entityManager.SpawnEntity("WhitelistDummy", mapCoordinates); - var whitelistSer = dummy.GetComponent().Slots.Values.First().Whitelist; + var whitelistSer = IoCManager.Resolve().GetComponent(dummy.Uid).Slots.Values.First().Whitelist; Assert.That(whitelistSer, Is.Not.Null); Assert.That(whitelistSer.Components, Is.Not.Null); diff --git a/Content.Server/AI/Pathfinding/Accessible/ReachableArgs.cs b/Content.Server/AI/Pathfinding/Accessible/ReachableArgs.cs index b503f124a8..6255f1a758 100644 --- a/Content.Server/AI/Pathfinding/Accessible/ReachableArgs.cs +++ b/Content.Server/AI/Pathfinding/Accessible/ReachableArgs.cs @@ -3,6 +3,7 @@ using Content.Server.Access.Components; using Content.Server.Access.Systems; using Content.Server.AI.Components; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Physics; namespace Content.Server.AI.Pathfinding.Accessible @@ -35,7 +36,7 @@ namespace Content.Server.AI.Pathfinding.Accessible var accessSystem = EntitySystem.Get(); var access = accessSystem.FindAccessTags(entity.Uid); - var visionRadius = entity.GetComponent().VisionRadius; + var visionRadius = IoCManager.Resolve().GetComponent(entity.Uid).VisionRadius; return new ReachableArgs(visionRadius, access, collisionMask); } diff --git a/Content.Server/AME/Components/AMEControllerComponent.cs b/Content.Server/AME/Components/AMEControllerComponent.cs index a4656b89f4..71850393d9 100644 --- a/Content.Server/AME/Components/AMEControllerComponent.cs +++ b/Content.Server/AME/Components/AMEControllerComponent.cs @@ -15,6 +15,7 @@ using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; @@ -156,7 +157,7 @@ namespace Content.Server.AME.Components return new AMEControllerBoundUserInterfaceState(Powered, IsMasterController(), false, HasJar, 0, InjectionAmount, GetCoreCount()); } - var jarcomponent = jar.GetComponent(); + var jarcomponent = IoCManager.Resolve().GetComponent(jar.Uid); return new AMEControllerBoundUserInterfaceState(Powered, IsMasterController(), _injecting, HasJar, jarcomponent.FuelAmount, InjectionAmount, GetCoreCount()); } diff --git a/Content.Server/Access/Components/IdCardConsoleComponent.cs b/Content.Server/Access/Components/IdCardConsoleComponent.cs index 0683649d12..be12f74a82 100644 --- a/Content.Server/Access/Components/IdCardConsoleComponent.cs +++ b/Content.Server/Access/Components/IdCardConsoleComponent.cs @@ -133,8 +133,8 @@ namespace Content.Server.Access.Components } else { - var targetIdComponent = targetIdEntity.GetComponent(); - var targetAccessComponent = targetIdEntity.GetComponent(); + var targetIdComponent = IoCManager.Resolve().GetComponent(targetIdEntity.Uid); + var targetAccessComponent = IoCManager.Resolve().GetComponent(targetIdEntity.Uid); newState = new IdCardConsoleBoundUserInterfaceState( PrivilegedIdSlot.HasItem, PrivilegedIdIsAuthorized(), diff --git a/Content.Server/Access/Systems/AccessReaderSystem.cs b/Content.Server/Access/Systems/AccessReaderSystem.cs index e1d3b16e76..64641446fe 100644 --- a/Content.Server/Access/Systems/AccessReaderSystem.cs +++ b/Content.Server/Access/Systems/AccessReaderSystem.cs @@ -108,7 +108,13 @@ namespace Content.Server.Access.Systems if (EntityManager.TryGetComponent(uid, out PDAComponent? pda)) { - tags = pda?.ContainedID?.Owner?.GetComponent()?.Tags; + IEntity tempQualifier = pda?.ContainedID?.Owner; + if (tempQualifier != null) + { + IoCManager.Resolve().GetComponent(tempQualifier.Uid); + } + + tags = RETURNED_VALUE?.Tags; return tags != null; } diff --git a/Content.Server/Administration/Commands/AGhost.cs b/Content.Server/Administration/Commands/AGhost.cs index fb8a72c6d8..6f475375d0 100644 --- a/Content.Server/Administration/Commands/AGhost.cs +++ b/Content.Server/Administration/Commands/AGhost.cs @@ -61,7 +61,7 @@ namespace Content.Server.Administration.Commands mind.TransferTo(ghost.Uid); } - var comp = ghost.GetComponent(); + var comp = IoCManager.Resolve().GetComponent(ghost.Uid); EntitySystem.Get().SetCanReturnToBody(comp, canReturn); } } diff --git a/Content.Server/Administration/Commands/SetOutfitCommand.cs b/Content.Server/Administration/Commands/SetOutfitCommand.cs index 6337a9fb05..f2b3bd74a5 100644 --- a/Content.Server/Administration/Commands/SetOutfitCommand.cs +++ b/Content.Server/Administration/Commands/SetOutfitCommand.cs @@ -106,7 +106,7 @@ namespace Content.Server.Administration.Commands pdaComponent.ContainedID.FullName = target.Name; } - inventoryComponent.Equip(slot, equipmentEntity.GetComponent(), false); + inventoryComponent.Equip(slot, IoCManager.Resolve().GetComponent(equipmentEntity.Uid), false); } } } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs index 862fa61e96..ef77be9a34 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs @@ -205,7 +205,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (container.ContainedEntities.Count > 0) { - var gasTank = container.ContainedEntities[0].GetComponent(); + IEntity tempQualifier = container.ContainedEntities[0]; + var gasTank = IoCManager.Resolve().GetComponent(tempQualifier.Uid); _atmosphereSystem.ReleaseGasTo(canister.Air, gasTank.Air, canister.ReleasePressure); } else diff --git a/Content.Server/Body/Components/BodyPartComponent.cs b/Content.Server/Body/Components/BodyPartComponent.cs index 428c4d6478..2798a6ce9a 100644 --- a/Content.Server/Body/Components/BodyPartComponent.cs +++ b/Content.Server/Body/Components/BodyPartComponent.cs @@ -141,8 +141,8 @@ namespace Content.Server.Body.Components if (_optionsCache.Count > 0) { - OpenSurgeryUI(eventArgs.User.GetComponent().PlayerSession); - BodyPartSlotRequest(eventArgs.User.GetComponent().PlayerSession, + OpenSurgeryUI(IoCManager.Resolve().GetComponent(eventArgs.User.Uid).PlayerSession); + BodyPartSlotRequest(IoCManager.Resolve().GetComponent(eventArgs.User.Uid).PlayerSession, toSend); _surgeonCache = eventArgs.User; _owningBodyCache = body; diff --git a/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs b/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs index 6005e9c851..6892b58bb6 100644 --- a/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs +++ b/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs @@ -129,8 +129,8 @@ namespace Content.Server.Body.Surgery.Components if (_optionsCache.Count > 0 && PerformerCache != null) { - OpenSurgeryUI(PerformerCache.GetComponent().PlayerSession); - UpdateSurgeryUIMechanismRequest(PerformerCache.GetComponent().PlayerSession, + OpenSurgeryUI(IoCManager.Resolve().GetComponent(PerformerCache.Uid).PlayerSession); + UpdateSurgeryUIMechanismRequest(IoCManager.Resolve().GetComponent(PerformerCache.Uid).PlayerSession, toSend); _callbackCache = callback; } diff --git a/Content.Server/Buckle/Systems/StrapSystem.cs b/Content.Server/Buckle/Systems/StrapSystem.cs index 1a4206ccf6..929ce7abbb 100644 --- a/Content.Server/Buckle/Systems/StrapSystem.cs +++ b/Content.Server/Buckle/Systems/StrapSystem.cs @@ -39,7 +39,7 @@ namespace Content.Server.Buckle.Systems // Add unstrap verbs for every strapped entity. foreach (var entity in component.BuckledEntities) { - var buckledComp = entity.GetComponent(); + var buckledComp = IoCManager.Resolve().GetComponent(entity.Uid); if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target, range: buckledComp.Range)) continue; diff --git a/Content.Server/Chat/Commands/SuicideCommand.cs b/Content.Server/Chat/Commands/SuicideCommand.cs index 7ec59dab58..070b63673c 100644 --- a/Content.Server/Chat/Commands/SuicideCommand.cs +++ b/Content.Server/Chat/Commands/SuicideCommand.cs @@ -88,7 +88,7 @@ namespace Content.Server.Chat.Commands EntitySystem.Get().Add(LogType.Suicide, $"{player.AttachedEntity} is committing suicide"); // Held item suicide - var handsComponent = owner.GetComponent(); + var handsComponent = IoCManager.Resolve().GetComponent(owner.Uid); var itemComponent = handsComponent.GetActiveHand; if (itemComponent != null) { diff --git a/Content.Server/Chemistry/TileReactions/SpillTileReaction.cs b/Content.Server/Chemistry/TileReactions/SpillTileReaction.cs index 208d6cb5a6..f79c3b8200 100644 --- a/Content.Server/Chemistry/TileReactions/SpillTileReaction.cs +++ b/Content.Server/Chemistry/TileReactions/SpillTileReaction.cs @@ -5,6 +5,8 @@ using Content.Shared.Chemistry.Reagent; using Content.Shared.FixedPoint; using Content.Shared.Slippery; using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Serialization.Manager.Attributes; @@ -28,7 +30,7 @@ namespace Content.Server.Chemistry.TileReactions if (puddle != null) { - var slippery = puddle.Owner.GetComponent(); + var slippery = IoCManager.Resolve().GetComponent(puddle.Owner.Uid); slippery.LaunchForwardsMultiplier = _launchForwardsMultiplier; slippery.RequiredSlipSpeed = _requiredSlipSpeed; slippery.ParalyzeTime = _paralyzeTime; diff --git a/Content.Server/Climbing/Components/ClimbableComponent.cs b/Content.Server/Climbing/Components/ClimbableComponent.cs index 7a9e209243..7512226db0 100644 --- a/Content.Server/Climbing/Components/ClimbableComponent.cs +++ b/Content.Server/Climbing/Components/ClimbableComponent.cs @@ -10,6 +10,7 @@ using Content.Shared.Interaction.Helpers; using Content.Shared.Popups; using Content.Shared.Verbs; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Log; using Robust.Shared.Maths; @@ -165,7 +166,7 @@ namespace Content.Server.Climbing.Components var direction = (Owner.Transform.WorldPosition - entityPos).Normalized; var endPoint = Owner.Transform.WorldPosition; - var climbMode = entityToMove.GetComponent(); + var climbMode = IoCManager.Resolve().GetComponent(entityToMove.Uid); climbMode.IsClimbing = true; if (MathF.Abs(direction.X) < 0.6f) // user climbed mostly vertically so lets make it a clean straight line @@ -213,7 +214,7 @@ namespace Content.Server.Climbing.Components var direction = (Owner.Transform.WorldPosition - userPos).Normalized; var endPoint = Owner.Transform.WorldPosition; - var climbMode = user.GetComponent(); + var climbMode = IoCManager.Resolve().GetComponent(user.Uid); climbMode.IsClimbing = true; if (MathF.Abs(direction.X) < 0.6f) // user climbed mostly vertically so lets make it a clean straight line diff --git a/Content.Server/Clothing/Components/ClothingComponent.cs b/Content.Server/Clothing/Components/ClothingComponent.cs index 98249d4ab8..d8d0f3e593 100644 --- a/Content.Server/Clothing/Components/ClothingComponent.cs +++ b/Content.Server/Clothing/Components/ClothingComponent.cs @@ -8,6 +8,7 @@ using Content.Shared.Popups; using Content.Shared.Sound; using Robust.Shared.GameObjects; using Robust.Shared.GameStates; +using Robust.Shared.IoC; using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -79,14 +80,14 @@ namespace Content.Server.Clothing.Components { hands.Drop(item.Owner); inv.Equip(slot, item); - hands.PutInHand(Owner.GetComponent()); + hands.PutInHand(IoCManager.Resolve().GetComponent(Owner.Uid)); } } else { hands.Drop(Owner); if (!TryEquip(inv, slot, eventArgs.User)) - hands.PutInHand(Owner.GetComponent()); + hands.PutInHand(IoCManager.Resolve().GetComponent(Owner.Uid)); } return true; diff --git a/Content.Server/Construction/Completions/SpawnPrototype.cs b/Content.Server/Construction/Completions/SpawnPrototype.cs index 391ac5d3f3..3aff9a3aa7 100644 --- a/Content.Server/Construction/Completions/SpawnPrototype.cs +++ b/Content.Server/Construction/Completions/SpawnPrototype.cs @@ -26,7 +26,7 @@ namespace Content.Server.Construction.Completions if (EntityPrototypeHelpers.HasComponent(Prototype)) { var stackEnt = entityManager.SpawnEntity(Prototype, coordinates); - var stack = stackEnt.GetComponent(); + var stack = IoCManager.Resolve().GetComponent(stackEnt.Uid); entityManager.EntitySysManager.GetEntitySystem().SetCount(stackEnt.Uid, Amount, stack); } else diff --git a/Content.Server/Construction/ConstructionSystem.Initial.cs b/Content.Server/Construction/ConstructionSystem.Initial.cs index 3da7c15098..6c484c3f51 100644 --- a/Content.Server/Construction/ConstructionSystem.Initial.cs +++ b/Content.Server/Construction/ConstructionSystem.Initial.cs @@ -238,7 +238,7 @@ namespace Content.Server.Construction var newEntity = EntityManager.SpawnEntity(graph.Nodes[edge.Target].Entity, user.Transform.Coordinates); // Yes, this should throw if it's missing the component. - var construction = newEntity.GetComponent(); + var construction = IoCManager.Resolve().GetComponent(newEntity.Uid); // We attempt to set the pathfinding target. SetPathfindingTarget(newEntity.Uid, targetNode.Name, construction); diff --git a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs index c607c7ef47..19cd984791 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs @@ -4,6 +4,7 @@ using Content.Server.Stack; using Content.Shared.Prototypes; using Content.Shared.Random.Helpers; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.Destructible.Thresholds.Behaviors @@ -33,7 +34,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors if (EntityPrototypeHelpers.HasComponent(entityId)) { var spawned = system.EntityManager.SpawnEntity(entityId, position); - var stack = spawned.GetComponent(); + var stack = IoCManager.Resolve().GetComponent(spawned.Uid); EntitySystem.Get().SetCount(spawned.Uid, count, stack); spawned.RandomOffset(0.5f); } diff --git a/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs index 26d7515aac..ea0db3768a 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs @@ -22,7 +22,7 @@ namespace Content.Server.Disposal.Tube.Components public bool TryInsert(DisposalUnitComponent from) { var holder = IoCManager.Resolve().SpawnEntity(HolderPrototypeId, Owner.Transform.MapPosition); - var holderComponent = holder.GetComponent(); + var holderComponent = IoCManager.Resolve().GetComponent(holder.Uid); foreach (var entity in from.ContainedEntities.ToArray()) { diff --git a/Content.Server/Electrocution/ElectrocutionSystem.cs b/Content.Server/Electrocution/ElectrocutionSystem.cs index 8abce7202a..21613e83c2 100644 --- a/Content.Server/Electrocution/ElectrocutionSystem.cs +++ b/Content.Server/Electrocution/ElectrocutionSystem.cs @@ -277,11 +277,10 @@ namespace Content.Server.Electrocution var electrocutionEntity = EntityManager.SpawnEntity( $"VirtualElectrocutionLoad{node.NodeGroupID}", sourceTransform.Coordinates); - var electrocutionNode = electrocutionEntity - .GetComponent() + var electrocutionNode = IoCManager.Resolve().GetComponent(electrocutionEntity.Uid) .GetNode("electrocution"); - var electrocutionComponent = electrocutionEntity.GetComponent(); + var electrocutionComponent = IoCManager.Resolve().GetComponent(electrocutionEntity.Uid); electrocutionNode.CableEntity = sourceUid; electrocutionNode.NodeName = node.Name; diff --git a/Content.Server/Fluids/Components/SpillExtensions.cs b/Content.Server/Fluids/Components/SpillExtensions.cs index 120b875e8d..5815ab2a12 100644 --- a/Content.Server/Fluids/Components/SpillExtensions.cs +++ b/Content.Server/Fluids/Components/SpillExtensions.cs @@ -194,7 +194,7 @@ namespace Content.Server.Fluids.Components } var puddleEnt = serverEntityManager.SpawnEntity(prototype, spillGridCoords); - var newPuddleComponent = puddleEnt.GetComponent(); + var newPuddleComponent = IoCManager.Resolve().GetComponent(puddleEnt.Uid); puddleSystem.TryAddSolution(newPuddleComponent.Owner.Uid, solution, sound); diff --git a/Content.Server/Fluids/Components/SprayComponent.cs b/Content.Server/Fluids/Components/SprayComponent.cs index 2dd6166bcb..04c99ec285 100644 --- a/Content.Server/Fluids/Components/SprayComponent.cs +++ b/Content.Server/Fluids/Components/SprayComponent.cs @@ -144,7 +144,7 @@ namespace Content.Server.Fluids.Components } // Add the solution to the vapor and actually send the thing - var vaporComponent = vapor.GetComponent(); + var vaporComponent = IoCManager.Resolve().GetComponent(vapor.Uid); var vaporSystem = EntitySystem.Get(); vaporSystem.TryAddSolution(vaporComponent, solution); diff --git a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs index 87f7e46b24..d881bbc157 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs @@ -329,9 +329,10 @@ namespace Content.Server.Fluids.EntitySystems } puddle ??= () => - IoCManager.Resolve().SpawnEntity(IoCManager.Resolve().GetComponent(puddleComponent.Owner.Uid).EntityPrototype?.ID, - mapGrid.DirectionToGrid(coords, direction)) - .GetComponent(); + { + return IoCManager.Resolve().GetComponent(IoCManager.Resolve().SpawnEntity(IoCManager.Resolve().GetComponent(puddleComponent.Owner.Uid).EntityPrototype?.ID, + mapGrid.DirectionToGrid(coords, direction)).Uid); + }; return true; } diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index 1807ce3969..24234f8d77 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -191,7 +191,7 @@ namespace Content.Server.GameTicking var mob = SpawnObserverMob(); mob.Name = name; - var ghost = mob.GetComponent(); + var ghost = IoCManager.Resolve().GetComponent(mob.Uid); EntitySystem.Get().SetCanReturnToBody(ghost, false); newMind.TransferTo(mob.Uid); @@ -238,7 +238,7 @@ namespace Content.Server.GameTicking if (!string.IsNullOrEmpty(equipmentStr)) { var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, entity.Transform.Coordinates); - inventory.Equip(slot, equipmentEntity.GetComponent()); + inventory.Equip(slot, IoCManager.Resolve().GetComponent(equipmentEntity.Uid)); } } } @@ -273,7 +273,7 @@ namespace Content.Server.GameTicking _cardSystem.TryChangeFullName(card.Owner.Uid, characterName, card); _cardSystem.TryChangeJobTitle(card.Owner.Uid, jobPrototype.Name, card); - var access = card.Owner.GetComponent(); + var access = IoCManager.Resolve().GetComponent(card.Owner.Uid); var accessTags = access.Tags; accessTags.UnionWith(jobPrototype.Access); EntityManager.EntitySysManager.GetEntitySystem() diff --git a/Content.Server/GameTicking/Presets/GamePreset.cs b/Content.Server/GameTicking/Presets/GamePreset.cs index 0f5e19d316..241c54473a 100644 --- a/Content.Server/GameTicking/Presets/GamePreset.cs +++ b/Content.Server/GameTicking/Presets/GamePreset.cs @@ -82,7 +82,7 @@ namespace Content.Server.GameTicking.Presets else if (!string.IsNullOrWhiteSpace(mind.Session?.Name)) ghost.Name = mind.Session.Name; - var ghostComponent = ghost.GetComponent(); + var ghostComponent = IoCManager.Resolve().GetComponent(ghost.Uid); if (mind.TimeOfDeath.HasValue) { diff --git a/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs b/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs index 61fc73c421..0531454756 100644 --- a/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs +++ b/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs @@ -93,15 +93,15 @@ namespace Content.Server.GameTicking.Presets // pda var newPDA = _entityManager.SpawnEntity(PDAPrototypeName, mind.OwnedEntity.Transform.Coordinates); - inventory.Equip(EquipmentSlotDefines.Slots.IDCARD, newPDA.GetComponent()); + inventory.Equip(EquipmentSlotDefines.Slots.IDCARD, IoCManager.Resolve().GetComponent(newPDA.Uid)); // belt var newTmp = _entityManager.SpawnEntity(BeltPrototypeName, mind.OwnedEntity.Transform.Coordinates); - inventory.Equip(EquipmentSlotDefines.Slots.BELT, newTmp.GetComponent()); + inventory.Equip(EquipmentSlotDefines.Slots.BELT, IoCManager.Resolve().GetComponent(newTmp.Uid)); // backpack newTmp = _entityManager.SpawnEntity(BackpackPrototypeName, mind.OwnedEntity.Transform.Coordinates); - inventory.Equip(EquipmentSlotDefines.Slots.BACKPACK, newTmp.GetComponent()); + inventory.Equip(EquipmentSlotDefines.Slots.BACKPACK, IoCManager.Resolve().GetComponent(newTmp.Uid)); // Like normal traitors, they need access to a traitor account. var uplinkAccount = new UplinkAccount(startingBalance, mind.OwnedEntity.Uid); @@ -114,7 +114,7 @@ namespace Content.Server.GameTicking.Presets _allOriginalNames[uplinkAccount] = mind.OwnedEntity.Name; // The PDA needs to be marked with the correct owner. - var pda = newPDA.GetComponent(); + var pda = IoCManager.Resolve().GetComponent(newPDA.Uid); _entityManager.EntitySysManager.GetEntitySystem() .SetOwner(pda, mind.OwnedEntity.Name); IoCManager.Resolve().AddComponent(newPDA).UserId = mind.UserId; diff --git a/Content.Server/Gravity/EntitySystems/WeightlessSystem.cs b/Content.Server/Gravity/EntitySystems/WeightlessSystem.cs index 4c470b7231..1baa981e24 100644 --- a/Content.Server/Gravity/EntitySystems/WeightlessSystem.cs +++ b/Content.Server/Gravity/EntitySystems/WeightlessSystem.cs @@ -42,7 +42,7 @@ namespace Content.Server.Gravity.EntitySystems if (_mapManager.TryGetGrid(status.Owner.Transform.GridID, out var grid)) { var gridEntity = EntityManager.GetEntity(grid.GridEntityId); - if (gridEntity.GetComponent().Enabled) + if (IoCManager.Resolve().GetComponent(gridEntity.Uid).Enabled) { RemoveWeightless(status); } diff --git a/Content.Server/Hands/Systems/HandVirtualItemSystem.cs b/Content.Server/Hands/Systems/HandVirtualItemSystem.cs index 8ccca07d2d..e1978038c6 100644 --- a/Content.Server/Hands/Systems/HandVirtualItemSystem.cs +++ b/Content.Server/Hands/Systems/HandVirtualItemSystem.cs @@ -34,7 +34,7 @@ namespace Content.Server.Hands.Systems var pos = hands.Owner.Transform.Coordinates; var virtualItem = EntityManager.SpawnEntity("HandVirtualItem", pos); - var virtualItemComp = virtualItem.GetComponent(); + var virtualItemComp = IoCManager.Resolve().GetComponent(virtualItem.Uid); virtualItemComp.BlockingEntity = blockingEnt; hands.PutEntityIntoHand(hand, virtualItem); return true; diff --git a/Content.Server/Inventory/Components/HumanInventoryControllerComponent.cs b/Content.Server/Inventory/Components/HumanInventoryControllerComponent.cs index 9f324f7514..0fdf44b602 100644 --- a/Content.Server/Inventory/Components/HumanInventoryControllerComponent.cs +++ b/Content.Server/Inventory/Components/HumanInventoryControllerComponent.cs @@ -3,6 +3,7 @@ using Content.Server.Items; using Content.Shared.Item; using Robust.Shared.Containers; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Localization; using static Content.Shared.Inventory.EquipmentSlotDefines; @@ -42,7 +43,7 @@ namespace Content.Server.Inventory.Components if (slotMask == SlotFlags.POCKET) { - var itemComponent = entity.GetComponent(); + var itemComponent = IoCManager.Resolve().GetComponent(entity.Uid); // If this item is small enough then it always fits in pockets. if (itemComponent.Size <= (int) ReferenceSizes.Pocket) diff --git a/Content.Server/Inventory/Components/InventoryComponent.cs b/Content.Server/Inventory/Components/InventoryComponent.cs index 4a412324d8..6477c3a5e1 100644 --- a/Content.Server/Inventory/Components/InventoryComponent.cs +++ b/Content.Server/Inventory/Components/InventoryComponent.cs @@ -131,7 +131,7 @@ namespace Content.Server.Inventory.Components Dirty(); } - return containedEntity?.GetComponent(); + return (containedEntity != null ? IoCManager.Resolve().GetComponent(containedEntity.Uid) : null); } public bool TryGetSlotItem(Slots slot, [NotNullWhen(true)] out T? itemComponent) where T : ItemComponent @@ -193,7 +193,7 @@ namespace Content.Server.Inventory.Components Equip(slot, item, mobCheck, out var _); public bool Equip(Slots slot, IEntity entity, bool mobCheck = true) => - Equip(slot, entity.GetComponent(), mobCheck); + Equip(slot, IoCManager.Resolve().GetComponent(entity.Uid), mobCheck); /// /// Checks whether an item can be put in the specified slot. @@ -251,7 +251,7 @@ namespace Content.Server.Inventory.Components CanEquip(slot, item, mobCheck, out var _); public bool CanEquip(Slots slot, IEntity entity, bool mobCheck = true) => - CanEquip(slot, entity.GetComponent(), mobCheck); + CanEquip(slot, IoCManager.Resolve().GetComponent(entity.Uid), mobCheck); /// /// Drops the item in a slot. @@ -307,7 +307,7 @@ namespace Content.Server.Inventory.Components return; } - var item = entity.GetComponent(); + var item = IoCManager.Resolve().GetComponent(entity.Uid); inventorySlot.ForceRemove(entity); var itemTransform = entity.Transform; @@ -431,7 +431,7 @@ namespace Content.Server.Inventory.Components { case ClientInventoryUpdate.Equip: { - var hands = Owner.GetComponent(); + var hands = IoCManager.Resolve().GetComponent(Owner.Uid); var activeHand = hands.ActiveHand; var activeItem = hands.GetActiveHand; if (activeHand != null && activeItem != null && activeItem.Owner.TryGetComponent(out ItemComponent? item)) @@ -449,7 +449,7 @@ namespace Content.Server.Inventory.Components case ClientInventoryUpdate.Use: { var interactionSystem = _entitySystemManager.GetEntitySystem(); - var hands = Owner.GetComponent(); + var hands = IoCManager.Resolve().GetComponent(Owner.Uid); var activeHand = hands.GetActiveHand; var itemContainedInSlot = GetSlotItem(msg.Inventoryslot); if (itemContainedInSlot != null) @@ -469,7 +469,7 @@ namespace Content.Server.Inventory.Components } case ClientInventoryUpdate.Hover: { - var hands = Owner.GetComponent(); + var hands = IoCManager.Resolve().GetComponent(Owner.Uid); var activeHand = hands.GetActiveHand; if (activeHand != null && GetSlotItem(msg.Inventoryslot) == null) { diff --git a/Content.Server/Kitchen/Components/MicrowaveComponent.cs b/Content.Server/Kitchen/Components/MicrowaveComponent.cs index 27e49efacd..d3ee405d28 100644 --- a/Content.Server/Kitchen/Components/MicrowaveComponent.cs +++ b/Content.Server/Kitchen/Components/MicrowaveComponent.cs @@ -243,7 +243,7 @@ namespace Content.Server.Kitchen.Components return false; } - var itemEntity = eventArgs.User.GetComponent().GetActiveHand?.Owner; + var itemEntity = IoCManager.Resolve().GetComponent(eventArgs.User.Uid).GetActiveHand?.Owner; if (itemEntity == null) { diff --git a/Content.Server/Light/Components/HandheldLightComponent.cs b/Content.Server/Light/Components/HandheldLightComponent.cs index 4e47df5f6c..4bb06c9020 100644 --- a/Content.Server/Light/Components/HandheldLightComponent.cs +++ b/Content.Server/Light/Components/HandheldLightComponent.cs @@ -201,7 +201,7 @@ namespace Content.Server.Light.Components return; } - var appearanceComponent = Owner.GetComponent(); + var appearanceComponent = IoCManager.Resolve().GetComponent(Owner.Uid); if (Cell.MaxCharge - Cell.CurrentCharge < Cell.MaxCharge * 0.70) { diff --git a/Content.Server/Mind/Components/MindComponent.cs b/Content.Server/Mind/Components/MindComponent.cs index 7e4a2dae78..ecbd54ee5e 100644 --- a/Content.Server/Mind/Components/MindComponent.cs +++ b/Content.Server/Mind/Components/MindComponent.cs @@ -110,7 +110,7 @@ namespace Content.Server.Mind.Components } var ghost = IoCManager.Resolve().SpawnEntity("MobObserver", spawnPosition); - var ghostComponent = ghost.GetComponent(); + var ghostComponent = IoCManager.Resolve().GetComponent(ghost.Uid); EntitySystem.Get().SetCanReturnToBody(ghostComponent, false); if (Mind != null) diff --git a/Content.Server/Plants/Components/RandomPottedPlantComponent.cs b/Content.Server/Plants/Components/RandomPottedPlantComponent.cs index b5b830e432..5ea2d4f69d 100644 --- a/Content.Server/Plants/Components/RandomPottedPlantComponent.cs +++ b/Content.Server/Plants/Components/RandomPottedPlantComponent.cs @@ -61,7 +61,7 @@ namespace Content.Server.Plants.Components if (_selectedState != null) { - Owner.GetComponent().LayerSetState(0, _selectedState); + IoCManager.Resolve().GetComponent(Owner.Uid).LayerSetState(0, _selectedState); } } @@ -72,7 +72,7 @@ namespace Content.Server.Plants.Components var list = _plastic ? PlasticPlantStates : RegularPlantStates; _selectedState = random.Pick(list); - Owner.GetComponent().LayerSetState(0, _selectedState); + IoCManager.Resolve().GetComponent(Owner.Uid).LayerSetState(0, _selectedState); } } } diff --git a/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs b/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs index 7b9d30dcff..b243ee242c 100644 --- a/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs +++ b/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs @@ -255,7 +255,7 @@ namespace Content.Server.PneumaticCannon if (comp.GasTankSlot.ContainedEntity != null && comp.GasTankRequired) { // we checked for this earlier in HasGas so a GetComp is okay - var gas = comp.GasTankSlot.ContainedEntity.GetComponent(); + var gas = IoCManager.Resolve().GetComponent(comp.GasTankSlot.ContainedEntity.Uid); var environment = _atmos.GetTileMixture(comp.Owner.Transform.Coordinates, true); var removed = gas.RemoveAir(GetMoleUsageFromPower(comp.Power)); if (environment != null && removed != null) diff --git a/Content.Server/Power/Components/ApcComponent.cs b/Content.Server/Power/Components/ApcComponent.cs index 91281a4b98..99a7353075 100644 --- a/Content.Server/Power/Components/ApcComponent.cs +++ b/Content.Server/Power/Components/ApcComponent.cs @@ -96,7 +96,7 @@ namespace Content.Server.Power.Components if (_accessReader == null || accessSystem.IsAllowed(_accessReader, user.Uid)) { MainBreakerEnabled = !MainBreakerEnabled; - Owner.GetComponent().CanDischarge = MainBreakerEnabled; + IoCManager.Resolve().GetComponent(Owner.Uid).CanDischarge = MainBreakerEnabled; _uiDirty = true; SoundSystem.Play(Filter.Pvs(Owner), _onReceiveMessageSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f)); @@ -174,7 +174,7 @@ namespace Content.Server.Power.Components return ApcChargeState.Full; } - var netBattery = Owner.GetComponent(); + var netBattery = IoCManager.Resolve().GetComponent(Owner.Uid); var delta = netBattery.CurrentSupply - netBattery.CurrentReceiving; return delta < 0 ? ApcChargeState.Charging : ApcChargeState.Lack; @@ -186,7 +186,7 @@ namespace Content.Server.Power.Components if (bat == null) return ApcExternalPowerState.None; - var netBat = Owner.GetComponent(); + var netBat = IoCManager.Resolve().GetComponent(Owner.Uid); if (netBat.CurrentReceiving == 0 && netBat.LoadingNetworkDemand != 0) { return ApcExternalPowerState.None; diff --git a/Content.Server/Power/Components/BaseCharger.cs b/Content.Server/Power/Components/BaseCharger.cs index 55f14c121e..ed5559009f 100644 --- a/Content.Server/Power/Components/BaseCharger.cs +++ b/Content.Server/Power/Components/BaseCharger.cs @@ -8,6 +8,7 @@ using Content.Shared.Popups; using Content.Shared.Power; using Robust.Shared.Containers; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -99,7 +100,7 @@ namespace Content.Server.Power.Components _heldBattery = null; if (user.TryGetComponent(out HandsComponent? handsComponent)) { - handsComponent.PutInHandOrDrop(heldItem.GetComponent()); + handsComponent.PutInHandOrDrop(IoCManager.Resolve().GetComponent(heldItem.Uid)); } if (heldItem.TryGetComponent(out ServerBatteryBarrelComponent? batteryBarrelComponent)) diff --git a/Content.Server/Power/EntitySystems/PowerNetSystem.cs b/Content.Server/Power/EntitySystems/PowerNetSystem.cs index 867a915593..60a3af5455 100644 --- a/Content.Server/Power/EntitySystems/PowerNetSystem.cs +++ b/Content.Server/Power/EntitySystems/PowerNetSystem.cs @@ -6,6 +6,7 @@ using Content.Server.Power.NodeGroups; using Content.Server.Power.Pow3r; using JetBrains.Annotations; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; namespace Content.Server.Power.EntitySystems @@ -342,7 +343,7 @@ namespace Content.Server.Power.EntitySystems foreach (var apc in net.Apcs) { - var netBattery = apc.Owner.GetComponent(); + var netBattery = IoCManager.Resolve().GetComponent(apc.Owner.Uid); netNode.BatteriesDischarging.Add(netBattery.NetworkBattery.Id); netBattery.NetworkBattery.LinkedNetworkDischarging = netNode.Id; } @@ -371,14 +372,14 @@ namespace Content.Server.Power.EntitySystems foreach (var charger in net.Chargers) { - var battery = charger.Owner.GetComponent(); + var battery = IoCManager.Resolve().GetComponent(charger.Owner.Uid); netNode.BatteriesCharging.Add(battery.NetworkBattery.Id); battery.NetworkBattery.LinkedNetworkCharging = netNode.Id; } foreach (var discharger in net.Dischargers) { - var battery = discharger.Owner.GetComponent(); + var battery = IoCManager.Resolve().GetComponent(discharger.Owner.Uid); netNode.BatteriesDischarging.Add(battery.NetworkBattery.Id); battery.NetworkBattery.LinkedNetworkDischarging = netNode.Id; } diff --git a/Content.Server/Power/NodeGroups/PowerNet.cs b/Content.Server/Power/NodeGroups/PowerNet.cs index c3fee34dfd..38fc6e2d32 100644 --- a/Content.Server/Power/NodeGroups/PowerNet.cs +++ b/Content.Server/Power/NodeGroups/PowerNet.cs @@ -7,6 +7,7 @@ using Content.Server.Power.EntitySystems; using Content.Server.Power.Pow3r; using JetBrains.Annotations; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.ViewVariables; @@ -90,7 +91,7 @@ namespace Content.Server.Power.NodeGroups public void AddDischarger(BatteryDischargerComponent discharger) { - var battery = discharger.Owner.GetComponent(); + var battery = IoCManager.Resolve().GetComponent(discharger.Owner.Uid); battery.NetworkBattery.LinkedNetworkCharging = default; Dischargers.Add(discharger); _powerNetSystem.QueueReconnectPowerNet(this); @@ -108,7 +109,7 @@ namespace Content.Server.Power.NodeGroups public void AddCharger(BatteryChargerComponent charger) { - var battery = charger.Owner.GetComponent(); + var battery = IoCManager.Resolve().GetComponent(charger.Owner.Uid); battery.NetworkBattery.LinkedNetworkCharging = default; Chargers.Add(charger); _powerNetSystem.QueueReconnectPowerNet(this); diff --git a/Content.Server/Power/SMES/SmesComponent.cs b/Content.Server/Power/SMES/SmesComponent.cs index 8115975b50..bd2f90d531 100644 --- a/Content.Server/Power/SMES/SmesComponent.cs +++ b/Content.Server/Power/SMES/SmesComponent.cs @@ -78,7 +78,7 @@ namespace Content.Server.Power.SMES private ChargeState GetNewChargeState() { - var battery = Owner.GetComponent(); + var battery = IoCManager.Resolve().GetComponent(Owner.Uid); return (battery.CurrentSupply - battery.CurrentReceiving) switch { > 0 => ChargeState.Discharging, diff --git a/Content.Server/PowerCell/Components/PowerCellChargerComponent.cs b/Content.Server/PowerCell/Components/PowerCellChargerComponent.cs index 3b5d7b78cc..c0291aa5f6 100644 --- a/Content.Server/PowerCell/Components/PowerCellChargerComponent.cs +++ b/Content.Server/PowerCell/Components/PowerCellChargerComponent.cs @@ -1,6 +1,7 @@ using Content.Server.Power.Components; using Content.Shared.Interaction; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.Server.PowerCell.Components { @@ -21,7 +22,7 @@ namespace Content.Server.PowerCell.Components protected override BatteryComponent GetBatteryFrom(IEntity entity) { - return entity.GetComponent(); + return IoCManager.Resolve().GetComponent(entity.Uid); } } } diff --git a/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs b/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs index 619182d9f2..934a0da45c 100644 --- a/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs +++ b/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs @@ -134,7 +134,7 @@ namespace Content.Server.PowerCell.Components //Dirty(); if (user != null) { - if (!user.TryGetComponent(out HandsComponent? hands) || !hands.PutInHand(cell.Owner.GetComponent())) + if (!user.TryGetComponent(out HandsComponent? hands) || !hands.PutInHand(IoCManager.Resolve().GetComponent(cell.Owner.Uid))) { cell.Owner.Transform.Coordinates = user.Transform.Coordinates; } diff --git a/Content.Server/Recycling/RecyclerSystem.cs b/Content.Server/Recycling/RecyclerSystem.cs index a57e8f4538..7e022afb6d 100644 --- a/Content.Server/Recycling/RecyclerSystem.cs +++ b/Content.Server/Recycling/RecyclerSystem.cs @@ -34,7 +34,7 @@ namespace Content.Server.Recycling // Mobs are a special case! if (CanGib(component, entity)) { - entity.GetComponent().Gib(true); + IoCManager.Resolve().GetComponent(entity.Uid).Gib(true); Bloodstain(component); return; } diff --git a/Content.Server/Sandbox/SandboxManager.cs b/Content.Server/Sandbox/SandboxManager.cs index a85ad94cb0..b0479963d3 100644 --- a/Content.Server/Sandbox/SandboxManager.cs +++ b/Content.Server/Sandbox/SandboxManager.cs @@ -153,7 +153,7 @@ namespace Content.Server.Sandbox var card = CreateFreshId(); if (!player.AttachedEntity.TryGetComponent(out inv) || !inv.Equip(Slots.IDCARD, card)) { - hands.PutInHandOrDrop(card.GetComponent()); + hands.PutInHandOrDrop(IoCManager.Resolve().GetComponent(card.Uid)); } } @@ -173,7 +173,7 @@ namespace Content.Server.Sandbox var card = _entityManager.SpawnEntity("CaptainIDCard", player.AttachedEntity.Transform.Coordinates); UpgradeId(card); - card.GetComponent().FullName = player.AttachedEntity.Name; + IoCManager.Resolve().GetComponent(card.Uid).FullName = player.AttachedEntity.Name; return card; } } diff --git a/Content.Server/StationEvents/Events/MeteorSwarm.cs b/Content.Server/StationEvents/Events/MeteorSwarm.cs index d1efd54eec..983c82ecdf 100644 --- a/Content.Server/StationEvents/Events/MeteorSwarm.cs +++ b/Content.Server/StationEvents/Events/MeteorSwarm.cs @@ -121,7 +121,7 @@ namespace Content.Server.StationEvents.Events physics.Mass * ((MaxAngularVelocity - MinAngularVelocity) * _robustRandom.NextFloat() + MinAngularVelocity)); // TODO: God this disgusts me but projectile needs a refactor. - meteor.GetComponent().TimeLeft = 120f; + IoCManager.Resolve().GetComponent(meteor.Uid).TimeLeft = 120f; } } } diff --git a/Content.Server/StationEvents/Events/RadiationStorm.cs b/Content.Server/StationEvents/Events/RadiationStorm.cs index 725df773a3..72af52377f 100644 --- a/Content.Server/StationEvents/Events/RadiationStorm.cs +++ b/Content.Server/StationEvents/Events/RadiationStorm.cs @@ -88,7 +88,7 @@ namespace Content.Server.StationEvents.Events return; var pulse = _entityManager.SpawnEntity("RadiationPulse", coordinates); - pulse.GetComponent().DoPulse(); + IoCManager.Resolve().GetComponent(pulse.Uid).DoPulse(); ResetTimeUntilPulse(); } @@ -96,7 +96,7 @@ namespace Content.Server.StationEvents.Events { var pulse = IoCManager.Resolve() .SpawnEntity("RadiationPulse", at); - pulse.GetComponent().DoPulse(); + IoCManager.Resolve().GetComponent(pulse.Uid).DoPulse(); } private bool TryFindRandomGrid(IMapGrid mapGrid, out EntityCoordinates coordinates) diff --git a/Content.Server/Storage/Components/CursedEntityStorageComponent.cs b/Content.Server/Storage/Components/CursedEntityStorageComponent.cs index 39c71a6725..16fa3ed9fe 100644 --- a/Content.Server/Storage/Components/CursedEntityStorageComponent.cs +++ b/Content.Server/Storage/Components/CursedEntityStorageComponent.cs @@ -40,7 +40,7 @@ namespace Content.Server.Storage.Components if (lockerEnt == null) return; // No valid lockers anywhere. - var locker = lockerEnt.GetComponent(); + var locker = IoCManager.Resolve().GetComponent(lockerEnt.Uid); if (locker.Open) locker.TryCloseStorage(Owner); diff --git a/Content.Server/Storage/Components/ServerStorageComponent.cs b/Content.Server/Storage/Components/ServerStorageComponent.cs index 48df420e95..30bb9d13a6 100644 --- a/Content.Server/Storage/Components/ServerStorageComponent.cs +++ b/Content.Server/Storage/Components/ServerStorageComponent.cs @@ -129,7 +129,7 @@ namespace Content.Server.Storage.Components foreach (var entity in Storage.ContainedEntities) { - var item = entity.GetComponent(); + var item = IoCManager.Resolve().GetComponent(entity.Uid); _storageUsed += item.Size; } } @@ -290,7 +290,7 @@ namespace Content.Server.Storage.Components PlaySoundCollection(); EnsureInitialCalculated(); - var userSession = entity.GetComponent().PlayerSession; + var userSession = IoCManager.Resolve().GetComponent(entity.Uid).PlayerSession; Logger.DebugS(LoggerName, $"Storage (UID {Owner.Uid}) \"used\" by player session (UID {userSession.AttachedEntityUid})."); diff --git a/Content.Server/Strip/StrippableComponent.cs b/Content.Server/Strip/StrippableComponent.cs index 00f36eda42..bf4707ae1d 100644 --- a/Content.Server/Strip/StrippableComponent.cs +++ b/Content.Server/Strip/StrippableComponent.cs @@ -14,6 +14,7 @@ using Content.Shared.Strip.Components; using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.ViewVariables; using static Content.Shared.Inventory.EquipmentSlotDefines; @@ -154,8 +155,8 @@ namespace Content.Server.Strip /// private async void PlaceActiveHandItemInInventory(IEntity user, Slots slot) { - var inventory = Owner.GetComponent(); - var userHands = user.GetComponent(); + var inventory = IoCManager.Resolve().GetComponent(Owner.Uid); + var userHands = IoCManager.Resolve().GetComponent(user.Uid); var item = userHands.GetActiveHand; bool Check() @@ -219,8 +220,8 @@ namespace Content.Server.Strip /// private async void PlaceActiveHandItemInHands(IEntity user, string hand) { - var hands = Owner.GetComponent(); - var userHands = user.GetComponent(); + var hands = IoCManager.Resolve().GetComponent(Owner.Uid); + var userHands = IoCManager.Resolve().GetComponent(user.Uid); var item = userHands.GetActiveHand; bool Check() @@ -285,8 +286,8 @@ namespace Content.Server.Strip /// private async void TakeItemFromInventory(IEntity user, Slots slot) { - var inventory = Owner.GetComponent(); - var userHands = user.GetComponent(); + var inventory = IoCManager.Resolve().GetComponent(Owner.Uid); + var userHands = IoCManager.Resolve().GetComponent(user.Uid); bool Check() { @@ -341,8 +342,8 @@ namespace Content.Server.Strip /// private async void TakeItemFromHands(IEntity user, string hand) { - var hands = Owner.GetComponent(); - var userHands = user.GetComponent(); + var hands = IoCManager.Resolve().GetComponent(Owner.Uid); + var userHands = IoCManager.Resolve().GetComponent(user.Uid); bool Check() { diff --git a/Content.Server/VendingMachines/VendingMachineComponent.cs b/Content.Server/VendingMachines/VendingMachineComponent.cs index 93acf530ea..2b36b4225c 100644 --- a/Content.Server/VendingMachines/VendingMachineComponent.cs +++ b/Content.Server/VendingMachines/VendingMachineComponent.cs @@ -64,7 +64,7 @@ namespace Content.Server.VendingMachines if (!Powered) return; - var wires = Owner.GetComponent(); + var wires = IoCManager.Resolve().GetComponent(Owner.Uid); if (wires.IsPanelOpen) { wires.OpenInterface(actor.PlayerSession); @@ -87,7 +87,7 @@ namespace Content.Server.VendingMachines _spriteName = packPrototype.SpriteName; if (!string.IsNullOrEmpty(_spriteName)) { - var spriteComponent = Owner.GetComponent(); + var spriteComponent = IoCManager.Resolve().GetComponent(Owner.Uid); const string vendingMachineRSIPath = "Structures/Machines/VendingMachines/{0}.rsi"; spriteComponent.BaseRSIPath = string.Format(vendingMachineRSIPath, _spriteName); } diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs index df9d062002..9154f342f8 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs @@ -153,7 +153,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components return false; } - var itemComponent = ammo.GetComponent(); + var itemComponent = IoCManager.Resolve().GetComponent(ammo.Uid); if (!handsComponent.CanPutInHand(itemComponent)) { ammo.Transform.Coordinates = eventArgs.User.Transform.Coordinates; diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs index 579cad0880..584db2acf2 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs @@ -106,7 +106,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components return false; } - var itemComponent = ammo.GetComponent(); + var itemComponent = IoCManager.Resolve().GetComponent(ammo.Uid); if (!handsComponent.CanPutInHand(itemComponent)) { ServerRangedBarrelComponent.EjectCasing(ammo); diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs index 01f7a82cbe..d614934221 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs @@ -296,7 +296,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components { return false; } - if (!chamberedEntity.GetComponent().Caseless) + if (!IoCManager.Resolve().GetComponent(chamberedEntity.Uid).Caseless) { EjectCasing(chamberedEntity); } diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs index 64aeeb24d2..4d7a5ba722 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs @@ -167,7 +167,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (chamberedEntity != null) { _chamberContainer.Remove(chamberedEntity); - var ammoComponent = chamberedEntity.GetComponent(); + var ammoComponent = IoCManager.Resolve().GetComponent(chamberedEntity.Uid); if (!ammoComponent.Caseless) { EjectCasing(chamberedEntity); diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs index e566addc74..a710100ddf 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs @@ -209,7 +209,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components IEntity? bullet = null; if (ammo != null) { - var ammoComponent = ammo.GetComponent(); + var ammoComponent = IoCManager.Resolve().GetComponent(ammo.Uid); bullet = ammoComponent.TakeBullet(spawnAt); if (ammoComponent.Caseless) { diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs index 35b23fc43d..4e63f13a12 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs @@ -55,7 +55,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components return 0; } - return (int) Math.Ceiling(powerCell.GetComponent().CurrentCharge / _baseFireCost); + return (int) Math.Ceiling(IoCManager.Resolve().GetComponent(powerCell.Uid).CurrentCharge / _baseFireCost); } } @@ -70,7 +70,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components return 0; } - return (int) Math.Ceiling((float) (powerCell.GetComponent().MaxCharge / _baseFireCost)); + return (int) Math.Ceiling((float) (IoCManager.Resolve().GetComponent(powerCell.Uid).MaxCharge / _baseFireCost)); } } @@ -150,7 +150,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components return null; } - var capacitor = powerCellEntity.GetComponent(); + var capacitor = IoCManager.Resolve().GetComponent(powerCellEntity.Uid); if (capacitor.CurrentCharge < _lowerChargeLimit) { return null; @@ -256,7 +256,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components Dirty(); UpdateAppearance(); - if (!hands.PutInHand(cell.Owner.GetComponent())) + if (!hands.PutInHand(IoCManager.Resolve().GetComponent(cell.Owner.Uid))) { cell.Owner.Transform.Coordinates = user.Transform.Coordinates; } diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs index 112d1839ba..2566dd4a76 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs @@ -58,7 +58,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components var magazine = MagazineContainer.ContainedEntity; if (magazine != null) { - count += magazine.GetComponent().ShotsLeft; + count += IoCManager.Resolve().GetComponent(magazine.Uid).ShotsLeft; } return count; @@ -74,7 +74,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components var magazine = MagazineContainer.ContainedEntity; if (magazine != null) { - count += magazine.GetComponent().Capacity; + count += IoCManager.Resolve().GetComponent(magazine.Uid).Capacity; } return count; @@ -206,7 +206,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components var entity = _chamberContainer.ContainedEntity; Cycle(); - return entity?.GetComponent().TakeBullet(spawnAt); + return (entity != null ? IoCManager.Resolve().GetComponent(entity.Uid) : null).TakeBullet(spawnAt); } private void Cycle(bool manual = false) @@ -280,7 +280,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components { return false; } - var ammoComponent = chamberEntity.GetComponent(); + var ammoComponent = IoCManager.Resolve().GetComponent(chamberEntity.Uid); if (!ammoComponent.Caseless) { EjectCasing(chamberEntity); @@ -299,7 +299,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components // Try and pull a round from the magazine to replace the chamber if possible var magazine = MagazineContainer.ContainedEntity; - var nextRound = magazine?.GetComponent().TakeAmmo(); + var nextRound = (magazine != null ? IoCManager.Resolve().GetComponent(magazine.Uid) : null).TakeAmmo(); if (nextRound == null) { @@ -308,7 +308,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components _chamberContainer.Insert(nextRound); - if (_autoEjectMag && magazine != null && magazine.GetComponent().ShotsLeft == 0) + if (_autoEjectMag && magazine != null && IoCManager.Resolve().GetComponent(magazine.Uid).ShotsLeft == 0) { SoundSystem.Play(Filter.Pvs(Owner), _soundAutoEject.GetSound(), Owner, AudioParams.Default.WithVolume(-2)); @@ -340,7 +340,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (user.TryGetComponent(out HandsComponent? handsComponent)) { - handsComponent.PutInHandOrDrop(mag.GetComponent()); + handsComponent.PutInHandOrDrop(IoCManager.Resolve().GetComponent(mag.Uid)); } Dirty(); diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs index c69417f8f7..fd7cb2aba2 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs @@ -273,7 +273,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components {Direction.East, Direction.North, Direction.NorthWest, Direction.South, Direction.SouthEast, Direction.West}; const float ejectOffset = 1.8f; - var ammo = entity.GetComponent(); + var ammo = IoCManager.Resolve().GetComponent(entity.Uid); var offsetPos = ((robustRandom.NextFloat() - 0.5f) * ejectOffset, (robustRandom.NextFloat() - 0.5f) * ejectOffset); entity.Transform.Coordinates = entity.Transform.Coordinates.Offset(offsetPos); entity.Transform.LocalRotation = robustRandom.Pick(ejectDirections).ToAngle(); @@ -346,10 +346,10 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components projectileAngle = angle; } - var physics = projectile.GetComponent(); + var physics = IoCManager.Resolve().GetComponent(projectile.Uid); physics.BodyStatus = BodyStatus.InAir; - var projectileComponent = projectile.GetComponent(); + var projectileComponent = IoCManager.Resolve().GetComponent(projectile.Uid); projectileComponent.IgnoreEntity(shooter); // FIXME: Work around issue where inserting and removing an entity from a container, @@ -357,8 +357,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components // See SharedBroadphaseSystem.HandleContainerInsert()... It sets Awake to false, which causes this. projectile.SpawnTimer(TimeSpan.FromMilliseconds(25), () => { - projectile - .GetComponent() + IoCManager.Resolve().GetComponent(projectile.Uid) .LinearVelocity = projectileAngle.ToVec() * velocity; }); diff --git a/Content.Shared/Movement/Components/MovementIgnoreGravityComponent.cs b/Content.Shared/Movement/Components/MovementIgnoreGravityComponent.cs index c12ff37b28..7326602f59 100644 --- a/Content.Shared/Movement/Components/MovementIgnoreGravityComponent.cs +++ b/Content.Shared/Movement/Components/MovementIgnoreGravityComponent.cs @@ -38,7 +38,7 @@ namespace Content.Shared.Movement.Components entityManager ??= IoCManager.Resolve(); var gridEntity = entityManager.GetEntity(gridEntityId); - if (!gridEntity.GetComponent().Enabled) + if (!IoCManager.Resolve().GetComponent(gridEntity.Uid).Enabled) { return true; } diff --git a/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs index 9f7e257610..0b08f9bfa8 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs @@ -36,8 +36,8 @@ namespace Content.Shared.Pulling // They do not expect to be cancellable. private void ForceDisconnect(SharedPullerComponent puller, SharedPullableComponent pullable) { - var pullerPhysics = puller.Owner.GetComponent(); - var pullablePhysics = pullable.Owner.GetComponent(); + var pullerPhysics = IoCManager.Resolve().GetComponent(puller.Owner.Uid); + var pullablePhysics = IoCManager.Resolve().GetComponent(pullable.Owner.Uid); // MovingTo shutdown ForceSetMovingTo(pullable, null); @@ -81,22 +81,22 @@ namespace Content.Shared.Pulling var pullableOldPullerE = pullable?.Puller; if (pullableOldPullerE != null) { - ForceDisconnect(pullableOldPullerE.GetComponent(), pullable!); + ForceDisconnect(IoCManager.Resolve().GetComponent(pullableOldPullerE.Uid), pullable!); } // Continue with the puller. var pullerOldPullableE = puller?.Pulling; if (pullerOldPullableE != null) { - ForceDisconnect(puller!, pullerOldPullableE.GetComponent()); + ForceDisconnect(puller!, IoCManager.Resolve().GetComponent(pullerOldPullableE.Uid)); } // And now for the actual connection (if any). if ((puller != null) && (pullable != null)) { - var pullerPhysics = puller.Owner.GetComponent(); - var pullablePhysics = pullable.Owner.GetComponent(); + var pullerPhysics = IoCManager.Resolve().GetComponent(puller.Owner.Uid); + var pullablePhysics = IoCManager.Resolve().GetComponent(pullable.Owner.Uid); // State startup puller.Pulling = pullable.Owner;