diff --git a/Content.Client/Atmos/Visualizers/AtmosPlaqueVisualizer.cs b/Content.Client/Atmos/Visualizers/AtmosPlaqueVisualizer.cs index c007b465f0..5bf7c324d6 100644 --- a/Content.Client/Atmos/Visualizers/AtmosPlaqueVisualizer.cs +++ b/Content.Client/Atmos/Visualizers/AtmosPlaqueVisualizer.cs @@ -24,7 +24,7 @@ namespace Content.Client.Atmos.Visualizers { base.OnChangeData(component); - if (!IoCManager.Resolve().TryGetComponent(((IComponent) component).Owner, out SpriteComponent? sprite)) + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out SpriteComponent? sprite)) { return; } diff --git a/Content.Client/Atmos/Visualizers/PipeColorVisualizer.cs b/Content.Client/Atmos/Visualizers/PipeColorVisualizer.cs index 93a0a32889..d3da329cc0 100644 --- a/Content.Client/Atmos/Visualizers/PipeColorVisualizer.cs +++ b/Content.Client/Atmos/Visualizers/PipeColorVisualizer.cs @@ -14,7 +14,7 @@ namespace Content.Client.Atmos.Visualizers { base.OnChangeData(component); - if (!IoCManager.Resolve().TryGetComponent(((IComponent) component).Owner, out SpriteComponent? sprite)) + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out SpriteComponent? sprite)) return; if (component.TryGetData(PipeColorVisuals.Color, out Color color)) diff --git a/Content.Client/Instruments/InstrumentSystem.cs b/Content.Client/Instruments/InstrumentSystem.cs index c107c0542b..05e2049cf1 100644 --- a/Content.Client/Instruments/InstrumentSystem.cs +++ b/Content.Client/Instruments/InstrumentSystem.cs @@ -319,7 +319,7 @@ namespace Content.Client.Instruments foreach (var instrument in EntityManager.EntityQuery(true)) { if (instrument.DirtyRenderer && instrument.Renderer != null) - UpdateRenderer(((IComponent) instrument).Owner, instrument); + UpdateRenderer(instrument.Owner, instrument); if (!instrument.IsMidiOpen && !instrument.IsInputOpen) continue; @@ -366,7 +366,7 @@ namespace Content.Client.Instruments if (eventCount == 0) continue; - RaiseNetworkEvent(new InstrumentMidiEventEvent(((IComponent) instrument).Owner, events)); + RaiseNetworkEvent(new InstrumentMidiEventEvent(instrument.Owner, events)); instrument.SentWithinASec += eventCount; diff --git a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs index 46f26dc9e7..afc15ca9d8 100644 --- a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs +++ b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs @@ -104,7 +104,7 @@ namespace Content.Client.Instruments.UI await Task.WhenAll(Timer.Delay(100), file.CopyToAsync(memStream)); if (_owner.Instrument is not {} instrument - || !EntitySystem.Get().OpenMidi(((IComponent) instrument).Owner, memStream.GetBuffer().AsSpan(0, (int) memStream.Length), instrument)) + || !EntitySystem.Get().OpenMidi(instrument.Owner, memStream.GetBuffer().AsSpan(0, (int) memStream.Length), instrument)) return; MidiPlaybackSetButtonsDisabled(false); @@ -123,10 +123,10 @@ namespace Content.Client.Instruments.UI MidiStopButtonOnPressed(null); if(_owner.Instrument is {} instrument) - instrumentSystem.OpenInput(((IComponent) instrument).Owner, instrument); + instrumentSystem.OpenInput(instrument.Owner, instrument); } else if(_owner.Instrument is {} instrument) - instrumentSystem.CloseInput(((IComponent) instrument).Owner, false, instrument); + instrumentSystem.CloseInput(instrument.Owner, false, instrument); } private bool PlayCheck() @@ -162,7 +162,7 @@ namespace Content.Client.Instruments.UI if (_owner.Instrument is not { } instrument) return; - EntitySystem.Get().CloseMidi(((IComponent) instrument).Owner, false, instrument); + EntitySystem.Get().CloseMidi(instrument.Owner, false, instrument); } private void MidiLoopButtonOnOnToggled(ButtonToggledEventArgs obj) @@ -179,14 +179,14 @@ namespace Content.Client.Instruments.UI // Do not seek while still grabbing. if (PlaybackSlider.Grabbed || _owner.Instrument is not {} instrument) return; - EntitySystem.Get().SetPlayerTick(((IComponent) instrument).Owner, (int)Math.Ceiling(PlaybackSlider.Value), instrument); + EntitySystem.Get().SetPlayerTick(instrument.Owner, (int)Math.Ceiling(PlaybackSlider.Value), instrument); } private void PlaybackSliderKeyUp(GUIBoundKeyEventArgs args) { if (args.Function != EngineKeyFunctions.UIClick || _owner.Instrument is not {} instrument) return; - EntitySystem.Get().SetPlayerTick(((IComponent) instrument).Owner, (int)Math.Ceiling(PlaybackSlider.Value), instrument); + EntitySystem.Get().SetPlayerTick(instrument.Owner, (int)Math.Ceiling(PlaybackSlider.Value), instrument); } protected override void FrameUpdate(FrameEventArgs args) diff --git a/Content.Client/Mining/AsteroidRockVisualizer.cs b/Content.Client/Mining/AsteroidRockVisualizer.cs index 1cfda51ba9..f9533d9f82 100644 --- a/Content.Client/Mining/AsteroidRockVisualizer.cs +++ b/Content.Client/Mining/AsteroidRockVisualizer.cs @@ -24,7 +24,7 @@ namespace Content.Client.Mining { base.OnChangeData(component); - if (!IoCManager.Resolve().TryGetComponent(((IComponent) component).Owner, out SpriteComponent? sprite)) + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out SpriteComponent? sprite)) { return; } diff --git a/Content.Client/Singularity/Visualizers/SingularityVisualizer.cs b/Content.Client/Singularity/Visualizers/SingularityVisualizer.cs index 8f93407df3..19bec6d582 100644 --- a/Content.Client/Singularity/Visualizers/SingularityVisualizer.cs +++ b/Content.Client/Singularity/Visualizers/SingularityVisualizer.cs @@ -25,7 +25,7 @@ namespace Content.Client.Singularity.Visualizers { base.OnChangeData(component); - if (!IoCManager.Resolve().TryGetComponent(((IComponent) component).Owner, out SpriteComponent? sprite)) + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out SpriteComponent? sprite)) { return; } diff --git a/Content.Server/Animals/Systems/UdderSystem.cs b/Content.Server/Animals/Systems/UdderSystem.cs index 8e46ba743b..6158582a6f 100644 --- a/Content.Server/Animals/Systems/UdderSystem.cs +++ b/Content.Server/Animals/Systems/UdderSystem.cs @@ -50,11 +50,11 @@ namespace Content.Server.Animals.Systems continue; } - if (!_solutionContainerSystem.TryGetSolution(((IComponent) udder).Owner, udder.TargetSolutionName, out var solution)) + if (!_solutionContainerSystem.TryGetSolution(udder.Owner, udder.TargetSolutionName, out var solution)) continue; //TODO: toxins from bloodstream !? - _solutionContainerSystem.TryAddReagent(((IComponent) udder).Owner, solution, udder.ReagentId, udder.QuantityPerUpdate, out var accepted); + _solutionContainerSystem.TryAddReagent(udder.Owner, solution, udder.ReagentId, udder.QuantityPerUpdate, out var accepted); udder.AccumulatedFrameTime = 0; } } diff --git a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs index 8765ec1fcd..20172009af 100644 --- a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs @@ -79,7 +79,7 @@ namespace Content.Server.Atmos.EntitySystems { airtight.AirBlocked = airblocked; UpdatePosition(airtight); - RaiseLocalEvent(((IComponent) airtight).Owner, new AirtightChanged(airtight)); + RaiseLocalEvent((airtight).Owner, new AirtightChanged(airtight)); } public void UpdatePosition(AirtightComponent airtight) diff --git a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs index 16e2c02143..5fb9800773 100644 --- a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs +++ b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs @@ -200,9 +200,9 @@ namespace Content.Server.Atmos.EntitySystems var fireStackDelta = fireStackMod - flammable.FireStacks; if (fireStackDelta > 0) { - AdjustFireStacks(((IComponent) flammable).Owner, fireStackDelta, flammable); + AdjustFireStacks((flammable).Owner, fireStackDelta, flammable); } - Ignite(((IComponent) flammable).Owner, flammable); + Ignite((flammable).Owner, flammable); } _fireEvents.Clear(); diff --git a/Content.Server/Body/Systems/BodySystem.cs b/Content.Server/Body/Systems/BodySystem.cs index 13d7ae15a9..b776965d24 100644 --- a/Content.Server/Body/Systems/BodySystem.cs +++ b/Content.Server/Body/Systems/BodySystem.cs @@ -56,7 +56,7 @@ namespace Content.Server.Body.Systems foreach (var (part, _) in body.Parts) foreach (var mechanism in part.Mechanisms) { - if (EntityManager.TryGetComponent(((IComponent) mechanism).Owner, out var comp)) + if (EntityManager.TryGetComponent((mechanism).Owner, out var comp)) yield return (comp, mechanism); } } diff --git a/Content.Server/Body/Systems/BrainSystem.cs b/Content.Server/Body/Systems/BrainSystem.cs index 4669f3ee6f..0cb64b4756 100644 --- a/Content.Server/Body/Systems/BrainSystem.cs +++ b/Content.Server/Body/Systems/BrainSystem.cs @@ -14,12 +14,12 @@ namespace Content.Server.Body.Systems { base.Initialize(); - SubscribeLocalEvent((uid, component, args) => HandleMind(((IComponent) args.Body).Owner, uid)); - SubscribeLocalEvent((uid, component, args) => HandleMind(((IComponent) args.Part).Owner, uid)); - SubscribeLocalEvent((uid, component, args) => HandleMind(((IComponent) args.Body).Owner, uid)); + SubscribeLocalEvent((uid, component, args) => HandleMind((args.Body).Owner, uid)); + SubscribeLocalEvent((uid, component, args) => HandleMind((args.Part).Owner, uid)); + SubscribeLocalEvent((uid, component, args) => HandleMind((args.Body).Owner, uid)); SubscribeLocalEvent(OnRemovedFromBody); - SubscribeLocalEvent((uid, component, args) => HandleMind(uid, ((IComponent) args.Old).Owner)); - SubscribeLocalEvent((uid, component, args) => HandleMind(((IComponent) args.OldBody).Owner, uid)); + SubscribeLocalEvent((uid, component, args) => HandleMind(uid, (args.Old).Owner)); + SubscribeLocalEvent((uid, component, args) => HandleMind((args.OldBody).Owner, uid)); } private void OnRemovedFromBody(EntityUid uid, BrainComponent component, RemovedFromBodyEvent args) @@ -28,7 +28,7 @@ namespace Content.Server.Body.Systems if (!EntityManager.TryGetComponent(uid, out MechanismComponent mech)) return; - HandleMind(((IComponent) mech.Part!).Owner, ((IComponent) args.Old).Owner); + HandleMind((mech.Part!).Owner, (args.Old).Owner); } private void HandleMind(EntityUid newEntity, EntityUid oldEntity) diff --git a/Content.Server/Body/Systems/LungSystem.cs b/Content.Server/Body/Systems/LungSystem.cs index 17d07dd54d..1f0ecafb4b 100644 --- a/Content.Server/Body/Systems/LungSystem.cs +++ b/Content.Server/Body/Systems/LungSystem.cs @@ -57,7 +57,7 @@ public class LungSystem : EntitySystem if (!Resolve(uid, ref lung, ref mech)) return; - if (mech.Body != null && EntityManager.TryGetComponent(((IComponent) mech.Body).Owner, out MobStateComponent? mobState) && mobState.IsCritical()) + if (mech.Body != null && EntityManager.TryGetComponent((mech.Body).Owner, out MobStateComponent? mobState) && mobState.IsCritical()) { return; } @@ -111,7 +111,7 @@ public class LungSystem : EntitySystem // TODO Jesus Christ make this event based. if (mech.Body != null && - EntityManager.TryGetComponent(((IComponent) mech.Body).Owner, out InternalsComponent? internals) && + EntityManager.TryGetComponent((mech.Body).Owner, out InternalsComponent? internals) && internals.BreathToolEntity != null && internals.GasTankEntity != null && IoCManager.Resolve().TryGetComponent(internals.BreathToolEntity, out BreathToolComponent? breathTool) && @@ -148,7 +148,7 @@ public class LungSystem : EntitySystem if (mech.Body == null) return; - if (!EntityManager.TryGetComponent(((IComponent) mech.Body).Owner, out BloodstreamComponent? bloodstream)) + if (!EntityManager.TryGetComponent((mech.Body).Owner, out BloodstreamComponent? bloodstream)) return; var to = bloodstream.Air; @@ -189,10 +189,10 @@ public class LungSystem : EntitySystem if (mech.Body == null) return; - if (!EntityManager.TryGetComponent(((IComponent) mech.Body).Owner, out BloodstreamComponent? bloodstream)) + if (!EntityManager.TryGetComponent((mech.Body).Owner, out BloodstreamComponent? bloodstream)) return; - _bloodstreamSystem.PumpToxins(((IComponent) mech.Body).Owner, lung.Air, bloodstream); + _bloodstreamSystem.PumpToxins((mech.Body).Owner, lung.Air, bloodstream); var lungRemoved = lung.Air.RemoveRatio(0.5f); _atmosSys.Merge(to, lungRemoved); diff --git a/Content.Server/Body/Systems/MetabolizerSystem.cs b/Content.Server/Body/Systems/MetabolizerSystem.cs index 4fc32bbadb..81adef2e9b 100644 --- a/Content.Server/Body/Systems/MetabolizerSystem.cs +++ b/Content.Server/Body/Systems/MetabolizerSystem.cs @@ -43,7 +43,7 @@ namespace Content.Server.Body.Systems { if (mech.Body != null) { - _solutionContainerSystem.EnsureSolution(((IComponent) mech.Body).Owner, component.SolutionName); + _solutionContainerSystem.EnsureSolution((mech.Body).Owner, component.SolutionName); } } } @@ -61,7 +61,7 @@ namespace Content.Server.Body.Systems if (metab.AccumulatedFrametime >= metab.UpdateFrequency) { metab.AccumulatedFrametime -= metab.UpdateFrequency; - TryMetabolize(((IComponent) metab).Owner, metab); + TryMetabolize((metab).Owner, metab); } } } @@ -86,9 +86,9 @@ namespace Content.Server.Body.Systems if (body != null) { - if (!Resolve(((IComponent) body).Owner, ref manager, false)) + if (!Resolve((body).Owner, ref manager, false)) return; - _solutionContainerSystem.TryGetSolution(((IComponent) body).Owner, meta.SolutionName, out solution, manager); + _solutionContainerSystem.TryGetSolution((body).Owner, meta.SolutionName, out solution, manager); solutionEntityUid = body.Owner; } } @@ -152,7 +152,7 @@ namespace Content.Server.Body.Systems continue; } - var args = new ReagentEffectArgs(solutionEntityUid.Value, ((IComponent) meta).Owner, solution, proto, entry.MetabolismRate, + var args = new ReagentEffectArgs(solutionEntityUid.Value, (meta).Owner, solution, proto, entry.MetabolismRate, EntityManager, null); // do all effects, if conditions apply diff --git a/Content.Server/Body/Systems/RespiratorSystem.cs b/Content.Server/Body/Systems/RespiratorSystem.cs index 993dcd8ec9..5beb6eaf60 100644 --- a/Content.Server/Body/Systems/RespiratorSystem.cs +++ b/Content.Server/Body/Systems/RespiratorSystem.cs @@ -32,7 +32,7 @@ namespace Content.Server.Body.Systems foreach (var (respirator, blood, body) in EntityManager.EntityQuery()) { - var uid = ((IComponent) respirator).Owner; + var uid = (respirator).Owner; if (!EntityManager.TryGetComponent(uid, out var state) || state.IsDead()) { @@ -144,7 +144,7 @@ namespace Content.Server.Body.Systems foreach (var (lung, mech) in lungs) { - _lungSystem.UpdateLung(((IComponent) lung).Owner, frameTime, lung, mech); + _lungSystem.UpdateLung((lung).Owner, frameTime, lung, mech); } foreach (var (gas, amountNeeded) in needs) @@ -159,7 +159,7 @@ namespace Content.Server.Body.Systems // Panic inhale foreach (var (lung, mech) in lungs) { - _lungSystem.Gasp(((IComponent) lung).Owner, lung, mech); + _lungSystem.Gasp((lung).Owner, lung, mech); } } diff --git a/Content.Server/Body/Systems/StomachSystem.cs b/Content.Server/Body/Systems/StomachSystem.cs index 0b9df6d31b..9f626f718f 100644 --- a/Content.Server/Body/Systems/StomachSystem.cs +++ b/Content.Server/Body/Systems/StomachSystem.cs @@ -35,11 +35,11 @@ namespace Content.Server.Body.Systems stomach.AccumulatedFrameTime -= stomach.UpdateInterval; // Get our solutions - if (!_solutionContainerSystem.TryGetSolution(((IComponent) stomach).Owner, DefaultSolutionName, + if (!_solutionContainerSystem.TryGetSolution((stomach).Owner, DefaultSolutionName, out var stomachSolution, sol)) continue; - if (!_solutionContainerSystem.TryGetSolution(((IComponent) mech.Body).Owner, stomach.BodySolutionName, + if (!_solutionContainerSystem.TryGetSolution((mech.Body).Owner, stomach.BodySolutionName, out var bodySolution)) continue; @@ -56,7 +56,7 @@ namespace Content.Server.Body.Systems if (quant > delta.Quantity) quant = delta.Quantity; - _solutionContainerSystem.TryRemoveReagent(((IComponent) stomach).Owner, stomachSolution, + _solutionContainerSystem.TryRemoveReagent((stomach).Owner, stomachSolution, delta.ReagentId, quant); transferSolution.AddReagent(delta.ReagentId, quant); } @@ -71,7 +71,7 @@ namespace Content.Server.Body.Systems } // Transfer everything to the body solution! - _solutionContainerSystem.TryAddSolution(((IComponent) mech.Body).Owner, bodySolution, transferSolution); + _solutionContainerSystem.TryAddSolution((mech.Body).Owner, bodySolution, transferSolution); } } diff --git a/Content.Server/Body/Systems/ThermalRegulatorSystem.cs b/Content.Server/Body/Systems/ThermalRegulatorSystem.cs index 54daa2a4ee..9de3afae52 100644 --- a/Content.Server/Body/Systems/ThermalRegulatorSystem.cs +++ b/Content.Server/Body/Systems/ThermalRegulatorSystem.cs @@ -22,7 +22,7 @@ public class ThermalRegulatorSystem : EntitySystem continue; regulator.AccumulatedFrametime -= 1; - ProcessThermalRegulation(((IComponent) regulator).Owner, regulator); + ProcessThermalRegulation(regulator.Owner, regulator); } } diff --git a/Content.Server/Chemistry/Components/InjectorComponent.cs b/Content.Server/Chemistry/Components/InjectorComponent.cs index 3778ad7730..dd16ca6d97 100644 --- a/Content.Server/Chemistry/Components/InjectorComponent.cs +++ b/Content.Server/Chemistry/Components/InjectorComponent.cs @@ -190,7 +190,7 @@ namespace Content.Server.Chemistry.Components EntitySystem.Get().SplitSolution(user, targetBloodstream.Solution, realTransferAmount); var bloodstreamSys = EntitySystem.Get(); - bloodstreamSys.TryAddToBloodstream(((IComponent) targetBloodstream).Owner, removedSolution, targetBloodstream); + bloodstreamSys.TryAddToBloodstream((targetBloodstream).Owner, removedSolution, targetBloodstream); removedSolution.DoEntityReaction(targetBloodstream.Owner, ReactionMethod.Injection); diff --git a/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs index 62746227cd..7967a5b19b 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs @@ -38,7 +38,7 @@ namespace Content.Server.Chemistry.EntitySystems var solToInject = solRemoved.SplitSolution(solRemovedVol * component.TransferEfficiency); - _bloodstreamSystem.TryAddToBloodstream(((IComponent) args.OtherFixture.Body).Owner, solToInject, bloodstream); + _bloodstreamSystem.TryAddToBloodstream((args.OtherFixture.Body).Owner, solToInject, bloodstream); } } } diff --git a/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs index 51705e8a1a..980f44e051 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs @@ -32,7 +32,7 @@ namespace Content.Server.Disposal.Tube.Components EntitySystem.Get().Merge(holderComponent.Air, from.Air); from.Air.Clear(); - return EntitySystem.Get().EnterTube(((IComponent) holderComponent).Owner, Owner, holderComponent, null, this); + return EntitySystem.Get().EnterTube((holderComponent).Owner, Owner, holderComponent, null, this); } protected override Direction[] ConnectableDirections() diff --git a/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs index ae34576379..b0964e49d4 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs @@ -93,7 +93,7 @@ namespace Content.Server.Disposal.Tube.Components continue; } - EntitySystem.Get().ExitDisposals(((IComponent) holder).Owner); + EntitySystem.Get().ExitDisposals((holder).Owner); } } diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs index eb0f243784..776c84cc47 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs @@ -59,7 +59,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems if (duc != null) { // Insert into disposal unit - IoCManager.Resolve().GetComponent(entity).Coordinates = new EntityCoordinates(((IComponent) duc).Owner, Vector2.Zero); + IoCManager.Resolve().GetComponent(entity).Coordinates = new EntityCoordinates((duc).Owner, Vector2.Zero); duc.Container.Insert(entity); } else @@ -154,7 +154,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems var currentTube = holder.CurrentTube; if (currentTube == null || currentTube.Deleted) { - ExitDisposals(((IComponent) holder).Owner); + ExitDisposals((holder).Owner); break; } @@ -178,12 +178,12 @@ namespace Content.Server.Disposal.Unit.EntitySystems var nextTube = _disposalTubeSystem.NextTubeFor(currentTube.Owner, holder.CurrentDirection); if (nextTube == null || nextTube.Deleted) { - ExitDisposals(((IComponent) holder).Owner); + ExitDisposals((holder).Owner); break; } // Perform remainder of entry process - if (!EnterTube(((IComponent) holder).Owner, nextTube.Owner, holder, null, nextTube, null)) + if (!EnterTube((holder).Owner, nextTube.Owner, holder, null, nextTube, null)) { break; } diff --git a/Content.Server/Fluids/Components/MopComponent.cs b/Content.Server/Fluids/Components/MopComponent.cs index dd4fcc386c..8a0acc6614 100644 --- a/Content.Server/Fluids/Components/MopComponent.cs +++ b/Content.Server/Fluids/Components/MopComponent.cs @@ -112,7 +112,7 @@ namespace Content.Server.Fluids.Components } if (!_entities.TryGetComponent(target, out PuddleComponent? puddleComponent) || - !solutionSystem.TryGetSolution(((IComponent) puddleComponent).Owner, puddleComponent.SolutionName, out var puddleSolution)) + !solutionSystem.TryGetSolution((puddleComponent).Owner, puddleComponent.SolutionName, out var puddleSolution)) return false; // So if the puddle has 20 units we mop in 2 seconds. Don't just store CurrentVolume given it can change so need to re-calc it anyway. diff --git a/Content.Server/Instruments/InstrumentSystem.cs b/Content.Server/Instruments/InstrumentSystem.cs index 580c945dbf..e84466bb6b 100644 --- a/Content.Server/Instruments/InstrumentSystem.cs +++ b/Content.Server/Instruments/InstrumentSystem.cs @@ -154,7 +154,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem && instrument.InstrumentPlayer != null && instrument.RespectMidiLimits) { // Just in case - Clean(((IComponent) instrument).Owner); + Clean((instrument).Owner); instrument.UserInterface?.CloseAll(); if (instrument.InstrumentPlayer.AttachedEntity is {Valid: true} mob) diff --git a/Content.Server/Kudzu/GrowingKudzuSystem.cs b/Content.Server/Kudzu/GrowingKudzuSystem.cs index a752192cda..53b13c8692 100644 --- a/Content.Server/Kudzu/GrowingKudzuSystem.cs +++ b/Content.Server/Kudzu/GrowingKudzuSystem.cs @@ -44,10 +44,10 @@ public class GrowingKudzuSystem : EntitySystem kudzu.GrowthLevel += 1; if (kudzu.GrowthLevel == 3 && - EntityManager.TryGetComponent(((IComponent) kudzu).Owner, out var spreader)) + EntityManager.TryGetComponent((kudzu).Owner, out var spreader)) { // why cache when you can simply cease to be? Also saves a bit of memory/time. - EntityManager.RemoveComponent(((IComponent) kudzu).Owner); + EntityManager.RemoveComponent((kudzu).Owner); } appearance.SetData(KudzuVisuals.GrowthLevel, kudzu.GrowthLevel); diff --git a/Content.Server/Kudzu/SpreaderSystem.cs b/Content.Server/Kudzu/SpreaderSystem.cs index 851326c8f6..d3935484ad 100644 --- a/Content.Server/Kudzu/SpreaderSystem.cs +++ b/Content.Server/Kudzu/SpreaderSystem.cs @@ -35,7 +35,7 @@ public class SpreaderSystem : EntitySystem private void OnAirtightChanged(AirtightChanged e) { - UpdateNearbySpreaders(((IComponent) e.Airtight).Owner, e.Airtight); + UpdateNearbySpreaders((e.Airtight).Owner, e.Airtight); } private void SpreaderAddHandler(EntityUid uid, SpreaderComponent component, ComponentAdd args) diff --git a/Content.Server/Nuke/NukeCodeSystem.cs b/Content.Server/Nuke/NukeCodeSystem.cs index a53c9fb77d..b9f38955d6 100644 --- a/Content.Server/Nuke/NukeCodeSystem.cs +++ b/Content.Server/Nuke/NukeCodeSystem.cs @@ -67,7 +67,7 @@ namespace Content.Server.Nuke var consoles = EntityManager.EntityQuery(); foreach (var console in consoles) { - if (!EntityManager.TryGetComponent(((IComponent) console).Owner, out TransformComponent? transform)) + if (!EntityManager.TryGetComponent((console).Owner, out TransformComponent? transform)) continue; var consolePos = transform.MapPosition; diff --git a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs index f2ec0a8801..7135a464c0 100644 --- a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs @@ -215,13 +215,13 @@ namespace Content.Server.Nutrition.EntitySystems public void UpdateAppearance(DrinkComponent component) { - if (!EntityManager.TryGetComponent(((IComponent) component).Owner, out AppearanceComponent? appearance) || - !EntityManager.HasComponent(((IComponent) component).Owner)) + if (!EntityManager.TryGetComponent((component).Owner, out AppearanceComponent? appearance) || + !EntityManager.HasComponent((component).Owner)) { return; } - var drainAvailable = _solutionContainerSystem.DrainAvailable(((IComponent) component).Owner); + var drainAvailable = _solutionContainerSystem.DrainAvailable((component).Owner); appearance.SetData(FoodVisuals.Visual, drainAvailable.Float()); appearance.SetData(DrinkCanStateVisual.Opened, component.Opened); } @@ -245,7 +245,7 @@ namespace Content.Server.Nutrition.EntitySystems if (!EntityManager.TryGetComponent(userUid, out SharedBodyComponent? body)) return false; - if (!_solutionContainerSystem.TryGetDrainableSolution(((IComponent) drink).Owner, out var drinkSolution) || + if (!_solutionContainerSystem.TryGetDrainableSolution((drink).Owner, out var drinkSolution) || drinkSolution.DrainAvailable <= 0) { _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty", @@ -271,7 +271,7 @@ namespace Content.Server.Nutrition.EntitySystems var transferAmount = FixedPoint2.Min(drink.TransferAmount, drinkSolution.DrainAvailable); var drain = _solutionContainerSystem.Drain(uid, drinkSolution, transferAmount); var firstStomach = stomachs.FirstOrNull( - stomach => _stomachSystem.CanTransferSolution(((IComponent) stomach.Comp).Owner, drain)); + stomach => _stomachSystem.CanTransferSolution((stomach.Comp).Owner, drain)); // All stomach are full or can't handle whatever solution we have. if (firstStomach == null) @@ -296,7 +296,7 @@ namespace Content.Server.Nutrition.EntitySystems Filter.Pvs(userUid)); drain.DoEntityReaction(userUid, ReactionMethod.Ingestion); - _stomachSystem.TryTransferSolution(((IComponent) firstStomach.Value.Comp).Owner, drain, firstStomach.Value.Comp); + _stomachSystem.TryTransferSolution((firstStomach.Value.Comp).Owner, drain, firstStomach.Value.Comp); return true; } @@ -372,7 +372,7 @@ namespace Content.Server.Nutrition.EntitySystems { args.Drink.InUse = false; var transferAmount = FixedPoint2.Min(args.Drink.TransferAmount, args.DrinkSolution.DrainAvailable); - var drained = _solutionContainerSystem.Drain(((IComponent) args.Drink).Owner, args.DrinkSolution, transferAmount); + var drained = _solutionContainerSystem.Drain((args.Drink).Owner, args.DrinkSolution, transferAmount); if (!_bodySystem.TryGetComponentsOnMechanisms(uid, out var stomachs, body)) { @@ -384,7 +384,7 @@ namespace Content.Server.Nutrition.EntitySystems } var firstStomach = stomachs.FirstOrNull( - stomach => _stomachSystem.CanTransferSolution(((IComponent) stomach.Comp).Owner, drained)); + stomach => _stomachSystem.CanTransferSolution((stomach.Comp).Owner, drained)); // All stomach are full or can't handle whatever solution we have. if (firstStomach == null) @@ -411,7 +411,7 @@ namespace Content.Server.Nutrition.EntitySystems SoundSystem.Play(Filter.Pvs(uid), args.Drink.UseSound.GetSound(), uid, AudioParams.Default.WithVolume(-2f)); drained.DoEntityReaction(uid, ReactionMethod.Ingestion); - _stomachSystem.TryTransferSolution(((IComponent) firstStomach.Value.Comp).Owner, drained, firstStomach.Value.Comp); + _stomachSystem.TryTransferSolution((firstStomach.Value.Comp).Owner, drained, firstStomach.Value.Comp); } private void OnForceDrinkCancelled(ForceDrinkCancelledEvent args) diff --git a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs index 25565410fe..22c66d3685 100644 --- a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs @@ -156,7 +156,7 @@ namespace Content.Server.Nutrition.EntitySystems var transferAmount = food.TransferAmount != null ? FixedPoint2.Min((FixedPoint2) food.TransferAmount, solution.CurrentVolume) : solution.CurrentVolume; var split = _solutionContainerSystem.SplitSolution(uid, solution, transferAmount); var firstStomach = stomachs.FirstOrNull( - stomach => _stomachSystem.CanTransferSolution(((IComponent) stomach.Comp).Owner, split)); + stomach => _stomachSystem.CanTransferSolution((stomach.Comp).Owner, split)); if (firstStomach == null) { @@ -167,7 +167,7 @@ namespace Content.Server.Nutrition.EntitySystems // TODO: Account for partial transfer. split.DoEntityReaction(user, ReactionMethod.Ingestion); - _stomachSystem.TryTransferSolution(((IComponent) firstStomach.Value.Comp).Owner, split, firstStomach.Value.Comp); + _stomachSystem.TryTransferSolution((firstStomach.Value.Comp).Owner, split, firstStomach.Value.Comp); SoundSystem.Play(Filter.Pvs(user), food.UseSound.GetSound(), user, AudioParams.Default.WithVolume(-1f)); _popupSystem.PopupEntity(Loc.GetString(food.EatMessage, ("food", food.Owner)), user, Filter.Entities(user)); @@ -175,7 +175,7 @@ namespace Content.Server.Nutrition.EntitySystems // Try to break all used utensils foreach (var utensil in usedUtensils) { - _utensilSystem.TryBreak(((IComponent) utensil).Owner, user); + _utensilSystem.TryBreak((utensil).Owner, user); } if (food.UsesRemaining > 0) @@ -184,7 +184,7 @@ namespace Content.Server.Nutrition.EntitySystems } if (string.IsNullOrEmpty(food.TrashPrototype)) - EntityManager.QueueDeleteEntity(((IComponent) food).Owner); + EntityManager.QueueDeleteEntity((food).Owner); else DeleteAndSpawnTrash(food, user); @@ -202,7 +202,7 @@ namespace Content.Server.Nutrition.EntitySystems EntityManager.TryGetComponent(user.Value, out HandsComponent? handsComponent) && handsComponent.IsHolding(component.Owner)) { - EntityManager.DeleteEntity(((IComponent) component).Owner); + EntityManager.DeleteEntity((component).Owner); // Put the trash in the user's hand if (EntityManager.TryGetComponent(finisher, out ItemComponent? item) && @@ -213,7 +213,7 @@ namespace Content.Server.Nutrition.EntitySystems return; } - EntityManager.QueueDeleteEntity(((IComponent) component).Owner); + EntityManager.QueueDeleteEntity((component).Owner); } private void AddEatVerb(EntityUid uid, FoodComponent component, GetInteractionVerbsEvent ev) @@ -310,9 +310,9 @@ namespace Content.Server.Nutrition.EntitySystems ? FixedPoint2.Min((FixedPoint2) args.Food.TransferAmount, args.FoodSolution.CurrentVolume) : args.FoodSolution.CurrentVolume; - var split = _solutionContainerSystem.SplitSolution(((IComponent) args.Food).Owner, args.FoodSolution, transferAmount); + var split = _solutionContainerSystem.SplitSolution((args.Food).Owner, args.FoodSolution, transferAmount); var firstStomach = stomachs.FirstOrNull( - stomach => _stomachSystem.CanTransferSolution(((IComponent) stomach.Comp).Owner, split)); + stomach => _stomachSystem.CanTransferSolution((stomach.Comp).Owner, split)); if (firstStomach == null) { @@ -322,7 +322,7 @@ namespace Content.Server.Nutrition.EntitySystems } split.DoEntityReaction(uid, ReactionMethod.Ingestion); - _stomachSystem.TryTransferSolution(((IComponent) firstStomach.Value.Comp).Owner, split, firstStomach.Value.Comp); + _stomachSystem.TryTransferSolution((firstStomach.Value.Comp).Owner, split, firstStomach.Value.Comp); EntityManager.TryGetComponent(uid, out MetaDataComponent? targetMeta); var targetName = targetMeta?.EntityName ?? string.Empty; @@ -341,14 +341,14 @@ namespace Content.Server.Nutrition.EntitySystems // Try to break all used utensils foreach (var utensil in args.Utensils) { - _utensilSystem.TryBreak(((IComponent) utensil).Owner, args.User); + _utensilSystem.TryBreak((utensil).Owner, args.User); } if (args.Food.UsesRemaining > 0) return; if (string.IsNullOrEmpty(args.Food.TrashPrototype)) - EntityManager.QueueDeleteEntity(((IComponent) args.Food).Owner); + EntityManager.QueueDeleteEntity((args.Food).Owner); else DeleteAndSpawnTrash(args.Food, args.User); } diff --git a/Content.Server/Physics/Controllers/MoverController.cs b/Content.Server/Physics/Controllers/MoverController.cs index 4c1ba261e5..f35ba06dbb 100644 --- a/Content.Server/Physics/Controllers/MoverController.cs +++ b/Content.Server/Physics/Controllers/MoverController.cs @@ -107,7 +107,7 @@ namespace Content.Server.Physics.Controllers // then do the movement input once for it. foreach (var (shuttle, pilots) in _shuttlePilots) { - if (shuttle.Paused || !EntityManager.TryGetComponent(((IComponent) shuttle).Owner, out PhysicsComponent? body)) continue; + if (shuttle.Paused || !EntityManager.TryGetComponent((shuttle).Owner, out PhysicsComponent? body)) continue; // Collate movement linear and angular inputs together var linearInput = Vector2.Zero; @@ -130,7 +130,7 @@ namespace Content.Server.Physics.Controllers if (sprint.Equals(Vector2.Zero)) continue; - var offsetRotation = EntityManager.GetComponent(((IComponent) console).Owner).LocalRotation; + var offsetRotation = EntityManager.GetComponent((console).Owner).LocalRotation; linearInput += offsetRotation.RotateVec(new Vector2(0f, sprint.Y)); angularInput += sprint.X; @@ -152,7 +152,7 @@ namespace Content.Server.Physics.Controllers if (sprint.Equals(Vector2.Zero)) continue; - var offsetRotation = EntityManager.GetComponent(((IComponent) console).Owner).LocalRotation; + var offsetRotation = EntityManager.GetComponent((console).Owner).LocalRotation; sprint = offsetRotation.RotateVec(sprint); linearInput += sprint; @@ -179,7 +179,7 @@ namespace Content.Server.Physics.Controllers var angle = linearInput.ToWorldAngle(); var linearDir = angle.GetDir(); var dockFlag = linearDir.AsFlag(); - var shuttleNorth = EntityManager.GetComponent(((IComponent) body).Owner).WorldRotation.ToWorldVec(); + var shuttleNorth = EntityManager.GetComponent((body).Owner).WorldRotation.ToWorldVec(); // Won't just do cardinal directions. foreach (DirectionFlag dir in Enum.GetValues(typeof(DirectionFlag))) diff --git a/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs b/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs index 0c4e95a72d..5a14957b0d 100644 --- a/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs +++ b/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs @@ -175,7 +175,7 @@ namespace Content.Server.PneumaticCannon if (storage.StoredEntities == null) return; if (storage.StoredEntities.Count == 0) { - SoundSystem.Play(Filter.Pvs(((IComponent) comp).Owner), "/Audio/Weapons/click.ogg", ((IComponent) comp).Owner, AudioParams.Default); + SoundSystem.Play(Filter.Pvs((comp).Owner), "/Audio/Weapons/click.ogg", ((IComponent) comp).Owner, AudioParams.Default); return; } diff --git a/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs b/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs index 89e0f55fc9..468c1f9f24 100644 --- a/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs +++ b/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs @@ -68,7 +68,7 @@ namespace Content.Server.Power.EntitySystems { // No point resetting what the receiver is doing if it's deleting, plus significant perf savings // in not doing needless lookups - if (EntityManager.GetComponent(((IComponent) receiver).Owner).EntityLifeStage > + if (EntityManager.GetComponent((receiver).Owner).EntityLifeStage > EntityLifeStage.MapInitialized) continue; TryFindAndSetProvider(receiver); diff --git a/Content.Server/Shuttles/EntitySystems/DockingSystem.cs b/Content.Server/Shuttles/EntitySystems/DockingSystem.cs index c507736e53..771e833db1 100644 --- a/Content.Server/Shuttles/EntitySystems/DockingSystem.cs +++ b/Content.Server/Shuttles/EntitySystems/DockingSystem.cs @@ -110,7 +110,7 @@ namespace Content.Server.Shuttles.EntitySystems if (dockingFixture == null) { DebugTools.Assert(false); - Logger.ErrorS("docking", $"Found null fixture on {((IComponent) body).Owner}"); + Logger.ErrorS("docking", $"Found null fixture on {(body).Owner}"); return null; } @@ -181,7 +181,7 @@ namespace Content.Server.Shuttles.EntitySystems if (dockB == null || dockA.DockJoint == null) { DebugTools.Assert(false); - Logger.Error("docking", $"Tried to cleanup {((IComponent) dockA).Owner} but not docked?"); + Logger.Error("docking", $"Tried to cleanup {(dockA).Owner} but not docked?"); dockA.DockedWith = null; if (dockA.DockJoint != null) @@ -200,8 +200,8 @@ namespace Content.Server.Shuttles.EntitySystems dockA.DockedWith = null; // If these grids are ever invalid then need to look at fixing ordering for unanchored events elsewhere. - var gridAUid = _mapManager.GetGrid(EntityManager.GetComponent(((IComponent) dockA).Owner).GridID).GridEntityId; - var gridBUid = _mapManager.GetGrid(EntityManager.GetComponent(((IComponent) dockB).Owner).GridID).GridEntityId; + var gridAUid = _mapManager.GetGrid(EntityManager.GetComponent((dockA).Owner).GridID).GridEntityId; + var gridBUid = _mapManager.GetGrid(EntityManager.GetComponent((dockB).Owner).GridID).GridEntityId; var msg = new UndockEvent { @@ -211,8 +211,8 @@ namespace Content.Server.Shuttles.EntitySystems GridBUid = gridBUid, }; - EntityManager.EventBus.RaiseLocalEvent(((IComponent) dockA).Owner, msg, false); - EntityManager.EventBus.RaiseLocalEvent(((IComponent) dockB).Owner, msg, false); + EntityManager.EventBus.RaiseLocalEvent((dockA).Owner, msg, false); + EntityManager.EventBus.RaiseLocalEvent((dockB).Owner, msg, false); EntityManager.EventBus.RaiseEvent(EventSource.Local, msg); } @@ -308,8 +308,8 @@ namespace Content.Server.Shuttles.EntitySystems // We could also potentially use a prismatic joint? Depending if we want clamps that can extend or whatever - var dockAXform = EntityManager.GetComponent(((IComponent) dockA).Owner); - var dockBXform = EntityManager.GetComponent(((IComponent) dockB).Owner); + var dockAXform = EntityManager.GetComponent((dockA).Owner); + var dockBXform = EntityManager.GetComponent((dockB).Owner); var gridA = _mapManager.GetGrid(dockAXform.GridID).GridEntityId; var gridB = _mapManager.GetGrid(dockBXform.GridID).GridEntityId; @@ -324,7 +324,7 @@ namespace Content.Server.Shuttles.EntitySystems // These need playing around with // Could also potentially have collideconnected false and stiffness 0 but it was a bit more suss??? - var joint = _jointSystem.CreateWeldJoint(gridA, gridB, DockingJoint + ((IComponent) dockA).Owner); + var joint = _jointSystem.CreateWeldJoint(gridA, gridB, DockingJoint + (dockA).Owner); var gridAXform = EntityManager.GetComponent(gridA); var gridBXform = EntityManager.GetComponent(gridB); @@ -344,13 +344,13 @@ namespace Content.Server.Shuttles.EntitySystems dockA.DockJoint = joint; dockB.DockJoint = joint; - if (EntityManager.TryGetComponent(((IComponent) dockA).Owner, out ServerDoorComponent? doorA)) + if (EntityManager.TryGetComponent((dockA).Owner, out ServerDoorComponent? doorA)) { doorA.ChangeAirtight = false; doorA.Open(); } - if (EntityManager.TryGetComponent(((IComponent) dockB).Owner, out ServerDoorComponent? doorB)) + if (EntityManager.TryGetComponent((dockB).Owner, out ServerDoorComponent? doorB)) { doorB.ChangeAirtight = false; doorB.Open(); @@ -364,8 +364,8 @@ namespace Content.Server.Shuttles.EntitySystems GridBUid = gridB, }; - EntityManager.EventBus.RaiseLocalEvent(((IComponent) dockA).Owner, msg, false); - EntityManager.EventBus.RaiseLocalEvent(((IComponent) dockB).Owner, msg, false); + EntityManager.EventBus.RaiseLocalEvent((dockA).Owner, msg, false); + EntityManager.EventBus.RaiseLocalEvent((dockB).Owner, msg, false); EntityManager.EventBus.RaiseEvent(EventSource.Local, msg); } @@ -374,8 +374,8 @@ namespace Content.Server.Shuttles.EntitySystems /// private void TryDock(DockingComponent dockA, DockingComponent dockB) { - if (!EntityManager.TryGetComponent(((IComponent) dockA).Owner, out PhysicsComponent? bodyA) || - !EntityManager.TryGetComponent(((IComponent) dockB).Owner, out PhysicsComponent? bodyB) || + if (!EntityManager.TryGetComponent((dockA).Owner, out PhysicsComponent? bodyA) || + !EntityManager.TryGetComponent((dockB).Owner, out PhysicsComponent? bodyB) || !dockA.Enabled || !dockB.Enabled) { @@ -421,17 +421,17 @@ namespace Content.Server.Shuttles.EntitySystems if (dock.DockedWith == null) { DebugTools.Assert(false); - Logger.ErrorS("docking", $"Tried to undock {((IComponent) dock).Owner} but not docked with anything?"); + Logger.ErrorS("docking", $"Tried to undock {(dock).Owner} but not docked with anything?"); return; } - if (EntityManager.TryGetComponent(((IComponent) dock).Owner, out ServerDoorComponent? doorA)) + if (EntityManager.TryGetComponent((dock).Owner, out ServerDoorComponent? doorA)) { doorA.ChangeAirtight = true; doorA.Close(); } - if (EntityManager.TryGetComponent(((IComponent) dock.DockedWith).Owner, out ServerDoorComponent? doorB)) + if (EntityManager.TryGetComponent((dock.DockedWith).Owner, out ServerDoorComponent? doorB)) { doorB.ChangeAirtight = true; doorB.Close(); diff --git a/Content.Server/Shuttles/EntitySystems/ShuttleConsoleSystem.cs b/Content.Server/Shuttles/EntitySystems/ShuttleConsoleSystem.cs index ac0afe52ec..a0d229f165 100644 --- a/Content.Server/Shuttles/EntitySystems/ShuttleConsoleSystem.cs +++ b/Content.Server/Shuttles/EntitySystems/ShuttleConsoleSystem.cs @@ -39,7 +39,7 @@ namespace Content.Server.Shuttles.EntitySystems { if (comp.Console == null) continue; - if (!_blocker.CanInteract(((IComponent) comp).Owner)) + if (!_blocker.CanInteract((comp).Owner)) { toRemove.Add(comp); } diff --git a/Content.Server/Shuttles/EntitySystems/ThrusterSystem.cs b/Content.Server/Shuttles/EntitySystems/ThrusterSystem.cs index 891d902fe7..347e863e4f 100644 --- a/Content.Server/Shuttles/EntitySystems/ThrusterSystem.cs +++ b/Content.Server/Shuttles/EntitySystems/ThrusterSystem.cs @@ -397,14 +397,14 @@ namespace Content.Server.Shuttles.EntitySystems if (args.OurFixture.ID != BurnFixture) return; _activeThrusters.Add(component); - component.Colliding.Add(((IComponent) args.OtherFixture.Body).Owner); + component.Colliding.Add((args.OtherFixture.Body).Owner); } private void OnEndCollide(EntityUid uid, ThrusterComponent component, EndCollideEvent args) { if (args.OurFixture.ID != BurnFixture) return; - component.Colliding.Remove(((IComponent) args.OtherFixture.Body).Owner); + component.Colliding.Remove((args.OtherFixture.Body).Owner); if (component.Colliding.Count == 0) { @@ -425,7 +425,7 @@ namespace Content.Server.Shuttles.EntitySystems foreach (var comp in component.LinearThrusters[index]) { - if (!EntityManager.TryGetComponent(((IComponent) comp).Owner, out AppearanceComponent? appearanceComponent)) + if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent)) continue; comp.Firing = true; @@ -446,7 +446,7 @@ namespace Content.Server.Shuttles.EntitySystems foreach (var comp in component.LinearThrusters[index]) { - if (!EntityManager.TryGetComponent(((IComponent) comp).Owner, out AppearanceComponent? appearanceComponent)) + if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent)) continue; comp.Firing = false; @@ -470,7 +470,7 @@ namespace Content.Server.Shuttles.EntitySystems { foreach (var comp in component.AngularThrusters) { - if (!EntityManager.TryGetComponent(((IComponent) comp).Owner, out AppearanceComponent? appearanceComponent)) + if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent)) continue; comp.Firing = true; @@ -481,7 +481,7 @@ namespace Content.Server.Shuttles.EntitySystems { foreach (var comp in component.AngularThrusters) { - if (!EntityManager.TryGetComponent(((IComponent) comp).Owner, out AppearanceComponent? appearanceComponent)) + if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent)) continue; comp.Firing = false; diff --git a/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs b/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs index 2c03f5e679..4030f057e6 100644 --- a/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs +++ b/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs @@ -112,17 +112,19 @@ namespace Content.Server.Solar.EntitySystems else { TotalPanelPower = 0; - foreach (var panel in EntityManager.EntityQuery()) + foreach (var (panel, xform) in EntityManager.EntityQuery()) { TotalPanelPower += panel.MaxSupply * panel.Coverage; - IoCManager.Resolve().GetComponent(panel.Owner).WorldRotation = TargetPanelRotation; + xform.WorldRotation = TargetPanelRotation; _updateQueue.Enqueue(panel); } } } - private void UpdatePanelCoverage(SolarPanelComponent panel) { + private void UpdatePanelCoverage(SolarPanelComponent panel) + { EntityUid entity = panel.Owner; + var xform = EntityManager.GetComponent(entity); // So apparently, and yes, I *did* only find this out later, // this is just a really fancy way of saying "Lambert's law of cosines". @@ -136,7 +138,7 @@ namespace Content.Server.Solar.EntitySystems // directly downwards (abs(theta) = pi) = coverage -1 // as TowardsSun + = CCW, // panelRelativeToSun should - = CW - var panelRelativeToSun = IoCManager.Resolve().GetComponent(entity).WorldRotation - TowardsSun; + var panelRelativeToSun = xform.WorldRotation - TowardsSun; // essentially, given cos = X & sin = Y & Y is 'downwards', // then for the first 90 degrees of rotation in either direction, // this plots the lower-right quadrant of a circle. @@ -154,19 +156,19 @@ namespace Content.Server.Solar.EntitySystems if (coverage > 0) { // Determine if the solar panel is occluded, and zero out coverage if so. - var ray = new CollisionRay(IoCManager.Resolve().GetComponent(entity).WorldPosition, TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque); + var ray = new CollisionRay(xform.WorldPosition, TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque); var rayCastResults = _physicsSystem.IntersectRayWithPredicate( - IoCManager.Resolve().GetComponent(entity).MapID, + xform.MapID, ray, SunOcclusionCheckDistance, - e => !IoCManager.Resolve().GetComponent(e).Anchored || e == entity); + e => !xform.Anchored || e == entity); if (rayCastResults.Any()) coverage = 0; } // Total coverage calculated; apply it to the panel. panel.Coverage = coverage; - UpdateSupply(((IComponent) panel).Owner, panel); + UpdateSupply((panel).Owner, panel); } public void UpdateSupply( diff --git a/Content.Server/StationEvents/Events/RadiationStorm.cs b/Content.Server/StationEvents/Events/RadiationStorm.cs index 69706c8a68..34bd8455a0 100644 --- a/Content.Server/StationEvents/Events/RadiationStorm.cs +++ b/Content.Server/StationEvents/Events/RadiationStorm.cs @@ -71,7 +71,7 @@ namespace Content.Server.StationEvents.Events var possibleTargets = _entityManager.EntityQuery() .Where(x => x.Station == _target).ToArray(); StationComponent tempQualifier = _robustRandom.Pick(possibleTargets); - var stationEnt = ((IComponent) tempQualifier).Owner; + var stationEnt = (tempQualifier).Owner; if (!_entityManager.TryGetComponent(stationEnt, out var grid)) return; diff --git a/Content.Server/Tabletop/TabletopSystem.cs b/Content.Server/Tabletop/TabletopSystem.cs index 66b22a77f3..41ab8635c2 100644 --- a/Content.Server/Tabletop/TabletopSystem.cs +++ b/Content.Server/Tabletop/TabletopSystem.cs @@ -103,7 +103,7 @@ namespace Content.Server.Tabletop return; }; - var gamerUid = ((IComponent) gamer).Owner; + var gamerUid = (gamer).Owner; if (actor.PlayerSession.Status > SessionStatus.Connected || CanSeeTable(gamerUid, gamer.Tabletop) || !StunnedOrNoHands(gamerUid)) diff --git a/Content.Server/Temperature/Systems/TemperatureSystem.cs b/Content.Server/Temperature/Systems/TemperatureSystem.cs index 2bbd4de2fb..a3c5e4ef89 100644 --- a/Content.Server/Temperature/Systems/TemperatureSystem.cs +++ b/Content.Server/Temperature/Systems/TemperatureSystem.cs @@ -59,7 +59,7 @@ namespace Content.Server.Temperature.Systems if (comp.Deleted || comp.Paused) continue; - ChangeDamage(((IComponent) comp).Owner, comp); + ChangeDamage((comp).Owner, comp); } ShouldUpdateDamage.Clear(); diff --git a/Content.Server/UserInterface/ActivatableUISystem.cs b/Content.Server/UserInterface/ActivatableUISystem.cs index 3d50e6c414..c26f19f0f8 100644 --- a/Content.Server/UserInterface/ActivatableUISystem.cs +++ b/Content.Server/UserInterface/ActivatableUISystem.cs @@ -83,10 +83,10 @@ namespace Content.Server.UserInterface // If we've gotten this far, fire a cancellable event that indicates someone is about to activate this. // This is so that stuff can require further conditions (like power). var oae = new ActivatableUIOpenAttemptEvent(user); - RaiseLocalEvent(((IComponent) aui).Owner, oae, false); + RaiseLocalEvent((aui).Owner, oae, false); if (oae.Cancelled) return false; - SetCurrentSingleUser(((IComponent) aui).Owner, actor.PlayerSession, aui); + SetCurrentSingleUser((aui).Owner, actor.PlayerSession, aui); ui.Toggle(actor.PlayerSession); return true; } diff --git a/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs b/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs index 839ca470f0..5caf921d4d 100644 --- a/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs +++ b/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs @@ -278,7 +278,7 @@ namespace Content.Server.Weapon.Melee foreach (var bloodstream in hitBloodstreams) { var individualInjection = solutionToInject.SplitSolution(volPerBloodstream); - _bloodstreamSystem.TryAddToBloodstream(((IComponent) bloodstream).Owner, individualInjection, bloodstream); + _bloodstreamSystem.TryAddToBloodstream((bloodstream).Owner, individualInjection, bloodstream); } } diff --git a/Content.Shared/Body/Components/SharedBodyComponent.cs b/Content.Shared/Body/Components/SharedBodyComponent.cs index 2262102e6b..1cac1d8605 100644 --- a/Content.Shared/Body/Components/SharedBodyComponent.cs +++ b/Content.Shared/Body/Components/SharedBodyComponent.cs @@ -191,7 +191,7 @@ namespace Content.Shared.Body.Components { // TODO BODY SYSTEM KILL : Find a more elegant way of killing em than just dumping bloodloss damage. var damage = new DamageSpecifier(_prototypeManager.Index("Bloodloss"), 300); - EntitySystem.Get().TryChangeDamage(((IComponent) part).Owner, damage); + EntitySystem.Get().TryChangeDamage(part.Owner, damage); } OnBodyChanged(); @@ -468,7 +468,7 @@ namespace Content.Shared.Body.Components var i = 0; foreach (var (part, slot) in SlotParts) { - parts[i] = (slot.Id, Owner: ((IComponent) part).Owner); + parts[i] = (slot.Id, Owner: part.Owner); i++; } diff --git a/Content.Shared/Body/Components/SharedBodyPartComponent.cs b/Content.Shared/Body/Components/SharedBodyPartComponent.cs index f2d70c6bdb..6e496125b6 100644 --- a/Content.Shared/Body/Components/SharedBodyPartComponent.cs +++ b/Content.Shared/Body/Components/SharedBodyPartComponent.cs @@ -304,7 +304,7 @@ namespace Content.Shared.Body.Components foreach (var mechanism in _mechanisms) { - IoCManager.Resolve().EventBus.RaiseLocalEvent(((IComponent) mechanism).Owner, new AddedToBodyEvent(body)); + IoCManager.Resolve().EventBus.RaiseLocalEvent(mechanism.Owner, new AddedToBodyEvent(body)); } } @@ -319,7 +319,7 @@ namespace Content.Shared.Body.Components foreach (var mechanism in _mechanisms) { - IoCManager.Resolve().EventBus.RaiseLocalEvent(((IComponent) mechanism).Owner, new RemovedFromBodyEvent(old)); + IoCManager.Resolve().EventBus.RaiseLocalEvent(mechanism.Owner, new RemovedFromBodyEvent(old)); } } diff --git a/Content.Shared/Chemistry/MetabolismMovespeedModifierSystem.cs b/Content.Shared/Chemistry/MetabolismMovespeedModifierSystem.cs index ddf36166ab..7ad749954f 100644 --- a/Content.Shared/Chemistry/MetabolismMovespeedModifierSystem.cs +++ b/Content.Shared/Chemistry/MetabolismMovespeedModifierSystem.cs @@ -75,9 +75,9 @@ namespace Content.Shared.Chemistry if (component.ModifierTimer > currentTime) continue; _components.RemoveAt(i); - EntityManager.RemoveComponent(((IComponent) component).Owner); + EntityManager.RemoveComponent(component.Owner); - _movespeed.RefreshMovementSpeedModifiers(((IComponent) component).Owner); + _movespeed.RefreshMovementSpeedModifiers(component.Owner); } } } diff --git a/Content.Shared/Damage/Systems/DamageableSystem.cs b/Content.Shared/Damage/Systems/DamageableSystem.cs index 927656abc5..20c6707db6 100644 --- a/Content.Shared/Damage/Systems/DamageableSystem.cs +++ b/Content.Shared/Damage/Systems/DamageableSystem.cs @@ -128,9 +128,9 @@ namespace Content.Shared.Damage SetTotalDamage(component, component.Damage.Total, logChange); component.Dirty(); - if (EntityManager.TryGetComponent(((IComponent) component).Owner, out var appearance) && damageDelta != null) + if (EntityManager.TryGetComponent(component.Owner, out var appearance) && damageDelta != null) appearance.SetData(DamageVisualizerKeys.DamageUpdateGroups, damageDelta.GetDamagePerGroup().Keys.ToList()); - RaiseLocalEvent(((IComponent) component).Owner, new DamageChangedEvent(component, damageDelta, interruptsDoAfters), false); + RaiseLocalEvent(component.Owner, new DamageChangedEvent(component, damageDelta, interruptsDoAfters), false); } /// diff --git a/Content.Shared/Friction/SharedTileFrictionController.cs b/Content.Shared/Friction/SharedTileFrictionController.cs index 14b51d3281..a53b96ed90 100644 --- a/Content.Shared/Friction/SharedTileFrictionController.cs +++ b/Content.Shared/Friction/SharedTileFrictionController.cs @@ -56,7 +56,7 @@ namespace Content.Shared.Friction if (body.Deleted || prediction && !body.Predict || body.BodyStatus == BodyStatus.InAir || - Mover.UseMobMovement(((IComponent) body).Owner)) continue; + Mover.UseMobMovement(body.Owner)) continue; var surfaceFriction = GetTileFriction(body); var bodyModifier = IoCManager.Resolve().GetComponentOrNull(body.Owner)?.Modifier ?? 1.0f; diff --git a/Content.Shared/Movement/EntitySystems/SlowContactsSystem.cs b/Content.Shared/Movement/EntitySystems/SlowContactsSystem.cs index 8e28e61db6..667f91b67e 100644 --- a/Content.Shared/Movement/EntitySystems/SlowContactsSystem.cs +++ b/Content.Shared/Movement/EntitySystems/SlowContactsSystem.cs @@ -36,7 +36,7 @@ public class SlowContactsSystem : EntitySystem foreach (var colliding in _physics.GetCollidingEntities(physicsComponent)) { - var ent = ((IComponent) colliding).Owner; + var ent = colliding.Owner; if (!EntityManager.TryGetComponent(ent, out var slowContactsComponent)) continue; @@ -49,7 +49,7 @@ public class SlowContactsSystem : EntitySystem private void OnEntityExit(EntityUid uid, SlowContactsComponent component, EndCollideEvent args) { - var otherUid = ((IComponent) args.OtherFixture.Body).Owner; + var otherUid = args.OtherFixture.Body.Owner; if (!EntityManager.HasComponent(otherUid) || !EntityManager.HasComponent(otherUid)) return; @@ -64,7 +64,7 @@ public class SlowContactsSystem : EntitySystem private void OnEntityEnter(EntityUid uid, SlowContactsComponent component, StartCollideEvent args) { - var otherUid = ((IComponent) args.OtherFixture.Body).Owner; + var otherUid = args.OtherFixture.Body.Owner; if (!EntityManager.HasComponent(otherUid)) return; if (!_statusCapableInContact.ContainsKey(otherUid)) diff --git a/Content.Shared/Movement/SharedMoverController.cs b/Content.Shared/Movement/SharedMoverController.cs index d5dfbc0cfa..7abec6b40c 100644 --- a/Content.Shared/Movement/SharedMoverController.cs +++ b/Content.Shared/Movement/SharedMoverController.cs @@ -167,7 +167,7 @@ namespace Content.Shared.Movement IoCManager.Resolve().HasComponent(body.Owner) && // If we're being pulled then don't mess with our velocity. (!IoCManager.Resolve().TryGetComponent(body.Owner, out SharedPullableComponent? pullable) || !pullable.BeingPulled) && - _blocker.CanMove(((IComponent) body).Owner); + _blocker.CanMove((body).Owner); } /// diff --git a/Content.Shared/Pulling/Systems/SharedPullerSystem.cs b/Content.Shared/Pulling/Systems/SharedPullerSystem.cs index bbe212ce9e..d69fca7773 100644 --- a/Content.Shared/Pulling/Systems/SharedPullerSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullerSystem.cs @@ -47,7 +47,7 @@ namespace Content.Shared.Pulling.Systems if (args.Puller.Owner != uid) return; - if (IoCManager.Resolve().TryGetComponent(component.Owner, out SharedAlertsComponent? alerts)) + if (EntityManager.TryGetComponent(component.Owner, out SharedAlertsComponent? alerts)) alerts.ShowAlert(AlertType.Pulling); RefreshMovementSpeed(component); @@ -61,7 +61,7 @@ namespace Content.Shared.Pulling.Systems if (args.Puller.Owner != uid) return; - if (IoCManager.Resolve().TryGetComponent(component.Owner, out SharedAlertsComponent? alerts)) + if (EntityManager.TryGetComponent(component.Owner, out SharedAlertsComponent? alerts)) alerts.ClearAlert(AlertType.Pulling); RefreshMovementSpeed(component); @@ -74,7 +74,7 @@ namespace Content.Shared.Pulling.Systems private void RefreshMovementSpeed(SharedPullerComponent component) { - _movementSpeedModifierSystem.RefreshMovementSpeedModifiers(((IComponent) component).Owner); + _movementSpeedModifierSystem.RefreshMovementSpeedModifiers((component).Owner); } } } diff --git a/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs index 010ee42fc7..54726c7fac 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs @@ -36,14 +36,14 @@ namespace Content.Shared.Pulling // They do not expect to be cancellable. private void ForceDisconnect(SharedPullerComponent puller, SharedPullableComponent pullable) { - var pullerPhysics = IoCManager.Resolve().GetComponent(puller.Owner); - var pullablePhysics = IoCManager.Resolve().GetComponent(pullable.Owner); + var pullerPhysics = EntityManager.GetComponent(puller.Owner); + var pullablePhysics = EntityManager.GetComponent(pullable.Owner); // MovingTo shutdown ForceSetMovingTo(pullable, null); // Joint shutdown - if (IoCManager.Resolve().TryGetComponent(puller.Owner, out var jointComp)) + if (EntityManager.TryGetComponent(puller.Owner, out var jointComp)) { if (jointComp.GetJoints.Contains(pullable.PullJoint!)) { @@ -59,10 +59,10 @@ namespace Content.Shared.Pulling // Messaging var message = new PullStoppedMessage(pullerPhysics, pullablePhysics); - RaiseLocalEvent(((IComponent) puller).Owner, message, broadcast: false); + RaiseLocalEvent(puller.Owner, message, broadcast: false); - if ((!IoCManager.Resolve().EntityExists(pullable.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(pullable.Owner).EntityLifeStage) <= EntityLifeStage.MapInitialized) - RaiseLocalEvent(((IComponent) pullable).Owner, message); + if ((!EntityManager.EntityExists(pullable.Owner) ? EntityLifeStage.Deleted : EntityManager.GetComponent(pullable.Owner).EntityLifeStage) <= EntityLifeStage.MapInitialized) + RaiseLocalEvent(pullable.Owner, message); // Networking puller.Dirty(); @@ -81,22 +81,22 @@ namespace Content.Shared.Pulling var pullableOldPullerE = pullable?.Puller; if (pullableOldPullerE != null) { - ForceDisconnect(IoCManager.Resolve().GetComponent(pullableOldPullerE.Value), pullable!); + ForceDisconnect(EntityManager.GetComponent(pullableOldPullerE.Value), pullable!); } // Continue with the puller. var pullerOldPullableE = puller?.Pulling; if (pullerOldPullableE != null) { - ForceDisconnect(puller!, IoCManager.Resolve().GetComponent(pullerOldPullableE.Value)); + ForceDisconnect(puller!, EntityManager.GetComponent(pullerOldPullableE.Value)); } // And now for the actual connection (if any). if ((puller != null) && (pullable != null)) { - var pullerPhysics = IoCManager.Resolve().GetComponent(puller.Owner); - var pullablePhysics = IoCManager.Resolve().GetComponent(pullable.Owner); + var pullerPhysics = EntityManager.GetComponent(puller.Owner); + var pullablePhysics = EntityManager.GetComponent(pullable.Owner); // State startup puller.Pulling = pullable.Owner; @@ -106,7 +106,7 @@ namespace Content.Shared.Pulling var union = pullerPhysics.GetWorldAABB().Union(pullablePhysics.GetWorldAABB()); var length = Math.Max(union.Size.X, union.Size.Y) * 0.75f; - pullable.PullJoint = _jointSystem.CreateDistanceJoint(((IComponent) pullablePhysics).Owner, pullerPhysics.Owner, id:$"pull-joint-{pullablePhysics.Owner}"); + pullable.PullJoint = _jointSystem.CreateDistanceJoint(pullablePhysics.Owner, pullerPhysics.Owner, id:$"pull-joint-{pullablePhysics.Owner}"); pullable.PullJoint.CollideConnected = false; // This maximum has to be there because if the object is constrained too closely, the clamping goes backwards and asserts. pullable.PullJoint.MaxLength = Math.Max(1.0f, length); @@ -117,8 +117,8 @@ namespace Content.Shared.Pulling // Messaging var message = new PullStartedMessage(pullerPhysics, pullablePhysics); - RaiseLocalEvent(((IComponent) puller).Owner, message, broadcast: false); - RaiseLocalEvent(((IComponent) pullable).Owner, message); + RaiseLocalEvent(puller.Owner, message, broadcast: false); + RaiseLocalEvent(pullable.Owner, message); // Networking puller.Dirty(); diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs index ec95444c85..a5cb4d11b9 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs @@ -29,7 +29,7 @@ namespace Content.Shared.Pulling public bool CanPull(EntityUid puller, EntityUid pulled) { - if (!IoCManager.Resolve().HasComponent(puller)) + if (!EntityManager.HasComponent(puller)) { return false; } @@ -39,7 +39,7 @@ namespace Content.Shared.Pulling return false; } - if (!IoCManager.Resolve().TryGetComponent(pulled, out var _physics)) + if (!EntityManager.TryGetComponent(pulled, out var _physics)) { return false; } @@ -59,7 +59,7 @@ namespace Content.Shared.Pulling return false; } - if (IoCManager.Resolve().TryGetComponent(puller, out var buckle)) + if (EntityManager.TryGetComponent(puller, out var buckle)) { // Prevent people pulling the chair they're on, etc. if (buckle.Buckled && (buckle.LastEntityBuckledTo == pulled)) @@ -92,7 +92,7 @@ namespace Content.Shared.Pulling } var msg = new StopPullingEvent(user); - RaiseLocalEvent(((IComponent) pullable).Owner, msg); + RaiseLocalEvent(pullable.Owner, msg); if (msg.Cancelled) return false; @@ -173,14 +173,14 @@ namespace Content.Shared.Pulling var pullAttempt = new PullAttemptMessage(pullerPhysics, pullablePhysics); - RaiseLocalEvent(((IComponent) puller).Owner, pullAttempt, broadcast: false); + RaiseLocalEvent(puller.Owner, pullAttempt, broadcast: false); if (pullAttempt.Cancelled) { return false; } - RaiseLocalEvent(((IComponent) pullable).Owner, pullAttempt); + RaiseLocalEvent(pullable.Owner, pullAttempt); if (pullAttempt.Cancelled) { @@ -198,7 +198,7 @@ namespace Content.Shared.Pulling return false; } - if (!IoCManager.Resolve().HasComponent(pullable.Owner)) + if (!EntityManager.HasComponent(pullable.Owner)) { return false; } diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs index 77437d1f27..256f3bb918 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs @@ -164,7 +164,7 @@ namespace Content.Shared.Pulling // The pulled object may have already been deleted. // TODO: Work out why. Monkey + meat spike is a good test for this, // assuming you're still pulling the monkey when it gets gibbed. - if ((!EntityManager.EntityExists(pulled.Value) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(pulled.Value).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!EntityManager.EntityExists(pulled.Value) ? EntityLifeStage.Deleted : EntityManager.GetComponent(pulled.Value).EntityLifeStage) >= EntityLifeStage.Deleted) { return; } @@ -249,16 +249,18 @@ namespace Content.Shared.Pulling private void UpdatePulledRotation(EntityUid puller, EntityUid pulled) { // TODO: update once ComponentReference works with directed event bus. - if (!IoCManager.Resolve().TryGetComponent(pulled, out RotatableComponent? rotatable)) + if (!EntityManager.TryGetComponent(pulled, out RotatableComponent? rotatable)) return; if (!rotatable.RotateWhilePulling) return; - var dir = IoCManager.Resolve().GetComponent(puller).WorldPosition - IoCManager.Resolve().GetComponent(pulled).WorldPosition; + var pulledXform = EntityManager.GetComponent(pulled); + + var dir = EntityManager.GetComponent(puller).WorldPosition - pulledXform.WorldPosition; if (dir.LengthSquared > ThresholdRotDistance * ThresholdRotDistance) { - var oldAngle = IoCManager.Resolve().GetComponent(pulled).WorldRotation; + var oldAngle = pulledXform.WorldRotation; var newAngle = Angle.FromWorldVec(dir); var diff = newAngle - oldAngle; @@ -268,10 +270,10 @@ namespace Content.Shared.Pulling // Otherwise PIANO DOOR STUCK! happens. // But it also needs to work with station rotation / align to the local parent. // So... - var baseRotation = IoCManager.Resolve().GetComponent(pulled).Parent?.WorldRotation ?? 0f; + var baseRotation = pulledXform.Parent?.WorldRotation ?? 0f; var localRotation = newAngle - baseRotation; var localRotationSnapped = Angle.FromDegrees(Math.Floor((localRotation.Degrees / ThresholdRotAngle) + 0.5f) * ThresholdRotAngle); - IoCManager.Resolve().GetComponent(pulled).LocalRotation = localRotationSnapped; + pulledXform.LocalRotation = localRotationSnapped; } } } diff --git a/Content.Shared/Slippery/SharedSlipperySystem.cs b/Content.Shared/Slippery/SharedSlipperySystem.cs index a02edda17d..091bc4cff7 100644 --- a/Content.Shared/Slippery/SharedSlipperySystem.cs +++ b/Content.Shared/Slippery/SharedSlipperySystem.cs @@ -32,7 +32,7 @@ namespace Content.Shared.Slippery private void HandleCollide(EntityUid uid, SlipperyComponent component, StartCollideEvent args) { - var otherUid = ((IComponent) args.OtherFixture.Body).Owner; + var otherUid = args.OtherFixture.Body.Owner; if (!CanSlip(component, otherUid)) return; diff --git a/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs b/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs index a290b0124e..b1715fdfdc 100644 --- a/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs @@ -21,7 +21,7 @@ namespace Content.Shared.Storage.EntitySystems private void CounterEntityInserted(EntityUid uid, ItemCounterComponent itemCounter, EntInsertedIntoContainerMessage args) { - if (!IoCManager.Resolve().TryGetComponent(itemCounter.Owner, out AppearanceComponent? appearanceComponent)) return; + if (!EntityManager.TryGetComponent(itemCounter.Owner, out AppearanceComponent? appearanceComponent)) return; var count = GetCount(args, itemCounter); if (count == null) @@ -36,7 +36,7 @@ namespace Content.Shared.Storage.EntitySystems private void CounterEntityRemoved(EntityUid uid, ItemCounterComponent itemCounter, EntRemovedFromContainerMessage args) { - if (!IoCManager.Resolve().TryGetComponent(itemCounter.Owner, out AppearanceComponent? appearanceComponent)) return; + if (!EntityManager.TryGetComponent(itemCounter.Owner, out AppearanceComponent? appearanceComponent)) return; var count = GetCount(args, itemCounter); if (count == null) diff --git a/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs b/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs index e0ae4520ce..5aabe3afb7 100644 --- a/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs @@ -21,7 +21,7 @@ namespace Content.Shared.Storage.EntitySystems private void InitLayers(EntityUid uid, ItemMapperComponent component, ComponentInit args) { - if (IoCManager.Resolve().TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent)) + if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent)) { var list = new List(component.MapLayers.Keys); appearanceComponent.SetData(StorageMapVisuals.InitLayers, new ShowLayerData(list)); @@ -31,7 +31,7 @@ namespace Content.Shared.Storage.EntitySystems private void MapperEntityRemoved(EntityUid uid, ItemMapperComponent itemMapper, EntRemovedFromContainerMessage args) { - if (IoCManager.Resolve().TryGetComponent(itemMapper.Owner, out AppearanceComponent? appearanceComponent) + if (EntityManager.TryGetComponent(itemMapper.Owner, out AppearanceComponent? appearanceComponent) && TryGetLayers(args, itemMapper, out var containedLayers)) { appearanceComponent.SetData(StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers)); @@ -41,7 +41,7 @@ namespace Content.Shared.Storage.EntitySystems private void MapperEntityInserted(EntityUid uid, ItemMapperComponent itemMapper, EntInsertedIntoContainerMessage args) { - if (IoCManager.Resolve().TryGetComponent(itemMapper.Owner, out AppearanceComponent? appearanceComponent) + if (EntityManager.TryGetComponent(itemMapper.Owner, out AppearanceComponent? appearanceComponent) && TryGetLayers(args, itemMapper, out var containedLayers)) { appearanceComponent.SetData(StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers)); diff --git a/Content.Shared/Throwing/ThrownItemSystem.cs b/Content.Shared/Throwing/ThrownItemSystem.cs index bcc1384ffd..ea23a03576 100644 --- a/Content.Shared/Throwing/ThrownItemSystem.cs +++ b/Content.Shared/Throwing/ThrownItemSystem.cs @@ -54,7 +54,7 @@ namespace Content.Shared.Throwing private void ThrowItem(EntityUid uid, ThrownItemComponent component, ThrownEvent args) { - if (!IoCManager.Resolve().TryGetComponent(component.Owner, out PhysicsComponent? physicsComponent) || + if (!EntityManager.TryGetComponent(component.Owner, out PhysicsComponent? physicsComponent) || physicsComponent.Fixtures.Count != 1) return; if (_fixtures.GetFixtureOrNull(physicsComponent, ThrowingFixture) != null) @@ -114,13 +114,13 @@ namespace Content.Shared.Throwing public void LandComponent(ThrownItemComponent thrownItem) { - if (thrownItem.Deleted || (!IoCManager.Resolve().EntityExists(thrownItem.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(thrownItem.Owner).EntityLifeStage) >= EntityLifeStage.Deleted || _containerSystem.IsEntityInContainer(thrownItem.Owner)) return; + if (thrownItem.Deleted || (!EntityManager.EntityExists(thrownItem.Owner) ? EntityLifeStage.Deleted : EntityManager.GetComponent(thrownItem.Owner).EntityLifeStage) >= EntityLifeStage.Deleted || _containerSystem.IsEntityInContainer(thrownItem.Owner)) return; var landing = thrownItem.Owner; // Unfortunately we can't check for hands containers as they have specific names. if (thrownItem.Owner.TryGetContainerMan(out var containerManager) && - IoCManager.Resolve().HasComponent(containerManager.Owner)) + EntityManager.HasComponent(containerManager.Owner)) { EntityManager.RemoveComponent(landing, thrownItem); return;