From 0be5ff829b79373a751b6b41db4a34d8fa3a3bd5 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> Date: Tue, 28 Sep 2021 13:35:29 +0200 Subject: [PATCH] Gets rid of all ComponentManager usages. (#4707) --- ...ts.cs => EntityManagerGetAllComponents.cs} | 27 +++++------ Content.Client/Camera/CameraRecoilSystem.cs | 2 +- Content.Client/Commands/DebugCommands.cs | 2 +- .../Commands/HideMechanismsCommand.cs | 4 +- .../Commands/ShowMechanismsCommand.cs | 4 +- Content.Client/DoAfter/DoAfterSystem.cs | 2 +- Content.Client/Ghost/GhostSystem.cs | 2 +- .../HealthOverlay/HealthOverlaySystem.cs | 2 +- .../IconSmoothing/IconSmoothComponent.cs | 2 +- .../IconSmoothing/IconSmoothSystem.cs | 4 +- .../Instruments/InstrumentSystem.cs | 2 +- .../Items/Managers/ItemSlotManager.cs | 3 +- Content.Client/Light/EmergencyLightSystem.cs | 2 +- Content.Client/Markers/MarkerSystem.cs | 2 +- Content.Client/Popups/PopupSystem.cs | 2 +- .../Singularity/SingularityOverlay.cs | 3 +- .../StationEvents/RadiationPulseOverlay.cs | 4 +- Content.Client/Tabletop/TabletopSystem.cs | 4 +- .../Wall/Components/LowWallComponent.cs | 4 +- .../Weapons/Melee/MeleeLungeSystem.cs | 2 +- .../Weapons/Melee/MeleeWeaponSystem.cs | 2 +- Content.Client/Window/WindowComponent.cs | 2 +- Content.Client/Window/WindowVisualizer.cs | 2 +- Content.IntegrationTests/Tests/EntityTest.cs | 4 +- .../AI/EntitySystems/AiFactionTagSystem.cs | 2 +- Content.Server/AI/Utils/Visibility.cs | 2 +- Content.Server/AME/AntimatterEngineSystem.cs | 2 +- .../AME/Components/AMEPartComponent.cs | 2 +- .../Commands/DeleteComponent.cs | 4 +- .../Commands/DeleteEntitiesWithComponent.cs | 2 +- .../Commands/FindEntitiesWithComponents.cs | 2 +- .../Commands/RemoveExtraComponents.cs | 2 +- .../Administration/Commands/WarpCommand.cs | 13 +++-- Content.Server/Advertise/AdvertiseSystem.cs | 2 +- Content.Server/Arcade/BlockGameSystem.cs | 2 +- .../EntitySystems/AtmosphereSystem.Grid.cs | 48 +++++++++---------- .../AtmosphereSystem.Monstermos.cs | 6 +-- .../AtmosphereSystem.Processing.cs | 2 +- .../Atmos/EntitySystems/AtmosphereSystem.cs | 2 +- .../Atmos/EntitySystems/BarotraumaSystem.cs | 2 +- .../Atmos/EntitySystems/FlammableSystem.cs | 6 +-- .../Atmos/EntitySystems/GasAnalyzerSystem.cs | 2 +- .../Atmos/EntitySystems/GasTankSystem.cs | 2 +- .../GasDualPortVentPumpSystem.cs | 4 +- .../EntitySystems/GasPassiveGateSystem.cs | 2 +- .../EntitySystems/GasPressurePumpSystem.cs | 4 +- .../Binary/EntitySystems/GasValveSystem.cs | 2 +- .../EntitySystems/GasVolumePumpSystem.cs | 4 +- .../EntitySystems/AtmosPipeColorSystem.cs | 6 +-- .../AtmosUnsafeUnanchorSystem.cs | 4 +- .../Trinary/EntitySystems/GasFilterSystem.cs | 4 +- .../Trinary/EntitySystems/GasMixerSystem.cs | 2 +- .../Unary/EntitySystems/GasCanisterSystem.cs | 16 +++---- .../EntitySystems/GasOutletInjectorSystem.cs | 2 +- .../EntitySystems/GasPassiveVentSystem.cs | 2 +- .../Unary/EntitySystems/GasPortableSystem.cs | 12 ++--- .../EntitySystems/GasThermoMachineSystem.cs | 4 +- .../Unary/EntitySystems/GasVentPumpSystem.cs | 4 +- .../EntitySystems/GasVentScrubberSystem.cs | 4 +- Content.Server/Audio/AmbientSoundSystem.cs | 2 +- Content.Server/Body/BodySystem.cs | 4 +- .../Body/Metabolism/MetabolizerSystem.cs | 2 +- .../Body/Respiratory/RespiratorSystem.cs | 2 +- Content.Server/Buckle/BuckleSystem.cs | 2 +- Content.Server/Cargo/CargoConsoleSystem.cs | 2 +- .../Components/SolutionAreaEffectComponent.cs | 4 +- .../EntitySystems/SolutionAreaEffectSystem.cs | 2 +- .../Chemistry/EntitySystems/VaporSystem.cs | 4 +- Content.Server/Cloning/CloningSystem.cs | 4 +- .../Systems/DamageOnHighSpeedImpactSystem.cs | 4 +- .../Tube/Components/DisposalTubeComponent.cs | 2 +- .../Unit/EntitySystems/DisposableSystem.cs | 2 +- .../Unit/EntitySystems/DisposalUnitSystem.cs | 10 ++-- Content.Server/DoAfter/DoAfterSystem.cs | 2 +- Content.Server/Explosion/TriggerSystem.cs | 2 +- Content.Server/Flash/FlashSystem.cs | 6 +-- .../Fluids/Components/PuddleComponent.cs | 4 +- Content.Server/Fluids/PuddleSystem.cs | 4 +- .../GameTicking/GameTicker.Spawning.cs | 6 +-- .../Presets/PresetTraitorDeathMatch.cs | 6 +-- Content.Server/Ghost/GhostSystem.cs | 8 ++-- .../Gravity/EntitySystems/GravitySystem.cs | 6 +-- .../Hands/Systems/HandVirtualItemSystem.cs | 10 ++-- .../Instruments/InstrumentSystem.cs | 2 +- Content.Server/Jobs/AddComponentSpecial.cs | 2 +- .../Kitchen/EntitySystems/MicrowaveSystem.cs | 2 +- Content.Server/Lathe/LatheSystem.cs | 2 +- .../EntitySystems/ExpendableLightSystem.cs | 2 +- .../System/TwoWayLeverSystem.cs | 4 +- .../Medical/MedicalScannerSystem.cs | 2 +- Content.Server/Morgue/MorgueSystem.cs | 2 +- .../Movement/StressTestMovementSystem.cs | 2 +- .../EntitySystems/NodeGroupSystem.cs | 2 +- .../NodeContainer/Nodes/AdjacentNode.cs | 4 +- .../NodeContainer/Nodes/NodeHelpers.cs | 8 ++-- .../NodeContainer/Nodes/PipeNode.cs | 4 +- .../Nutrition/EntitySystems/HungerSystem.cs | 2 +- .../EntitySystems/SmokingSystem.Cigar.cs | 4 +- .../Nutrition/EntitySystems/SmokingSystem.cs | 2 +- .../Nutrition/EntitySystems/ThirstSystem.cs | 2 +- .../Conditions/KillRandomPersonCondition.cs | 2 +- .../ParticleAcceleratorControlBoxComponent.cs | 4 +- .../Physics/Controllers/ConveyorController.cs | 2 +- .../Physics/Controllers/MoverController.cs | 8 ++-- .../Controllers/SingularityController.cs | 2 +- Content.Server/Plants/PlantSystem.cs | 3 +- .../Pointing/EntitySystems/PointingSystem.cs | 2 +- .../EntitySystems/RoguePointingSystem.cs | 2 +- .../Power/Components/CablePlacerComponent.cs | 2 +- .../Power/DrainAllBatteriesCommand.cs | 4 +- .../Power/EntitySystems/BaseChargerSystem.cs | 2 +- .../Power/EntitySystems/BatterySystem.cs | 6 +-- .../Power/EntitySystems/CableVisSystem.cs | 8 ++-- .../Power/EntitySystems/PowerApcSystem.cs | 2 +- .../Power/EntitySystems/PowerNetSystem.cs | 4 +- Content.Server/Power/Nodes/CableDeviceNode.cs | 4 +- Content.Server/Power/Nodes/CableNode.cs | 4 +- .../Power/Nodes/CableTerminalNode.cs | 4 +- .../Power/Nodes/CableTerminalPortNode.cs | 4 +- Content.Server/Power/SMES/PowerSmesSystem.cs | 2 +- .../Projectiles/ProjectileSystem.cs | 2 +- .../Radiation/RadiationPulseSystem.cs | 2 +- .../Radio/EntitySystems/ListeningSystem.cs | 2 +- .../Radio/EntitySystems/RadioSystem.cs | 2 +- Content.Server/Research/ResearchSystem.cs | 2 +- .../Shuttles/ShuttleConsoleSystem.cs | 4 +- .../EntitySystems/SingularitySystem.cs | 4 +- .../StartSingularityEngineCommand.cs | 6 +-- .../PowerSolarControlConsoleSystem.cs | 2 +- .../Solar/EntitySystems/PowerSolarSystem.cs | 2 +- .../EntitySystems/ConditionalSpawnerSystem.cs | 2 +- Content.Server/Speech/AccentManager.cs | 4 +- .../StationEvents/Events/MeteorSwarm.cs | 5 +- .../StationEvents/Events/PowerGridCheck.cs | 4 +- .../CursedEntityStorageComponent.cs | 2 +- .../Storage/EntitySystems/StorageSystem.cs | 4 +- Content.Server/Stunnable/StunbatonSystem.cs | 8 ++-- .../Tabletop/TabletopSystem.Draggable.cs | 6 +-- Content.Server/Tabletop/TabletopSystem.Map.cs | 2 +- .../Tabletop/TabletopSystem.Session.cs | 6 +-- Content.Server/Tabletop/TabletopSystem.cs | 6 +-- .../Weapon/Melee/MeleeWeaponSystem.cs | 2 +- Content.Server/Wieldable/WieldableSystem.cs | 8 ++-- Content.Shared/Actions/SharedActionSystem.cs | 2 +- .../Audio/SharedAmbientSoundSystem.cs | 2 +- .../Body/Mechanism/MechanismSystem.cs | 2 +- .../SolutionContainerSystem.Capabilities.cs | 22 ++++----- .../EntitySystems/SolutionContainerSystem.cs | 4 +- .../MetabolismMovespeedModifierSystem.cs | 6 +-- Content.Shared/Cuffs/SharedCuffableSystem.cs | 2 +- Content.Shared/Damage/DamageableSystem.cs | 2 +- .../Disposal/SharedDisposalUnitSystem.cs | 4 +- .../EntitySystems/SharedCreamPieSystem.cs | 4 +- .../Pulling/Systems/SharedPullerSystem.cs | 2 +- .../Slippery/SharedSlipperySystem.cs | 4 +- Content.Shared/Stunnable/StunSystem.cs | 2 +- Content.Shared/SubFloor/SubFloorHideSystem.cs | 16 +++---- Content.Shared/Throwing/ThrownItemSystem.cs | 4 +- 158 files changed, 321 insertions(+), 333 deletions(-) rename Content.Benchmarks/{ComponentManagerGetAllComponents.cs => EntityManagerGetAllComponents.cs} (73%) diff --git a/Content.Benchmarks/ComponentManagerGetAllComponents.cs b/Content.Benchmarks/EntityManagerGetAllComponents.cs similarity index 73% rename from Content.Benchmarks/ComponentManagerGetAllComponents.cs rename to Content.Benchmarks/EntityManagerGetAllComponents.cs index edddabf146..25107662c7 100644 --- a/Content.Benchmarks/ComponentManagerGetAllComponents.cs +++ b/Content.Benchmarks/EntityManagerGetAllComponents.cs @@ -5,21 +5,20 @@ using Robust.Shared.Exceptions; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Log; +using Robust.Shared.Map; using Robust.Shared.Reflection; namespace Content.Benchmarks { - public class ComponentManagerGetAllComponents + public class EntityManagerGetAllComponents { - private readonly List _entities = new(); - - private IComponentManager _componentManager; + private IEntityManager _entityManager; [Params(5000)] public int N { get; set; } public static void TestRun() { - var x = new ComponentManagerGetAllComponents + var x = new EntityManagerGetAllComponents { N = 500 }; @@ -33,13 +32,11 @@ namespace Content.Benchmarks // Initialize component manager. IoCManager.InitThread(); - IoCManager.Register(); + IoCManager.Register(); IoCManager.Register(); IoCManager.Register(); IoCManager.Register(); IoCManager.Register(); - var entityManager = new Mock().Object; - IoCManager.RegisterInstance(entityManager); IoCManager.RegisterInstance(new Mock().Object); var dummyReg = new Mock(); @@ -56,16 +53,14 @@ namespace Content.Benchmarks IoCManager.RegisterInstance(componentFactory.Object); IoCManager.BuildGraph(); - _componentManager = IoCManager.Resolve(); - _componentManager.Initialize(); + _entityManager = IoCManager.Resolve(); + _entityManager.Initialize(); // Initialize N entities with one component. for (var i = 0; i < N; i++) { - var entity = new Entity(entityManager, new EntityUid(i + 1)); - _entities.Add(entity); - - _componentManager.AddComponent(entity); + var entity = _entityManager.SpawnEntity(null, EntityCoordinates.Invalid); + _entityManager.AddComponent(entity); } } @@ -74,7 +69,7 @@ namespace Content.Benchmarks { var count = 0; - foreach (var _ in _componentManager.EntityQuery(true)) + foreach (var _ in _entityManager.EntityQuery(true)) { count += 1; } @@ -87,7 +82,7 @@ namespace Content.Benchmarks { var count = 0; - _componentManager.TryGetComponent(default, out DummyComponent _); + _entityManager.TryGetComponent(default, out DummyComponent _); return count; } diff --git a/Content.Client/Camera/CameraRecoilSystem.cs b/Content.Client/Camera/CameraRecoilSystem.cs index e84a0ee78a..8a5c701db7 100644 --- a/Content.Client/Camera/CameraRecoilSystem.cs +++ b/Content.Client/Camera/CameraRecoilSystem.cs @@ -10,7 +10,7 @@ namespace Content.Client.Camera { base.FrameUpdate(frameTime); - foreach (var recoil in EntityManager.ComponentManager.EntityQuery(true)) + foreach (var recoil in EntityManager.EntityQuery(true)) { recoil.FrameUpdate(frameTime); } diff --git a/Content.Client/Commands/DebugCommands.cs b/Content.Client/Commands/DebugCommands.cs index 4982f33bc4..33e44930ed 100644 --- a/Content.Client/Commands/DebugCommands.cs +++ b/Content.Client/Commands/DebugCommands.cs @@ -50,7 +50,7 @@ namespace Content.Client.Commands EntitySystem.Get() .ShowAll = true; - var components = IoCManager.Resolve().ComponentManager + var components = IoCManager.Resolve() .EntityQuery(true); foreach (var component in components) diff --git a/Content.Client/Commands/HideMechanismsCommand.cs b/Content.Client/Commands/HideMechanismsCommand.cs index 84d18854ee..6ee7eef082 100644 --- a/Content.Client/Commands/HideMechanismsCommand.cs +++ b/Content.Client/Commands/HideMechanismsCommand.cs @@ -16,8 +16,8 @@ namespace Content.Client.Commands public void Execute(IConsoleShell shell, string argStr, string[] args) { - var componentManager = IoCManager.Resolve(); - var mechanisms = componentManager.EntityQuery(true); + var entityManager = IoCManager.Resolve(); + var mechanisms = entityManager.EntityQuery(true); foreach (var mechanism in mechanisms) { diff --git a/Content.Client/Commands/ShowMechanismsCommand.cs b/Content.Client/Commands/ShowMechanismsCommand.cs index 19a4aacf00..07a7dd5785 100644 --- a/Content.Client/Commands/ShowMechanismsCommand.cs +++ b/Content.Client/Commands/ShowMechanismsCommand.cs @@ -18,8 +18,8 @@ namespace Content.Client.Commands public void Execute(IConsoleShell shell, string argStr, string[] args) { - var componentManager = IoCManager.Resolve(); - var mechanisms = componentManager.EntityQuery(true); + var entityManager = IoCManager.Resolve(); + var mechanisms = entityManager.EntityQuery(true); foreach (var mechanism in mechanisms) { diff --git a/Content.Client/DoAfter/DoAfterSystem.cs b/Content.Client/DoAfter/DoAfterSystem.cs index ab747fe1ef..5f03cae7bf 100644 --- a/Content.Client/DoAfter/DoAfterSystem.cs +++ b/Content.Client/DoAfter/DoAfterSystem.cs @@ -56,7 +56,7 @@ namespace Content.Client.DoAfter var viewbox = _eyeManager.GetWorldViewport().Enlarged(2.0f); - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { var doAfters = comp.DoAfters.ToList(); var compPos = comp.Owner.Transform.WorldPosition; diff --git a/Content.Client/Ghost/GhostSystem.cs b/Content.Client/Ghost/GhostSystem.cs index 65ffefca1a..ca528e99b2 100644 --- a/Content.Client/Ghost/GhostSystem.cs +++ b/Content.Client/Ghost/GhostSystem.cs @@ -30,7 +30,7 @@ namespace Content.Client.Ghost _ghostVisibility = value; - foreach (var ghost in ComponentManager.GetAllComponents(typeof(GhostComponent), true)) + foreach (var ghost in EntityManager.GetAllComponents(typeof(GhostComponent), true)) { if (ghost.Owner.TryGetComponent(out SpriteComponent? sprite)) { diff --git a/Content.Client/HealthOverlay/HealthOverlaySystem.cs b/Content.Client/HealthOverlay/HealthOverlaySystem.cs index 74414b0bed..70c2d659c7 100644 --- a/Content.Client/HealthOverlay/HealthOverlaySystem.cs +++ b/Content.Client/HealthOverlay/HealthOverlaySystem.cs @@ -79,7 +79,7 @@ namespace Content.Client.HealthOverlay var viewBox = _eyeManager.GetWorldViewport().Enlarged(2.0f); - foreach (var (mobState, _) in ComponentManager.EntityQuery()) + foreach (var (mobState, _) in EntityManager.EntityQuery()) { var entity = mobState.Owner; diff --git a/Content.Client/IconSmoothing/IconSmoothComponent.cs b/Content.Client/IconSmoothing/IconSmoothComponent.cs index 02c608f53f..deb8113c45 100644 --- a/Content.Client/IconSmoothing/IconSmoothComponent.cs +++ b/Content.Client/IconSmoothing/IconSmoothComponent.cs @@ -278,7 +278,7 @@ namespace Content.Client.IconSmoothing { foreach (var entity in candidates) { - if (!Owner.EntityManager.ComponentManager.TryGetComponent(entity, out IconSmoothComponent? other)) + if (!Owner.EntityManager.TryGetComponent(entity, out IconSmoothComponent? other)) { continue; } diff --git a/Content.Client/IconSmoothing/IconSmoothSystem.cs b/Content.Client/IconSmoothing/IconSmoothSystem.cs index 1fc6a34c0c..eefbc01e8a 100644 --- a/Content.Client/IconSmoothing/IconSmoothSystem.cs +++ b/Content.Client/IconSmoothing/IconSmoothSystem.cs @@ -100,7 +100,7 @@ namespace Content.Client.IconSmoothing { foreach (var entity in candidates) { - if (ComponentManager.HasComponent(entity)) + if (EntityManager.HasComponent(entity)) { _dirtyEntities.Enqueue(entity); } @@ -113,7 +113,7 @@ namespace Content.Client.IconSmoothing // As it stands now, it's totally possible for something to get queued twice. // Generation on the component is set after an update so we can cull updates that happened this generation. if (!EntityManager.EntityExists(euid) - || !ComponentManager.TryGetComponent(euid, out IconSmoothComponent? smoothing) + || !EntityManager.TryGetComponent(euid, out IconSmoothComponent? smoothing) || smoothing.UpdateGeneration == _generation) { return; diff --git a/Content.Client/Instruments/InstrumentSystem.cs b/Content.Client/Instruments/InstrumentSystem.cs index 837dd87487..7e987b380d 100644 --- a/Content.Client/Instruments/InstrumentSystem.cs +++ b/Content.Client/Instruments/InstrumentSystem.cs @@ -44,7 +44,7 @@ namespace Content.Client.Instruments return; } - foreach (var instrumentComponent in EntityManager.ComponentManager.EntityQuery(true)) + foreach (var instrumentComponent in EntityManager.EntityQuery(true)) { instrumentComponent.Update(frameTime); } diff --git a/Content.Client/Items/Managers/ItemSlotManager.cs b/Content.Client/Items/Managers/ItemSlotManager.cs index 3e058a58dd..9e0be4bda9 100644 --- a/Content.Client/Items/Managers/ItemSlotManager.cs +++ b/Content.Client/Items/Managers/ItemSlotManager.cs @@ -28,7 +28,6 @@ namespace Content.Client.Items.Managers [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; [Dependency] private readonly IUserInterfaceManager _uiMgr = default!; [Dependency] private readonly IEntityManager _entityManager = default!; - [Dependency] private readonly IComponentManager _componentManager = default!; private readonly HashSet _highlightEntities = new(); @@ -45,7 +44,7 @@ namespace Content.Client.Items.Managers { ISpriteComponent? sprite; if (entity.TryGetComponent(out HandVirtualItemComponent? virtPull) - && _componentManager.TryGetComponent(virtPull.BlockingEntity, out ISpriteComponent pulledSprite)) + && _entityManager.TryGetComponent(virtPull.BlockingEntity, out ISpriteComponent pulledSprite)) { sprite = pulledSprite; } diff --git a/Content.Client/Light/EmergencyLightSystem.cs b/Content.Client/Light/EmergencyLightSystem.cs index 40e16968b6..eda33353d4 100644 --- a/Content.Client/Light/EmergencyLightSystem.cs +++ b/Content.Client/Light/EmergencyLightSystem.cs @@ -63,7 +63,7 @@ namespace Content.Client.Light private void HandleAnimationComplete(EntityUid uid, EmergencyLightComponent component, AnimationCompletedEvent args) { if (!component.Enabled || - !ComponentManager.TryGetComponent(uid, out var playerComponent)) return; + !EntityManager.TryGetComponent(uid, out var playerComponent)) return; playerComponent.Play(Animation, AnimKey); } diff --git a/Content.Client/Markers/MarkerSystem.cs b/Content.Client/Markers/MarkerSystem.cs index 32e9fdddf3..5355d6bec3 100644 --- a/Content.Client/Markers/MarkerSystem.cs +++ b/Content.Client/Markers/MarkerSystem.cs @@ -18,7 +18,7 @@ namespace Content.Client.Markers private void UpdateMarkers() { - foreach (var markerComponent in EntityManager.ComponentManager.EntityQuery(true)) + foreach (var markerComponent in EntityManager.EntityQuery(true)) { markerComponent.UpdateVisibility(); } diff --git a/Content.Client/Popups/PopupSystem.cs b/Content.Client/Popups/PopupSystem.cs index e4776ff6d4..48cb2faf6a 100644 --- a/Content.Client/Popups/PopupSystem.cs +++ b/Content.Client/Popups/PopupSystem.cs @@ -49,7 +49,7 @@ namespace Content.Client.Popups if (!EntityManager.EntityExists(uid)) return; - var transform = ComponentManager.GetComponent(uid); + var transform = EntityManager.GetComponent(uid); PopupMessage(message, _eyeManager.CoordinatesToScreen(transform.Coordinates)); } diff --git a/Content.Client/Singularity/SingularityOverlay.cs b/Content.Client/Singularity/SingularityOverlay.cs index 119dda3050..cf08b12ff5 100644 --- a/Content.Client/Singularity/SingularityOverlay.cs +++ b/Content.Client/Singularity/SingularityOverlay.cs @@ -13,7 +13,6 @@ namespace Content.Client.Singularity { public class SingularityOverlay : Overlay { - [Dependency] private readonly IComponentManager _componentManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; @@ -73,7 +72,7 @@ namespace Content.Client.Singularity var currentEyeLoc = currentEye.Position; - var distortions = _componentManager.EntityQuery(); + var distortions = _entityManager.EntityQuery(); foreach (var distortion in distortions) //Add all singulos that are not added yet but qualify { var singuloEntity = distortion.Owner; diff --git a/Content.Client/StationEvents/RadiationPulseOverlay.cs b/Content.Client/StationEvents/RadiationPulseOverlay.cs index 94a80fbd0c..b819abf417 100644 --- a/Content.Client/StationEvents/RadiationPulseOverlay.cs +++ b/Content.Client/StationEvents/RadiationPulseOverlay.cs @@ -16,7 +16,7 @@ namespace Content.Client.StationEvents [UsedImplicitly] public sealed class RadiationPulseOverlay : Overlay { - [Dependency] private readonly IComponentManager _componentManager = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; @@ -119,7 +119,7 @@ namespace Content.Client.StationEvents var elapsedTime = (float) (_gameTiming.CurTime - _lastTick).TotalSeconds; _lastTick = _gameTiming.CurTime; - var radiationPulses = _componentManager + var radiationPulses = _entityManager .EntityQuery(true) .ToList(); diff --git a/Content.Client/Tabletop/TabletopSystem.cs b/Content.Client/Tabletop/TabletopSystem.cs index bbd42de706..cd2f9d959e 100644 --- a/Content.Client/Tabletop/TabletopSystem.cs +++ b/Content.Client/Tabletop/TabletopSystem.cs @@ -117,7 +117,7 @@ namespace Content.Client.Tabletop // Get the camera entity that the server has created for us var camera = EntityManager.GetEntity(msg.CameraUid); - if (!ComponentManager.TryGetComponent(camera.Uid, out var eyeComponent)) + if (!EntityManager.TryGetComponent(camera.Uid, out var eyeComponent)) { // If there is no eye, print error and do not open any window Logger.Error("Camera entity does not have eye component!"); @@ -181,7 +181,7 @@ namespace Content.Client.Tabletop } // Make sure that entity can be dragged - if (!ComponentManager.HasComponent(draggedEntity.Uid)) + if (!EntityManager.HasComponent(draggedEntity.Uid)) { return false; } diff --git a/Content.Client/Wall/Components/LowWallComponent.cs b/Content.Client/Wall/Components/LowWallComponent.cs index eb4b8863b3..3743056b54 100644 --- a/Content.Client/Wall/Components/LowWallComponent.cs +++ b/Content.Client/Wall/Components/LowWallComponent.cs @@ -204,7 +204,7 @@ namespace Content.Client.Wall.Components foreach (var entity in grid.GetLocal(coords)) { - if (Owner.EntityManager.ComponentManager.TryGetComponent(entity, out WindowComponent? window)) + if (Owner.EntityManager.TryGetComponent(entity, out WindowComponent? window)) { window.UpdateSprite(); } @@ -216,7 +216,7 @@ namespace Content.Client.Wall.Components { foreach (var entity in candidates) { - if (!Owner.EntityManager.ComponentManager.TryGetComponent(entity, out IconSmoothComponent? other)) + if (!Owner.EntityManager.TryGetComponent(entity, out IconSmoothComponent? other)) { continue; } diff --git a/Content.Client/Weapons/Melee/MeleeLungeSystem.cs b/Content.Client/Weapons/Melee/MeleeLungeSystem.cs index 98b1b5288d..ed3aa0137a 100644 --- a/Content.Client/Weapons/Melee/MeleeLungeSystem.cs +++ b/Content.Client/Weapons/Melee/MeleeLungeSystem.cs @@ -11,7 +11,7 @@ namespace Content.Client.Weapons.Melee { base.FrameUpdate(frameTime); - foreach (var meleeLungeComponent in EntityManager.ComponentManager.EntityQuery(true)) + foreach (var meleeLungeComponent in EntityManager.EntityQuery(true)) { meleeLungeComponent.Update(frameTime); } diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs index 0253c71f76..3924e12bd6 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs @@ -30,7 +30,7 @@ namespace Content.Client.Weapons.Melee { base.FrameUpdate(frameTime); - foreach (var arcAnimationComponent in EntityManager.ComponentManager.EntityQuery(true)) + foreach (var arcAnimationComponent in EntityManager.EntityQuery(true)) { arcAnimationComponent.Update(frameTime); } diff --git a/Content.Client/Window/WindowComponent.cs b/Content.Client/Window/WindowComponent.cs index 135e94dba0..d7e3864d93 100644 --- a/Content.Client/Window/WindowComponent.cs +++ b/Content.Client/Window/WindowComponent.cs @@ -95,7 +95,7 @@ namespace Content.Client.Window var coords = Owner.Transform.Coordinates; foreach (var entity in grid.GetLocal(coords)) { - if (Owner.EntityManager.ComponentManager.TryGetComponent(entity, out LowWallComponent? lowWall)) + if (Owner.EntityManager.TryGetComponent(entity, out LowWallComponent? lowWall)) { return lowWall; } diff --git a/Content.Client/Window/WindowVisualizer.cs b/Content.Client/Window/WindowVisualizer.cs index 131db2b67c..54fcc89768 100644 --- a/Content.Client/Window/WindowVisualizer.cs +++ b/Content.Client/Window/WindowVisualizer.cs @@ -57,7 +57,7 @@ namespace Content.Client.Window var coords = transform.Coordinates; foreach (var entity in grid.GetLocal(coords)) { - if (transform.Owner.EntityManager.ComponentManager.TryGetComponent(entity, out LowWallComponent? lowWall)) + if (transform.Owner.EntityManager.TryGetComponent(entity, out LowWallComponent? lowWall)) { return lowWall; } diff --git a/Content.IntegrationTests/Tests/EntityTest.cs b/Content.IntegrationTests/Tests/EntityTest.cs index 9d2d644d6e..e57d82e105 100644 --- a/Content.IntegrationTests/Tests/EntityTest.cs +++ b/Content.IntegrationTests/Tests/EntityTest.cs @@ -189,7 +189,7 @@ namespace Content.IntegrationTests.Tests Assert.DoesNotThrow(() => { - entityManager.ComponentManager.AddComponent(entity, component); + entityManager.AddComponent(entity, component); }, "Component '{0}' threw an exception.", component.Name); @@ -330,7 +330,7 @@ namespace Content.IntegrationTests.Tests // and all others variations (out parameter) Assert.DoesNotThrow(() => { - entityManager.ComponentManager.AddComponent(entity, component); + entityManager.AddComponent(entity, component); }, "Component '{0}' threw an exception.", component.Name); } diff --git a/Content.Server/AI/EntitySystems/AiFactionTagSystem.cs b/Content.Server/AI/EntitySystems/AiFactionTagSystem.cs index e87b74ead1..c5971584db 100644 --- a/Content.Server/AI/EntitySystems/AiFactionTagSystem.cs +++ b/Content.Server/AI/EntitySystems/AiFactionTagSystem.cs @@ -68,7 +68,7 @@ namespace Content.Server.AI.EntitySystems yield break; } - foreach (var component in ComponentManager.EntityQuery(true)) + foreach (var component in EntityManager.EntityQuery(true)) { if ((component.Factions & hostile) == 0) continue; diff --git a/Content.Server/AI/Utils/Visibility.cs b/Content.Server/AI/Utils/Visibility.cs index ad79951620..5767d36c2e 100644 --- a/Content.Server/AI/Utils/Visibility.cs +++ b/Content.Server/AI/Utils/Visibility.cs @@ -58,7 +58,7 @@ namespace Content.Server.AI.Utils public static IEnumerable GetEntitiesInRange(EntityCoordinates grid, Type component, float range) { var entityManager = IoCManager.Resolve(); - foreach (var entity in entityManager.ComponentManager.GetAllComponents(component).Select(c => c.Owner)) + foreach (var entity in entityManager.GetAllComponents(component).Select(c => c.Owner)) { if (entity.Transform.Coordinates.GetGridId(entityManager) != grid.GetGridId(entityManager)) { diff --git a/Content.Server/AME/AntimatterEngineSystem.cs b/Content.Server/AME/AntimatterEngineSystem.cs index d72de7e0e7..1c0db54b54 100644 --- a/Content.Server/AME/AntimatterEngineSystem.cs +++ b/Content.Server/AME/AntimatterEngineSystem.cs @@ -15,7 +15,7 @@ namespace Content.Server.AME _accumulatedFrameTime += frameTime; if (_accumulatedFrameTime >= 10) { - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { comp.OnUpdate(frameTime); } diff --git a/Content.Server/AME/Components/AMEPartComponent.cs b/Content.Server/AME/Components/AMEPartComponent.cs index cb54a50b34..d677f9ade6 100644 --- a/Content.Server/AME/Components/AMEPartComponent.cs +++ b/Content.Server/AME/Components/AMEPartComponent.cs @@ -42,7 +42,7 @@ namespace Content.Server.AME.Components return false; // No AME in space. var snapPos = mapGrid.TileIndicesFor(args.ClickLocation); - if (mapGrid.GetAnchoredEntities(snapPos).Any(sc => _serverEntityManager.ComponentManager.HasComponent(sc))) + if (mapGrid.GetAnchoredEntities(snapPos).Any(sc => _serverEntityManager.HasComponent(sc))) { Owner.PopupMessage(args.User, Loc.GetString("ame-part-component-shielding-already-present")); return true; diff --git a/Content.Server/Administration/Commands/DeleteComponent.cs b/Content.Server/Administration/Commands/DeleteComponent.cs index b22af15355..24c1106cf5 100644 --- a/Content.Server/Administration/Commands/DeleteComponent.cs +++ b/Content.Server/Administration/Commands/DeleteComponent.cs @@ -31,14 +31,14 @@ namespace Content.Server.Administration.Commands } var componentType = registration.Type; - var components = entityManager.ComponentManager.GetAllComponents(componentType, true); + var components = entityManager.GetAllComponents(componentType, true); var i = 0; foreach (var component in components) { var uid = component.Owner.Uid; - entityManager.ComponentManager.RemoveComponent(uid, component); + entityManager.RemoveComponent(uid, component); i++; } diff --git a/Content.Server/Administration/Commands/DeleteEntitiesWithComponent.cs b/Content.Server/Administration/Commands/DeleteEntitiesWithComponent.cs index 7d4dd506f7..b2d31bcf09 100644 --- a/Content.Server/Administration/Commands/DeleteEntitiesWithComponent.cs +++ b/Content.Server/Administration/Commands/DeleteEntitiesWithComponent.cs @@ -36,7 +36,7 @@ namespace Content.Server.Administration.Commands var entityManager = IoCManager.Resolve(); - var entitiesWithComponents = components.Select(c => entityManager.ComponentManager.GetAllComponents(c).Select(x => x.Owner)); + var entitiesWithComponents = components.Select(c => entityManager.GetAllComponents(c).Select(x => x.Owner)); var entitiesWithAllComponents = entitiesWithComponents.Skip(1).Aggregate(new HashSet(entitiesWithComponents.First()), (h, e) => { h.IntersectWith(e); return h; }); var count = 0; diff --git a/Content.Server/Administration/Commands/FindEntitiesWithComponents.cs b/Content.Server/Administration/Commands/FindEntitiesWithComponents.cs index a386be5263..b619159294 100644 --- a/Content.Server/Administration/Commands/FindEntitiesWithComponents.cs +++ b/Content.Server/Administration/Commands/FindEntitiesWithComponents.cs @@ -47,7 +47,7 @@ namespace Content.Server.Administration.Commands var entityManager = IoCManager.Resolve(); var entityIds = new HashSet(); - var entitiesWithComponents = components.Select(c => entityManager.ComponentManager.GetAllComponents(c).Select(x => x.Owner)); + var entitiesWithComponents = components.Select(c => entityManager.GetAllComponents(c).Select(x => x.Owner)); var entitiesWithAllComponents = entitiesWithComponents.Skip(1).Aggregate(new HashSet(entitiesWithComponents.First()), (h, e) => { h.IntersectWith(e); return h; }); foreach (var entity in entitiesWithAllComponents) diff --git a/Content.Server/Administration/Commands/RemoveExtraComponents.cs b/Content.Server/Administration/Commands/RemoveExtraComponents.cs index 9feb0aa471..b680ecac06 100644 --- a/Content.Server/Administration/Commands/RemoveExtraComponents.cs +++ b/Content.Server/Administration/Commands/RemoveExtraComponents.cs @@ -44,7 +44,7 @@ namespace Content.Server.Administration.Commands if (entity.Prototype.Components.ContainsKey(component.Name)) continue; - entityManager.ComponentManager.RemoveComponent(entity.Uid, component); + entityManager.RemoveComponent(entity.Uid, component); components++; modified = true; diff --git a/Content.Server/Administration/Commands/WarpCommand.cs b/Content.Server/Administration/Commands/WarpCommand.cs index 327c6a021e..f37c366782 100644 --- a/Content.Server/Administration/Commands/WarpCommand.cs +++ b/Content.Server/Administration/Commands/WarpCommand.cs @@ -38,12 +38,12 @@ namespace Content.Server.Administration.Commands return; } - var comp = IoCManager.Resolve(); + var entMan = IoCManager.Resolve(); var location = args[0]; if (location == "?") { var locations = string.Join(", ", - comp.EntityQuery(true) + entMan.EntityQuery(true) .Select(p => p.Location) .Where(p => p != null) .OrderBy(p => p) @@ -62,9 +62,8 @@ namespace Content.Server.Administration.Commands var mapManager = IoCManager.Resolve(); var currentMap = player.AttachedEntity.Transform.MapID; var currentGrid = player.AttachedEntity.Transform.GridID; - var entityManager = IoCManager.Resolve(); - var found = comp.EntityQuery(true) + var found = entMan.EntityQuery(true) .Where(p => p.Location == location) .Select(p => p.Owner.Transform.Coordinates) .OrderBy(p => p, Comparer.Create((a, b) => @@ -72,8 +71,8 @@ namespace Content.Server.Administration.Commands // Sort so that warp points on the same grid/map are first. // So if you have two maps loaded with the same warp points, // it will prefer the warp points on the map you're currently on. - var aGrid = a.GetGridId(entityManager); - var bGrid = b.GetGridId(entityManager); + var aGrid = a.GetGridId(entMan); + var bGrid = b.GetGridId(entMan); if (aGrid == bGrid) { @@ -112,7 +111,7 @@ namespace Content.Server.Administration.Commands })) .FirstOrDefault(); - if (found.GetGridId(entityManager) != GridId.Invalid) + if (found.GetGridId(entMan) != GridId.Invalid) { player.AttachedEntity.Transform.Coordinates = found; if (player.AttachedEntity.TryGetComponent(out IPhysBody? physics)) diff --git a/Content.Server/Advertise/AdvertiseSystem.cs b/Content.Server/Advertise/AdvertiseSystem.cs index 62803c5a10..a7548a979d 100644 --- a/Content.Server/Advertise/AdvertiseSystem.cs +++ b/Content.Server/Advertise/AdvertiseSystem.cs @@ -108,7 +108,7 @@ namespace Content.Server.Advertise var curTime = _gameTiming.CurTime; - foreach (var advertise in ComponentManager.EntityQuery()) + foreach (var advertise in EntityManager.EntityQuery()) { if (!advertise.Enabled) continue; diff --git a/Content.Server/Arcade/BlockGameSystem.cs b/Content.Server/Arcade/BlockGameSystem.cs index fd01014c16..b4c886050d 100644 --- a/Content.Server/Arcade/BlockGameSystem.cs +++ b/Content.Server/Arcade/BlockGameSystem.cs @@ -64,7 +64,7 @@ namespace Content.Server.Arcade public override void Update(float frameTime) { - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { comp.DoGameTick(frameTime); } diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs index 35e06f437d..64a77541c9 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs @@ -36,7 +36,7 @@ namespace Content.Server.Atmos.EntitySystems gridAtmosphere.Tiles.Clear(); - if (!ComponentManager.TryGetComponent(uid, out IMapGridComponent? mapGrid)) + if (!EntityManager.TryGetComponent(uid, out IMapGridComponent? mapGrid)) return; if (gridAtmosphere.TilesUniqueMixes != null) @@ -85,7 +85,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return false; - if (ComponentManager.HasComponent(mapGrid.GridEntityId)) + if (EntityManager.HasComponent(mapGrid.GridEntityId)) return true; return false; @@ -124,7 +124,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return Enumerable.Empty(); - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { return GetAllTileMixtures(gridAtmosphere, invalidate); } @@ -197,7 +197,7 @@ namespace Content.Server.Atmos.EntitySystems { foreach (var uid in mapGrid.GetAnchoredEntities(tile)) { - if (ComponentManager.TryGetComponent(uid, out var ac)) + if (EntityManager.TryGetComponent(uid, out var ac)) yield return ac; } } @@ -391,7 +391,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { InvalidateTile(gridAtmosphere, tile); return; @@ -454,7 +454,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return null; - if(ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if(EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { return GetTileAtmosphere(gridAtmosphere, tile); } @@ -503,7 +503,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return null; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { return GetTileAtmosphereOrCreateSpace(mapGrid, gridAtmosphere, tile); } @@ -555,7 +555,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { AddActiveTile(gridAtmosphere, tile); return; @@ -616,7 +616,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { RemoveActiveTile(gridAtmosphere, tile); return; @@ -689,12 +689,12 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return null; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { return GetTileMixture(gridAtmosphere, tile, invalidate); } - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out SpaceAtmosphereComponent? _)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out SpaceAtmosphereComponent? _)) { // Always return a new space gas mixture in this case. return GasMixture.SpaceGas; @@ -752,7 +752,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return ReactionResult.NoReaction; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { return React(gridAtmosphere, tile); } @@ -905,7 +905,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return Enumerable.Empty(); - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { return GetAdjacentTiles(gridAtmosphere, tile, includeBlocked); } @@ -982,7 +982,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return Enumerable.Empty(); - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { return GetAdjacentTileMixtures(gridAtmosphere, tile, includeBlocked, invalidate); } @@ -1065,7 +1065,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { UpdateAdjacent(mapGrid, gridAtmosphere, tile); return; @@ -1137,7 +1137,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { UpdateAdjacent(mapGrid, gridAtmosphere, tile, direction); return; @@ -1212,7 +1212,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { var tileAtmosphere = GetTileAtmosphere(gridAtmosphere, tile); @@ -1249,7 +1249,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { HotspotExtinguish(gridAtmosphere, tile); return; @@ -1298,7 +1298,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return false; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { return IsHotspotActive(gridAtmosphere, tile); } @@ -1329,7 +1329,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(pipeNet.Grid, out var mapGrid)) return; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { gridAtmosphere.PipeNets.Add(pipeNet); } @@ -1344,7 +1344,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(pipeNet.Grid, out var mapGrid)) return; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { gridAtmosphere.PipeNets.Remove(pipeNet); } @@ -1361,7 +1361,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return false; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { atmosDevice.JoinedGrid = grid; gridAtmosphere.AtmosDevices.Add(atmosDevice); @@ -1385,7 +1385,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return false; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere) && gridAtmosphere.AtmosDevices.Contains(atmosDevice)) { atmosDevice.JoinedGrid = null; @@ -1476,7 +1476,7 @@ namespace Content.Server.Atmos.EntitySystems if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return; - if (ComponentManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) + if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)) { FixVacuum(gridAtmosphere, tile); return; diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs index 4c474f4fc1..a34d7b9ec1 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs @@ -468,7 +468,7 @@ namespace Content.Server.Atmos.EntitySystems { var direction = ((Vector2)_depressurizeTiles[tileCount - 1].GridIndices - tile.GridIndices).Normalized; - var gridPhysics = ComponentManager.GetComponent(mapGrid.GridEntityId); + var gridPhysics = EntityManager.GetComponent(mapGrid.GridEntityId); // TODO ATMOS: Come up with better values for these. gridPhysics.ApplyLinearImpulse(direction * totalGasesRemoved * gridPhysics.Mass); @@ -489,7 +489,7 @@ namespace Content.Server.Atmos.EntitySystems foreach (var entity in mapGrid.GetAnchoredEntities(tile.GridIndices)) { - if (!ComponentManager.TryGetComponent(entity, out FirelockComponent firelock)) + if (!EntityManager.TryGetComponent(entity, out FirelockComponent firelock)) continue; reconsiderAdjacent |= firelock.EmergencyPressureStop(); @@ -497,7 +497,7 @@ namespace Content.Server.Atmos.EntitySystems foreach (var entity in mapGrid.GetAnchoredEntities(other.GridIndices)) { - if (!ComponentManager.TryGetComponent(entity, out FirelockComponent firelock)) + if (!EntityManager.TryGetComponent(entity, out FirelockComponent firelock)) continue; reconsiderAdjacent |= firelock.EmergencyPressureStop(); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs index e02f81e0ca..9de6cbcc9a 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs @@ -231,7 +231,7 @@ namespace Content.Server.Atmos.EntitySystems { _currentRunAtmosphereIndex = 0; _currentRunAtmosphere.Clear(); - _currentRunAtmosphere.AddRange(ComponentManager.EntityQuery()); + _currentRunAtmosphere.AddRange(EntityManager.EntityQuery()); } // We set this to true just in case we have to stop processing due to time constraints. diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs index 966a3192f5..0e619420ac 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs @@ -68,7 +68,7 @@ namespace Content.Server.Atmos.EntitySystems if (_exposedTimer >= ExposedUpdateDelay) { - foreach (var exposed in EntityManager.ComponentManager.EntityQuery()) + foreach (var exposed in EntityManager.EntityQuery()) { // TODO ATMOS: Kill this with fire. var tile = GetTileMixture(exposed.Owner.Transform.Coordinates); diff --git a/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs b/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs index 6b80158a70..f72be55441 100644 --- a/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs +++ b/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs @@ -68,7 +68,7 @@ namespace Content.Server.Atmos.EntitySystems _timer -= UpdateTimer; - foreach (var (barotrauma, transform) in ComponentManager.EntityQuery()) + foreach (var (barotrauma, transform) in EntityManager.EntityQuery()) { var uid = barotrauma.Owner.Uid; diff --git a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs index 0d0c463f82..2827e20c83 100644 --- a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs +++ b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs @@ -58,7 +58,7 @@ namespace Content.Server.Atmos.EntitySystems private void OnCollideEvent(EntityUid uid, FlammableComponent flammable, StartCollideEvent args) { var otherUid = args.OtherFixture.Body.Owner.Uid; - if (!ComponentManager.TryGetComponent(otherUid, out FlammableComponent? otherFlammable)) + if (!EntityManager.TryGetComponent(otherUid, out FlammableComponent? otherFlammable)) return; if (!flammable.FireSpread || !otherFlammable.FireSpread) @@ -179,7 +179,7 @@ namespace Content.Server.Atmos.EntitySystems _timer -= UpdateTime; // TODO: This needs cleanup to take off the crust from TemperatureComponent and shit. - foreach (var (flammable, physics, transform) in ComponentManager.EntityQuery()) + foreach (var (flammable, physics, transform) in EntityManager.EntityQuery()) { var uid = flammable.Owner.Uid; @@ -237,7 +237,7 @@ namespace Content.Server.Atmos.EntitySystems continue; } - var otherPhysics = ComponentManager.GetComponent(uid); + var otherPhysics = EntityManager.GetComponent(uid); // TODO: Sloth, please save our souls! if (!physics.GetWorldAABB().Intersects(otherPhysics.GetWorldAABB())) diff --git a/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs b/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs index 7842816569..8568c815fe 100644 --- a/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs @@ -9,7 +9,7 @@ namespace Content.Server.Atmos.EntitySystems { public override void Update(float frameTime) { - foreach (var analyzer in ComponentManager.EntityQuery(true)) + foreach (var analyzer in EntityManager.EntityQuery(true)) { analyzer.Update(frameTime); } diff --git a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs index 0cebc10603..7c8cb0bfc8 100644 --- a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs @@ -22,7 +22,7 @@ namespace Content.Server.Atmos.EntitySystems if (_timer < TimerDelay) return; _timer -= TimerDelay; - foreach (var gasTank in EntityManager.ComponentManager.EntityQuery()) + foreach (var gasTank in EntityManager.EntityQuery()) { _atmosphereSystem.React(gasTank.Air, gasTank); gasTank.CheckStatus(); diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs index 78205ef201..076e4084a2 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs @@ -38,7 +38,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems } if (!vent.Enabled - || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) || !nodeContainer.TryGetNode(vent.InletName, out PipeNode? inlet) || !nodeContainer.TryGetNode(vent.OutletName, out PipeNode? outlet)) { @@ -98,7 +98,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnGasDualPortVentPumpDisabled(EntityUid uid, GasDualPortVentPumpComponent vent, AtmosDeviceDisabledEvent args) { - if (ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { appearance.SetData(VentPumpVisuals.State, VentPumpState.Off); } diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPassiveGateSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPassiveGateSystem.cs index 9d27211ad2..534e83de14 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPassiveGateSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPassiveGateSystem.cs @@ -24,7 +24,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (!gate.Enabled) return; - if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) + if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) return; if (!nodeContainer.TryGetNode(gate.InletName, out PipeNode? inlet) diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs index 3d2b9ca2ae..04b1da6196 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs @@ -27,7 +27,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems var appearance = pump.Owner.GetComponentOrNull(); if (!pump.Enabled - || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) || !nodeContainer.TryGetNode(pump.InletName, out PipeNode? inlet) || !nodeContainer.TryGetNode(pump.OutletName, out PipeNode? outlet)) { @@ -58,7 +58,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnPumpLeaveAtmosphere(EntityUid uid, GasPressurePumpComponent component, AtmosDeviceDisabledEvent args) { - if (ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { appearance.SetData(PressurePumpVisuals.Enabled, false); } diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs index 69c1ef362c..9f6b6a9912 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs @@ -38,7 +38,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems { component.Open = value; - if (ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + if (EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) && nodeContainer.TryGetNode(component.PipeName, out PipeNode? pipe)) { pipe.ConnectionsEnabled = component.Open; diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs index 555385d401..d431e9c962 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs @@ -28,10 +28,10 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (!pump.Enabled) return; - if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) + if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) return; - if (!ComponentManager.TryGetComponent(uid, out AtmosDeviceComponent? device)) + if (!EntityManager.TryGetComponent(uid, out AtmosDeviceComponent? device)) return; if (!nodeContainer.TryGetNode(pump.InletName, out PipeNode? inlet) diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs index 828cfdfe9c..019b21426b 100644 --- a/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs +++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs @@ -18,7 +18,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems private void OnStartup(EntityUid uid, AtmosPipeColorComponent component, ComponentStartup args) { - if (!ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; appearance.SetData(PipeColorVisuals.Color, component.Color); @@ -26,7 +26,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems private void OnShutdown(EntityUid uid, AtmosPipeColorComponent component, ComponentShutdown args) { - if (!ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; appearance.SetData(PipeColorVisuals.Color, Color.White); @@ -36,7 +36,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems { component.Color = color; - if (!ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; appearance.SetData(PipeColorVisuals.Color, color); diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs index 39e1b71911..47dd0acbcc 100644 --- a/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs +++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs @@ -25,7 +25,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems private void OnUnanchorAttempt(EntityUid uid, AtmosUnsafeUnanchorComponent component, UnanchorAttemptEvent args) { - if (!component.Enabled || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodes)) + if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes)) return; if (_atmosphereSystem.GetTileMixture(component.Owner.Transform.Coordinates) is not {} environment) @@ -46,7 +46,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems private void OnBeforeUnanchored(EntityUid uid, AtmosUnsafeUnanchorComponent component, BeforeUnanchoredEvent args) { - if (!component.Enabled || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodes)) + if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes)) return; if (_atmosphereSystem.GetTileMixture(component.Owner.Transform.Coordinates, true) is not {} environment) diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs index 2d24c80fdf..219f21bddf 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs @@ -29,8 +29,8 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems var appearance = filter.Owner.GetComponentOrNull(); if (!filter.Enabled - || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) - || !ComponentManager.TryGetComponent(uid, out AtmosDeviceComponent? device) + || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + || !EntityManager.TryGetComponent(uid, out AtmosDeviceComponent? device) || !nodeContainer.TryGetNode(filter.InletName, out PipeNode? inletNode) || !nodeContainer.TryGetNode(filter.FilterName, out PipeNode? filterNode) || !nodeContainer.TryGetNode(filter.OutletName, out PipeNode? outletNode) diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs index 3e886d6773..28db52ae59 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs @@ -26,7 +26,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems if (!mixer.Enabled) return; - if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) + if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) return; if (!nodeContainer.TryGetNode(mixer.InletOneName, out PipeNode? inletOne) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs index 0efa354673..57dd8fecbe 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs @@ -49,9 +49,9 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnCanisterStartup(EntityUid uid, GasCanisterComponent canister, ComponentStartup args) { // Ensure container manager. - if (!ComponentManager.TryGetComponent(uid, out ContainerManagerComponent? containerManager)) + if (!EntityManager.TryGetComponent(uid, out ContainerManagerComponent? containerManager)) { - containerManager = ComponentManager.AddComponent(EntityManager.GetEntity(uid)); + containerManager = EntityManager.AddComponent(EntityManager.GetEntity(uid)); } // Ensure container. @@ -105,7 +105,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (!CheckInteract(args.Session)) return; - if (!ComponentManager.TryGetComponent(uid, out ContainerManagerComponent? containerManager) + if (!EntityManager.TryGetComponent(uid, out ContainerManagerComponent? containerManager) || !containerManager.TryGetContainer(canister.ContainerName, out var container)) return; @@ -137,8 +137,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnCanisterUpdated(EntityUid uid, GasCanisterComponent canister, AtmosDeviceUpdateEvent args) { - if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) - || !ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + || !EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; if (!nodeContainer.TryGetNode(canister.PortName, out PortablePipeNode? portNode)) @@ -167,7 +167,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems // Release valve is open, release gas. if (canister.ReleaseValve) { - if (!ComponentManager.TryGetComponent(uid, out containerManager) + if (!EntityManager.TryGetComponent(uid, out containerManager) || !containerManager.TryGetContainer(canister.ContainerName, out var container)) return; @@ -261,7 +261,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems DirtyUI(uid, component); - if (!ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; appearance.SetData(GasCanisterVisuals.TankInserted, true); @@ -274,7 +274,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems DirtyUI(uid, component); - if (!ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; appearance.SetData(GasCanisterVisuals.TankInserted, false); diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs index c716f72c04..07b81c85c4 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs @@ -29,7 +29,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (!injector.Enabled) return; - if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) + if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) return; if (!nodeContainer.TryGetNode(injector.InletName, out PipeNode? inlet)) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs index e484e80da0..a6bb3533ef 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs @@ -30,7 +30,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (environment == null) return; - if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) + if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) return; if (!nodeContainer.TryGetNode(vent.InletName, out PipeNode? inlet)) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs index 4ee5c723fa..8ab8356f7f 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs @@ -29,7 +29,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnPortableAnchorAttempt(EntityUid uid, GasPortableComponent component, AnchorAttemptEvent args) { - if (!ComponentManager.TryGetComponent(uid, out ITransformComponent? transform)) + if (!EntityManager.TryGetComponent(uid, out ITransformComponent? transform)) return; // If we can't find any ports, cancel the anchoring. @@ -39,7 +39,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnPortableAnchored(EntityUid uid, GasPortableComponent portable, AnchoredEvent args) { - if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) + if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) return; if (!nodeContainer.TryGetNode(portable.PortName, out PipeNode? portableNode)) @@ -47,7 +47,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems portableNode.ConnectionsEnabled = true; - if (ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { appearance.SetData(GasPortableVisuals.ConnectedState, true); } @@ -55,7 +55,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnPortableUnanchored(EntityUid uid, GasPortableComponent portable, UnanchoredEvent args) { - if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) + if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) return; if (!nodeContainer.TryGetNode(portable.PortName, out PipeNode? portableNode)) @@ -63,7 +63,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems portableNode.ConnectionsEnabled = false; - if (ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { appearance.SetData(GasPortableVisuals.ConnectedState, false); } @@ -80,7 +80,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems foreach (var entityUid in grid.GetLocal(coordinates)) { - if (ComponentManager.TryGetComponent(entityUid, out port)) + if (EntityManager.TryGetComponent(entityUid, out port)) { return true; } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs index 8706a22156..f20124c797 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs @@ -29,7 +29,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems var appearance = thermoMachine.Owner.GetComponentOrNull(); if (!thermoMachine.Enabled - || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) || !nodeContainer.TryGetNode(thermoMachine.InletName, out PipeNode? inlet)) { appearance?.SetData(ThermoMachineVisuals.Enabled, false); @@ -52,7 +52,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnThermoMachineLeaveAtmosphere(EntityUid uid, GasThermoMachineComponent component, AtmosDeviceDisabledEvent args) { - if (ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { appearance.SetData(ThermoMachineVisuals.Enabled, false); } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index a008cde4ca..1dd758192d 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -37,7 +37,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems } if (!vent.Enabled - || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) || !nodeContainer.TryGetNode(vent.InletName, out PipeNode? pipe)) { appearance?.SetData(VentPumpVisuals.State, VentPumpState.Off); @@ -95,7 +95,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnGasVentPumpLeaveAtmosphere(EntityUid uid, GasVentPumpComponent component, AtmosDeviceDisabledEvent args) { - if (ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { appearance.SetData(VentPumpVisuals.State, VentPumpState.Off); } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs index 9b6722411d..7584830ecb 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs @@ -38,7 +38,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems } if (!scrubber.Enabled - || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) || !nodeContainer.TryGetNode(scrubber.OutletName, out PipeNode? outlet)) { appearance?.SetData(ScrubberVisuals.State, ScrubberState.Off); @@ -60,7 +60,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnVentScrubberLeaveAtmosphere(EntityUid uid, GasVentScrubberComponent component, AtmosDeviceDisabledEvent args) { - if (ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { appearance.SetData(ScrubberVisuals.State, ScrubberState.Off); } diff --git a/Content.Server/Audio/AmbientSoundSystem.cs b/Content.Server/Audio/AmbientSoundSystem.cs index c61be5164c..5b55ce9fb6 100644 --- a/Content.Server/Audio/AmbientSoundSystem.cs +++ b/Content.Server/Audio/AmbientSoundSystem.cs @@ -14,7 +14,7 @@ namespace Content.Server.Audio private void HandlePowerChange(EntityUid uid, AmbientOnPoweredComponent component, PowerChangedEvent args) { - if (!ComponentManager.TryGetComponent(uid, out var ambientSound)) return; + if (!EntityManager.TryGetComponent(uid, out var ambientSound)) return; if (ambientSound.Enabled == args.Powered) return; ambientSound.Enabled = args.Powered; ambientSound.Dirty(); diff --git a/Content.Server/Body/BodySystem.cs b/Content.Server/Body/BodySystem.cs index ad0d586059..e3e7e1713a 100644 --- a/Content.Server/Body/BodySystem.cs +++ b/Content.Server/Body/BodySystem.cs @@ -20,9 +20,9 @@ namespace Content.Server.Body private void OnRelayMoveInput(EntityUid uid, BodyComponent component, RelayMoveInputEvent args) { - if (ComponentManager.TryGetComponent(uid, out var mobState) && + if (EntityManager.TryGetComponent(uid, out var mobState) && mobState.IsDead() && - ComponentManager.TryGetComponent(uid, out var mind) && + EntityManager.TryGetComponent(uid, out var mind) && mind.HasMind) { _ticker.OnGhostAttempt(mind.Mind!, true); diff --git a/Content.Server/Body/Metabolism/MetabolizerSystem.cs b/Content.Server/Body/Metabolism/MetabolizerSystem.cs index 7579c2cd40..070a3e18c7 100644 --- a/Content.Server/Body/Metabolism/MetabolizerSystem.cs +++ b/Content.Server/Body/Metabolism/MetabolizerSystem.cs @@ -35,7 +35,7 @@ namespace Content.Server.Body.Metabolism { base.Update(frameTime); - foreach (var metab in ComponentManager.EntityQuery(false)) + foreach (var metab in EntityManager.EntityQuery(false)) { metab.AccumulatedFrametime += frameTime; diff --git a/Content.Server/Body/Respiratory/RespiratorSystem.cs b/Content.Server/Body/Respiratory/RespiratorSystem.cs index 424b1e4dce..7fd911d9d9 100644 --- a/Content.Server/Body/Respiratory/RespiratorSystem.cs +++ b/Content.Server/Body/Respiratory/RespiratorSystem.cs @@ -10,7 +10,7 @@ namespace Content.Server.Body.Respiratory { base.Update(frameTime); - foreach (var respirator in ComponentManager.EntityQuery(false)) + foreach (var respirator in EntityManager.EntityQuery(false)) { respirator.Update(frameTime); } diff --git a/Content.Server/Buckle/BuckleSystem.cs b/Content.Server/Buckle/BuckleSystem.cs index 23edd6a617..a9a32a4d7a 100644 --- a/Content.Server/Buckle/BuckleSystem.cs +++ b/Content.Server/Buckle/BuckleSystem.cs @@ -39,7 +39,7 @@ namespace Content.Server.Buckle public override void Update(float frameTime) { - foreach (var (buckle, physics) in ComponentManager.EntityQuery()) + foreach (var (buckle, physics) in EntityManager.EntityQuery()) { buckle.Update(physics); } diff --git a/Content.Server/Cargo/CargoConsoleSystem.cs b/Content.Server/Cargo/CargoConsoleSystem.cs index 183bd723a1..d573fe560a 100644 --- a/Content.Server/Cargo/CargoConsoleSystem.cs +++ b/Content.Server/Cargo/CargoConsoleSystem.cs @@ -199,7 +199,7 @@ namespace Content.Server.Cargo private void SyncComponentsWithId(int id) { - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { if (comp.Database == null || comp.Database.Id != id) continue; diff --git a/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs b/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs index 801e5d791c..57349a7c5a 100644 --- a/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs +++ b/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs @@ -68,11 +68,11 @@ namespace Content.Server.Chemistry.Components var coords = Owner.Transform.Coordinates; foreach (var neighbor in grid.GetInDir(coords, dir)) { - if (Owner.EntityManager.ComponentManager.TryGetComponent(neighbor, + if (Owner.EntityManager.TryGetComponent(neighbor, out SolutionAreaEffectComponent? comp) && comp.Inception == Inception) return; - if (Owner.EntityManager.ComponentManager.TryGetComponent(neighbor, + if (Owner.EntityManager.TryGetComponent(neighbor, out AirtightComponent? airtight) && airtight.AirBlocked) return; } diff --git a/Content.Server/Chemistry/EntitySystems/SolutionAreaEffectSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionAreaEffectSystem.cs index a647007644..114589309d 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionAreaEffectSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionAreaEffectSystem.cs @@ -10,7 +10,7 @@ namespace Content.Server.Chemistry.EntitySystems { public override void Update(float frameTime) { - foreach (var inception in ComponentManager.EntityQuery().ToArray()) + foreach (var inception in EntityManager.EntityQuery().ToArray()) { inception.InceptionUpdate(frameTime); } diff --git a/Content.Server/Chemistry/EntitySystems/VaporSystem.cs b/Content.Server/Chemistry/EntitySystems/VaporSystem.cs index e24c2487c8..26371d5cae 100644 --- a/Content.Server/Chemistry/EntitySystems/VaporSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/VaporSystem.cs @@ -32,7 +32,7 @@ namespace Content.Server.Chemistry.EntitySystems private void HandleCollide(EntityUid uid, VaporComponent component, StartCollideEvent args) { - if (!ComponentManager.TryGetComponent(uid, out SolutionContainerManagerComponent? contents)) return; + if (!EntityManager.TryGetComponent(uid, out SolutionContainerManagerComponent? contents)) return; foreach (var (_, value) in contents.Solutions) { @@ -77,7 +77,7 @@ namespace Content.Server.Chemistry.EntitySystems public override void Update(float frameTime) { - foreach (var (vaporComp, solution) in ComponentManager + foreach (var (vaporComp, solution) in EntityManager .EntityQuery(true)) { foreach (var (_, value) in solution.Solutions) diff --git a/Content.Server/Cloning/CloningSystem.cs b/Content.Server/Cloning/CloningSystem.cs index 940c117680..f594524036 100644 --- a/Content.Server/Cloning/CloningSystem.cs +++ b/Content.Server/Cloning/CloningSystem.cs @@ -72,7 +72,7 @@ namespace Content.Server.Cloning public override void Update(float frameTime) { - foreach (var (cloning, power) in ComponentManager.EntityQuery(true)) + foreach (var (cloning, power) in EntityManager.EntityQuery(true)) { if (cloning.UiKnownPowerState != power.Powered) { @@ -127,7 +127,7 @@ namespace Content.Server.Cloning public void OnChangeMadeToDnaScans() { - foreach (var cloning in ComponentManager.EntityQuery(true)) + foreach (var cloning in EntityManager.EntityQuery(true)) UpdateUserInterface(cloning); } diff --git a/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs b/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs index 6e195eb438..6540382903 100644 --- a/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs +++ b/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs @@ -28,7 +28,7 @@ namespace Content.Server.Damage.Systems private void HandleCollide(EntityUid uid, DamageOnHighSpeedImpactComponent component, StartCollideEvent args) { - if (!ComponentManager.HasComponent(uid)) return; + if (!EntityManager.HasComponent(uid)) return; var otherBody = args.OtherFixture.Body.Owner; var speed = args.OurFixture.Body.LinearVelocity.Length; @@ -42,7 +42,7 @@ namespace Content.Server.Damage.Systems component.LastHit = _gameTiming.CurTime; - if (ComponentManager.TryGetComponent(uid, out StunnableComponent? stun) && _robustRandom.Prob(component.StunChance)) + if (EntityManager.TryGetComponent(uid, out StunnableComponent? stun) && _robustRandom.Prob(component.StunChance)) stun.Stun(component.StunSeconds); var damageScale = (speed / component.MinimumSpeed) * component.Factor; diff --git a/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs index 49856650bf..89adacf96f 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs @@ -70,7 +70,7 @@ namespace Content.Server.Disposal.Tube.Components var position = Owner.Transform.Coordinates; foreach (var entity in grid.GetInDir(position, nextDirection)) { - if (!Owner.EntityManager.ComponentManager.TryGetComponent(entity, out IDisposalTubeComponent? tube)) + if (!Owner.EntityManager.TryGetComponent(entity, out IDisposalTubeComponent? tube)) { continue; } diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs index 92786009cf..6f2b94925f 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs @@ -10,7 +10,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems public override void Update(float frameTime) { - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { comp.Update(frameTime); } diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs index 42c442d944..9757ed2d9e 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs @@ -88,7 +88,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems public void TogglePower(DisposalUnitComponent component) { - if (!ComponentManager.TryGetComponent(component.Owner.Uid, out ApcPowerReceiverComponent? receiver)) + if (!EntityManager.TryGetComponent(component.Owner.Uid, out ApcPowerReceiverComponent? receiver)) { return; } @@ -291,11 +291,11 @@ namespace Content.Server.Disposal.Unit.EntitySystems { var uid = component.RecentlyEjected[i]; if (EntityManager.EntityExists(uid) && - ComponentManager.TryGetComponent(uid, out PhysicsComponent? body)) + EntityManager.TryGetComponent(uid, out PhysicsComponent? body)) { // TODO: We need to use a specific collision method (which sloth hasn't coded yet) for actual bounds overlaps. // Check for itemcomp as we won't just block the disposal unit "sleeping" for something it can't collide with anyway. - if (!ComponentManager.HasComponent(uid) && body.GetWorldAABB().Intersects(disposalsBounds!.Value)) continue; + if (!EntityManager.HasComponent(uid) && body.GetWorldAABB().Intersects(disposalsBounds!.Value)) continue; component.RecentlyEjected.RemoveAt(i); } } @@ -340,7 +340,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems var grid = _mapManager.GetGrid(component.Owner.Transform.GridID); var coords = component.Owner.Transform.Coordinates; var entry = grid.GetLocal(coords) - .FirstOrDefault(entity => EntityManager.ComponentManager.HasComponent(entity)); + .FirstOrDefault(entity => EntityManager.HasComponent(entity)); if (entry == default) { @@ -348,7 +348,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems } var air = component.Air; - var entryComponent = EntityManager.ComponentManager.GetComponent(entry); + var entryComponent = EntityManager.GetComponent(entry); if (_atmosSystem.GetTileMixture(component.Owner.Transform.Coordinates, true) is {Temperature: > 0} environment) { diff --git a/Content.Server/DoAfter/DoAfterSystem.cs b/Content.Server/DoAfter/DoAfterSystem.cs index 6202fac1ad..921cc13bcb 100644 --- a/Content.Server/DoAfter/DoAfterSystem.cs +++ b/Content.Server/DoAfter/DoAfterSystem.cs @@ -41,7 +41,7 @@ namespace Content.Server.DoAfter { base.Update(frameTime); - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { foreach (var doAfter in comp.DoAfters.ToArray()) { diff --git a/Content.Server/Explosion/TriggerSystem.cs b/Content.Server/Explosion/TriggerSystem.cs index e2c19f9e33..3a071e0283 100644 --- a/Content.Server/Explosion/TriggerSystem.cs +++ b/Content.Server/Explosion/TriggerSystem.cs @@ -55,7 +55,7 @@ namespace Content.Server.Explosion private void HandleExplodeTrigger(EntityUid uid, ExplodeOnTriggerComponent component, TriggerEvent args) { - if (!ComponentManager.TryGetComponent(uid, out ExplosiveComponent? explosiveComponent)) return; + if (!EntityManager.TryGetComponent(uid, out ExplosiveComponent? explosiveComponent)) return; Explode(uid, explosiveComponent); } diff --git a/Content.Server/Flash/FlashSystem.cs b/Content.Server/Flash/FlashSystem.cs index 286ebfc30a..b6017d1a63 100644 --- a/Content.Server/Flash/FlashSystem.cs +++ b/Content.Server/Flash/FlashSystem.cs @@ -120,14 +120,14 @@ namespace Content.Server.Flash if (attempt.Cancelled) return; - if (ComponentManager.TryGetComponent(target, out var flashable)) + if (EntityManager.TryGetComponent(target, out var flashable)) { flashable.LastFlash = _gameTiming.CurTime; flashable.Duration = flashDuration / 1000f; // TODO: Make this sane... flashable.Dirty(); } - if (ComponentManager.TryGetComponent(target, out var stunnableComponent)) + if (EntityManager.TryGetComponent(target, out var stunnableComponent)) { stunnableComponent.Slowdown(flashDuration / 1000f, slowTo, slowTo); } @@ -149,7 +149,7 @@ namespace Content.Server.Flash public void FlashArea(EntityUid source, EntityUid? user, float range, float duration, float slowTo = 0f, bool displayPopup = false, SoundSpecifier? sound = null) { - var transform = ComponentManager.GetComponent(source); + var transform = EntityManager.GetComponent(source); foreach (var entity in _entityLookup.GetEntitiesInRange(transform.Coordinates, range)) { diff --git a/Content.Server/Fluids/Components/PuddleComponent.cs b/Content.Server/Fluids/Components/PuddleComponent.cs index 5e91c23238..7cae41efe8 100644 --- a/Content.Server/Fluids/Components/PuddleComponent.cs +++ b/Content.Server/Fluids/Components/PuddleComponent.cs @@ -377,14 +377,14 @@ namespace Content.Server.Fluids.Components foreach (var entity in mapGrid.GetInDir(coords, direction)) { - if (Owner.EntityManager.ComponentManager.TryGetComponent(entity, out IPhysBody? physics) && + if (Owner.EntityManager.TryGetComponent(entity, out IPhysBody? physics) && (physics.CollisionLayer & (int) CollisionGroup.Impassable) != 0) { puddle = default; return false; } - if (Owner.EntityManager.ComponentManager.TryGetComponent(entity, out PuddleComponent? existingPuddle)) + if (Owner.EntityManager.TryGetComponent(entity, out PuddleComponent? existingPuddle)) { if (existingPuddle._overflown) { diff --git a/Content.Server/Fluids/PuddleSystem.cs b/Content.Server/Fluids/PuddleSystem.cs index 48510fec2e..c019f12a09 100644 --- a/Content.Server/Fluids/PuddleSystem.cs +++ b/Content.Server/Fluids/PuddleSystem.cs @@ -30,7 +30,7 @@ namespace Content.Server.Fluids private void HandlePuddleExamined(EntityUid uid, PuddleComponent component, ExaminedEvent args) { - if (ComponentManager.TryGetComponent(uid, out var slippery) && slippery.Slippery) + if (EntityManager.TryGetComponent(uid, out var slippery) && slippery.Slippery) { args.PushText(Loc.GetString("puddle-component-examine-is-slipper-text")); } @@ -40,7 +40,7 @@ namespace Content.Server.Fluids private void HandleTileChanged(object? sender, TileChangedEventArgs eventArgs) { // If this gets hammered you could probably queue up all the tile changes every tick but I doubt that would ever happen. - foreach (var puddle in ComponentManager.EntityQuery(true)) + foreach (var puddle in EntityManager.EntityQuery(true)) { // If the tile becomes space then delete it (potentially change by design) var puddleTransform = puddle.Owner.Transform; diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index b178b920e4..5357bd6bfc 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -250,7 +250,7 @@ namespace Content.Server.GameTicking _possiblePositions.Clear(); - foreach (var (point, transform) in ComponentManager.EntityQuery()) + foreach (var (point, transform) in EntityManager.EntityQuery()) { if (point.SpawnType == SpawnPointType.Job && point.Job?.ID == jobId) _possiblePositions.Add(transform.Coordinates); @@ -268,7 +268,7 @@ namespace Content.Server.GameTicking _possiblePositions.Clear(); - foreach (var (point, transform) in ComponentManager.EntityQuery()) + foreach (var (point, transform) in EntityManager.EntityQuery()) { if (point.SpawnType == SpawnPointType.LateJoin) _possiblePositions.Add(transform.Coordinates); } @@ -286,7 +286,7 @@ namespace Content.Server.GameTicking _possiblePositions.Clear(); - foreach (var (point, transform) in ComponentManager.EntityQuery()) + foreach (var (point, transform) in EntityManager.EntityQuery()) { if (point.SpawnType == SpawnPointType.Observer) _possiblePositions.Add(transform.Coordinates); diff --git a/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs b/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs index 8f72350d76..706daef1f4 100644 --- a/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs +++ b/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs @@ -161,7 +161,7 @@ namespace Content.Server.GameTicking.Presets // On failure, the returned target is the location that we're already at. var bestTargetDistanceFromNearest = -1.0f; // Need the random shuffle or it stuffs the first person into Atmospherics pretty reliably - var ents = _entityManager.ComponentManager.EntityQuery().Select(x => x.Owner).ToList(); + var ents = _entityManager.EntityQuery().Select(x => x.Owner).ToList(); _robustRandom.Shuffle(ents); var foundATarget = false; bestTarget = EntityCoordinates.Invalid; @@ -197,7 +197,7 @@ namespace Content.Server.GameTicking.Presets // TODO BODY SYSTEM KILL var damage = new DamageSpecifier(_prototypeManager.Index("Asphyxiation"), 100); EntitySystem.Get().TryChangeDamage(entity.Uid, damage, true); - } + } else if (!mobState.IsDead()) { if (entity.HasComponent()) @@ -217,7 +217,7 @@ namespace Content.Server.GameTicking.Presets { var lines = new List(); lines.Add("traitor-death-match-end-round-description-first-line"); - foreach (var pda in _entityManager.ComponentManager.EntityQuery()) + foreach (var pda in _entityManager.EntityQuery()) { var uplink = pda.SyndicateUplinkAccount; if (uplink != null && _allOriginalNames.ContainsKey(uplink)) diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index 6cac372421..c4b464ab10 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -50,8 +50,8 @@ namespace Content.Server.Ghost private void OnRelayMoveInput(EntityUid uid, GhostOnMoveComponent component, RelayMoveInputEvent args) { // Let's not ghost if our mind is visiting... - if (ComponentManager.HasComponent(uid)) return; - if (!ComponentManager.TryGetComponent(uid, out var mind) || !mind.HasMind || mind.Mind!.IsVisitingEntity) return; + if (EntityManager.HasComponent(uid)) return; + if (!EntityManager.TryGetComponent(uid, out var mind) || !mind.HasMind || mind.Mind!.IsVisitingEntity) return; _ticker.OnGhostAttempt(mind.Mind!, component.CanReturn); } @@ -193,7 +193,7 @@ namespace Content.Server.Ghost private IEnumerable GetLocationNames() { - foreach (var warp in ComponentManager.EntityQuery()) + foreach (var warp in EntityManager.EntityQuery()) { if (warp.Location != null) { @@ -204,7 +204,7 @@ namespace Content.Server.Ghost private WarpPointComponent? FindLocation(string name) { - foreach (var warp in ComponentManager.EntityQuery(true)) + foreach (var warp in EntityManager.EntityQuery(true)) { if (warp.Location == name) { diff --git a/Content.Server/Gravity/EntitySystems/GravitySystem.cs b/Content.Server/Gravity/EntitySystems/GravitySystem.cs index 630719710f..3cee745f4a 100644 --- a/Content.Server/Gravity/EntitySystems/GravitySystem.cs +++ b/Content.Server/Gravity/EntitySystems/GravitySystem.cs @@ -41,7 +41,7 @@ namespace Content.Server.Gravity.EntitySystems { if (ev.GridId == GridId.Invalid) return; - var gravity = ComponentManager.GetComponent(_mapManager.GetGrid(ev.GridId).GridEntityId); + var gravity = EntityManager.GetComponent(_mapManager.GetGrid(ev.GridId).GridEntityId); if (ev.Status == GravityGeneratorStatus.On) { @@ -59,7 +59,7 @@ namespace Content.Server.Gravity.EntitySystems var gridId = component.Owner.Transform.GridID; GravityChangedMessage message; - foreach (var generator in ComponentManager.EntityQuery(true)) + foreach (var generator in EntityManager.EntityQuery(true)) { if (generator.Owner.Transform.GridID == gridId && generator.Status == GravityGeneratorStatus.On) { @@ -78,7 +78,7 @@ namespace Content.Server.Gravity.EntitySystems public override void Update(float frameTime) { // TODO: Pointless iteration, just make both of these event-based PLEASE - foreach (var generator in ComponentManager.EntityQuery(true)) + foreach (var generator in EntityManager.EntityQuery(true)) { if (generator.NeedsUpdate) { diff --git a/Content.Server/Hands/Systems/HandVirtualItemSystem.cs b/Content.Server/Hands/Systems/HandVirtualItemSystem.cs index 820c409173..fd2636bac9 100644 --- a/Content.Server/Hands/Systems/HandVirtualItemSystem.cs +++ b/Content.Server/Hands/Systems/HandVirtualItemSystem.cs @@ -23,7 +23,7 @@ namespace Content.Server.Hands.Systems public bool TrySpawnVirtualItemInHand(EntityUid blockingEnt, EntityUid user) { - if (ComponentManager.TryGetComponent(user, out var hands)) + if (EntityManager.TryGetComponent(user, out var hands)) { foreach (var handName in hands.ActivePriorityEnumerable()) { @@ -82,7 +82,7 @@ namespace Content.Server.Hands.Systems /// public void DeleteInHandsMatching(EntityUid user, EntityUid matching) { - if (ComponentManager.TryGetComponent(user, out var hands)) + if (EntityManager.TryGetComponent(user, out var hands)) { foreach (var handName in hands.ActivePriorityEnumerable()) { @@ -92,9 +92,9 @@ namespace Content.Server.Hands.Systems if (hand.HeldEntity != null) { - if (ComponentManager.TryGetComponent(hand.HeldEntity.Uid, - out var virt) - && virt.BlockingEntity == matching) + if (EntityManager.TryGetComponent(hand.HeldEntity.Uid, + out var virt) + && virt.BlockingEntity == matching) { Delete(virt, user); } diff --git a/Content.Server/Instruments/InstrumentSystem.cs b/Content.Server/Instruments/InstrumentSystem.cs index f2149993fb..e3aba6b264 100644 --- a/Content.Server/Instruments/InstrumentSystem.cs +++ b/Content.Server/Instruments/InstrumentSystem.cs @@ -51,7 +51,7 @@ namespace Content.Server.Instruments { base.Update(frameTime); - foreach (var component in ComponentManager.EntityQuery(true)) + foreach (var component in EntityManager.EntityQuery(true)) { component.Update(frameTime); } diff --git a/Content.Server/Jobs/AddComponentSpecial.cs b/Content.Server/Jobs/AddComponentSpecial.cs index e628c2b8ca..a7d9f0eeb7 100644 --- a/Content.Server/Jobs/AddComponentSpecial.cs +++ b/Content.Server/Jobs/AddComponentSpecial.cs @@ -20,7 +20,7 @@ namespace Content.Server.Jobs var component = (Component)IoCManager.Resolve().GetComponent(Component); component.Owner = mob; - IoCManager.Resolve().AddComponent(mob, component); + IoCManager.Resolve().AddComponent(mob, component); } } } diff --git a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs index 140bbc482b..33079ca180 100644 --- a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs @@ -23,7 +23,7 @@ namespace Content.Server.Kitchen.EntitySystems public override void Update(float frameTime) { base.Update(frameTime); - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { comp.OnUpdate(); } diff --git a/Content.Server/Lathe/LatheSystem.cs b/Content.Server/Lathe/LatheSystem.cs index f06da5bc98..efcb60c3fd 100644 --- a/Content.Server/Lathe/LatheSystem.cs +++ b/Content.Server/Lathe/LatheSystem.cs @@ -9,7 +9,7 @@ namespace Content.Server.Lathe { public override void Update(float frameTime) { - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { if (comp.Producing == false && comp.Queue.Count > 0) { diff --git a/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs b/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs index fb394b568f..b49d1e0178 100644 --- a/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs +++ b/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs @@ -9,7 +9,7 @@ namespace Content.Server.Light.EntitySystems { public override void Update(float frameTime) { - foreach (var light in ComponentManager.EntityQuery(true)) + foreach (var light in EntityManager.EntityQuery(true)) { light.Update(frameTime); } diff --git a/Content.Server/MachineLinking/System/TwoWayLeverSystem.cs b/Content.Server/MachineLinking/System/TwoWayLeverSystem.cs index f1fea0b3fe..33316e6d3a 100644 --- a/Content.Server/MachineLinking/System/TwoWayLeverSystem.cs +++ b/Content.Server/MachineLinking/System/TwoWayLeverSystem.cs @@ -11,8 +11,6 @@ namespace Content.Server.MachineLinking.System { public class TwoWayLeverSystem : EntitySystem { - [Dependency] private readonly IComponentManager _componentManager = default!; - public override void Initialize() { base.Initialize(); @@ -42,7 +40,7 @@ namespace Content.Server.MachineLinking.System component.NextSignalLeft = !component.NextSignalLeft; } - if (_componentManager.TryGetComponent(uid, out var appearanceComponent)) + if (EntityManager.TryGetComponent(uid, out var appearanceComponent)) { appearanceComponent.SetData(TwoWayLeverVisuals.State, component.State); } diff --git a/Content.Server/Medical/MedicalScannerSystem.cs b/Content.Server/Medical/MedicalScannerSystem.cs index 5df903b79c..61a7d32fcf 100644 --- a/Content.Server/Medical/MedicalScannerSystem.cs +++ b/Content.Server/Medical/MedicalScannerSystem.cs @@ -37,7 +37,7 @@ namespace Content.Server.Medical public override void Update(float frameTime) { - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { comp.Update(frameTime); } diff --git a/Content.Server/Morgue/MorgueSystem.cs b/Content.Server/Morgue/MorgueSystem.cs index 96600cd129..00bda44d51 100644 --- a/Content.Server/Morgue/MorgueSystem.cs +++ b/Content.Server/Morgue/MorgueSystem.cs @@ -16,7 +16,7 @@ namespace Content.Server.Morgue if (_accumulatedFrameTime >= 10) { - foreach (var morgue in ComponentManager.EntityQuery(true)) + foreach (var morgue in EntityManager.EntityQuery(true)) { morgue.Update(); } diff --git a/Content.Server/Movement/StressTestMovementSystem.cs b/Content.Server/Movement/StressTestMovementSystem.cs index 6e88adbaac..7d48754dfd 100644 --- a/Content.Server/Movement/StressTestMovementSystem.cs +++ b/Content.Server/Movement/StressTestMovementSystem.cs @@ -13,7 +13,7 @@ namespace Content.Server.Movement { base.Update(frameTime); - foreach (var stressTest in ComponentManager.EntityQuery(true)) + foreach (var stressTest in EntityManager.EntityQuery(true)) { var transform = stressTest.Owner.Transform; diff --git a/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs b/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs index 36f4d2c459..ce19ef09b7 100644 --- a/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs +++ b/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs @@ -337,7 +337,7 @@ namespace Content.Server.NodeContainer.EntitySystems { var msg = new NodeVis.MsgData(); - var allNetworks = ComponentManager + var allNetworks = EntityManager .EntityQuery() .SelectMany(nc => nc.Nodes.Values) .Select(n => (BaseNodeGroup?) n.NodeGroup) diff --git a/Content.Server/NodeContainer/Nodes/AdjacentNode.cs b/Content.Server/NodeContainer/Nodes/AdjacentNode.cs index 90b3330139..c94206aa44 100644 --- a/Content.Server/NodeContainer/Nodes/AdjacentNode.cs +++ b/Content.Server/NodeContainer/Nodes/AdjacentNode.cs @@ -17,11 +17,11 @@ namespace Content.Server.NodeContainer.Nodes if (!Owner.Transform.Anchored) yield break; - var compMgr = IoCManager.Resolve(); + var entMan = IoCManager.Resolve(); var grid = IoCManager.Resolve().GetGrid(Owner.Transform.GridID); var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates); - foreach (var (_, node) in NodeHelpers.GetCardinalNeighborNodes(compMgr, grid, gridIndex)) + foreach (var (_, node) in NodeHelpers.GetCardinalNeighborNodes(entMan, grid, gridIndex)) { if (node != this) yield return node; diff --git a/Content.Server/NodeContainer/Nodes/NodeHelpers.cs b/Content.Server/NodeContainer/Nodes/NodeHelpers.cs index 115e5a276f..6475d6fa93 100644 --- a/Content.Server/NodeContainer/Nodes/NodeHelpers.cs +++ b/Content.Server/NodeContainer/Nodes/NodeHelpers.cs @@ -12,11 +12,11 @@ namespace Content.Server.NodeContainer.Nodes /// public static class NodeHelpers { - public static IEnumerable GetNodesInTile(IComponentManager compMgr, IMapGrid grid, Vector2i coords) + public static IEnumerable GetNodesInTile(IEntityManager entMan, IMapGrid grid, Vector2i coords) { foreach (var entityUid in grid.GetAnchoredEntities(coords)) { - if (!compMgr.TryGetComponent(entityUid, out NodeContainerComponent? container)) + if (!entMan.TryGetComponent(entityUid, out NodeContainerComponent? container)) continue; foreach (var node in container.Nodes.Values) @@ -27,14 +27,14 @@ namespace Content.Server.NodeContainer.Nodes } public static IEnumerable<(Direction dir, Node node)> GetCardinalNeighborNodes( - IComponentManager compMgr, + IEntityManager entMan, IMapGrid grid, Vector2i coords, bool includeSameTile = true) { foreach (var (dir, entityUid) in GetCardinalNeighborCells(grid, coords, includeSameTile)) { - if (!compMgr.TryGetComponent(entityUid, out NodeContainerComponent? container)) + if (!entMan.TryGetComponent(entityUid, out NodeContainerComponent? container)) continue; foreach (var node in container.Nodes.Values) diff --git a/Content.Server/NodeContainer/Nodes/PipeNode.cs b/Content.Server/NodeContainer/Nodes/PipeNode.cs index 8ba8836497..0442d051aa 100644 --- a/Content.Server/NodeContainer/Nodes/PipeNode.cs +++ b/Content.Server/NodeContainer/Nodes/PipeNode.cs @@ -173,7 +173,7 @@ namespace Content.Server.NodeContainer.Nodes var position = Owner.Transform.Coordinates; foreach (var entity in grid.GetInDir(position, pipeDir.ToDirection())) { - if (!Owner.EntityManager.ComponentManager.TryGetComponent(entity, out var container)) + if (!Owner.EntityManager.TryGetComponent(entity, out var container)) continue; foreach (var node in container.Nodes.Values) @@ -196,7 +196,7 @@ namespace Content.Server.NodeContainer.Nodes var position = Owner.Transform.Coordinates; foreach (var entity in grid.GetLocal(position)) { - if (!Owner.EntityManager.ComponentManager.TryGetComponent(entity, out var container)) + if (!Owner.EntityManager.TryGetComponent(entity, out var container)) continue; foreach (var node in container.Nodes.Values) diff --git a/Content.Server/Nutrition/EntitySystems/HungerSystem.cs b/Content.Server/Nutrition/EntitySystems/HungerSystem.cs index 1234f6ac75..69c7584b22 100644 --- a/Content.Server/Nutrition/EntitySystems/HungerSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/HungerSystem.cs @@ -15,7 +15,7 @@ namespace Content.Server.Nutrition.EntitySystems if (_accumulatedFrameTime > 1) { - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { comp.OnUpdate(_accumulatedFrameTime); } diff --git a/Content.Server/Nutrition/EntitySystems/SmokingSystem.Cigar.cs b/Content.Server/Nutrition/EntitySystems/SmokingSystem.Cigar.cs index 9659a520d6..f62a179d88 100644 --- a/Content.Server/Nutrition/EntitySystems/SmokingSystem.Cigar.cs +++ b/Content.Server/Nutrition/EntitySystems/SmokingSystem.Cigar.cs @@ -21,7 +21,7 @@ namespace Content.Server.Nutrition.EntitySystems if (args.Handled) return; - if (!ComponentManager.TryGetComponent(uid, out SmokableComponent? smokable)) + if (!EntityManager.TryGetComponent(uid, out SmokableComponent? smokable)) return; if (smokable.State != SmokableState.Lit) @@ -36,7 +36,7 @@ namespace Content.Server.Nutrition.EntitySystems if (args.Handled) return; - if (!ComponentManager.TryGetComponent(uid, out SmokableComponent? smokable)) + if (!EntityManager.TryGetComponent(uid, out SmokableComponent? smokable)) return; if (smokable.State != SmokableState.Unlit) diff --git a/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs b/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs index a2bfdab082..1be6fb88cc 100644 --- a/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs @@ -70,7 +70,7 @@ namespace Content.Server.Nutrition.EntitySystems foreach (var uid in _active.ToArray()) { - if (!ComponentManager.TryGetComponent(uid, out SmokableComponent? smokable)) + if (!EntityManager.TryGetComponent(uid, out SmokableComponent? smokable)) { _active.Remove(uid); continue; diff --git a/Content.Server/Nutrition/EntitySystems/ThirstSystem.cs b/Content.Server/Nutrition/EntitySystems/ThirstSystem.cs index e26dbff1c1..24f7825ff6 100644 --- a/Content.Server/Nutrition/EntitySystems/ThirstSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/ThirstSystem.cs @@ -15,7 +15,7 @@ namespace Content.Server.Nutrition.EntitySystems if (_accumulatedFrameTime > 1) { - foreach (var component in ComponentManager.EntityQuery(true)) + foreach (var component in EntityManager.EntityQuery(true)) { component.OnUpdate(_accumulatedFrameTime); } diff --git a/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs b/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs index 9f731f69d6..438703b42c 100644 --- a/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs +++ b/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs @@ -17,7 +17,7 @@ namespace Content.Server.Objectives.Conditions public override IObjectiveCondition GetAssigned(Mind.Mind mind) { var entityMgr = IoCManager.Resolve(); - var allHumans = entityMgr.ComponentManager.EntityQuery(true).Where(mc => + var allHumans = entityMgr.EntityQuery(true).Where(mc => { var entity = mc.Mind?.OwnedEntity; return (entity?.GetComponentOrNull()?.IsAlive() ?? false) && mc.Mind != mind; diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs index dbdfb65cf7..f754e200c2 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs @@ -387,7 +387,7 @@ namespace Content.Server.ParticleAccelerator.Components var coords = Owner.Transform.Coordinates; foreach (var maybeFuel in grid.GetCardinalNeighborCells(coords)) { - if (Owner.EntityManager.ComponentManager.TryGetComponent(maybeFuel, out _partFuelChamber)) + if (Owner.EntityManager.TryGetComponent(maybeFuel, out _partFuelChamber)) { break; } @@ -461,7 +461,7 @@ namespace Content.Server.ParticleAccelerator.Components var coords = Owner.Transform.Coordinates; foreach (var ent in grid.GetOffset(coords, offset)) { - if (Owner.EntityManager.ComponentManager.TryGetComponent(ent, out part) && !part.Deleted) + if (Owner.EntityManager.TryGetComponent(ent, out part) && !part.Deleted) { return true; } diff --git a/Content.Server/Physics/Controllers/ConveyorController.cs b/Content.Server/Physics/Controllers/ConveyorController.cs index 4322d279a0..48dbdb4222 100644 --- a/Content.Server/Physics/Controllers/ConveyorController.cs +++ b/Content.Server/Physics/Controllers/ConveyorController.cs @@ -19,7 +19,7 @@ namespace Content.Server.Physics.Controllers { base.UpdateBeforeSolve(prediction, frameTime); var system = EntitySystem.Get(); - foreach (var comp in ComponentManager.EntityQuery()) + foreach (var comp in EntityManager.EntityQuery()) { Convey(system, comp, frameTime); } diff --git a/Content.Server/Physics/Controllers/MoverController.cs b/Content.Server/Physics/Controllers/MoverController.cs index 6a13a20bdc..572d720f10 100644 --- a/Content.Server/Physics/Controllers/MoverController.cs +++ b/Content.Server/Physics/Controllers/MoverController.cs @@ -56,20 +56,20 @@ namespace Content.Server.Physics.Controllers base.UpdateBeforeSolve(prediction, frameTime); _excludedMobs.Clear(); - foreach (var (mobMover, mover, physics) in ComponentManager.EntityQuery()) + foreach (var (mobMover, mover, physics) in EntityManager.EntityQuery()) { _excludedMobs.Add(mover.Owner.Uid); HandleMobMovement(mover, physics, mobMover); } - foreach (var (pilot, mover) in ComponentManager.EntityQuery()) + foreach (var (pilot, mover) in EntityManager.EntityQuery()) { if (pilot.Console == null) continue; _excludedMobs.Add(mover.Owner.Uid); HandleShuttleMovement(mover); } - foreach (var (mover, physics) in ComponentManager.EntityQuery(true)) + foreach (var (mover, physics) in EntityManager.EntityQuery(true)) { if (_excludedMobs.Contains(mover.Owner.Uid)) continue; @@ -209,7 +209,7 @@ namespace Content.Server.Physics.Controllers string? soundToPlay = null; foreach (var maybeFootstep in grid.GetAnchoredEntities(tile.GridIndices)) { - if (EntityManager.ComponentManager.TryGetComponent(maybeFootstep, out FootstepModifierComponent? footstep)) + if (EntityManager.TryGetComponent(maybeFootstep, out FootstepModifierComponent? footstep)) { soundToPlay = footstep.SoundCollection.GetSound(); break; diff --git a/Content.Server/Physics/Controllers/SingularityController.cs b/Content.Server/Physics/Controllers/SingularityController.cs index 90dcc2fa4a..4c64b5ee9c 100644 --- a/Content.Server/Physics/Controllers/SingularityController.cs +++ b/Content.Server/Physics/Controllers/SingularityController.cs @@ -19,7 +19,7 @@ namespace Content.Server.Physics.Controllers { base.UpdateBeforeSolve(prediction, frameTime); - foreach (var (singularity, physics) in ComponentManager.EntityQuery()) + foreach (var (singularity, physics) in EntityManager.EntityQuery()) { if (singularity.Owner.HasComponent() || singularity.BeingDeletedByAnotherSingularity) continue; diff --git a/Content.Server/Plants/PlantSystem.cs b/Content.Server/Plants/PlantSystem.cs index 2dbe10b10e..18c095de49 100644 --- a/Content.Server/Plants/PlantSystem.cs +++ b/Content.Server/Plants/PlantSystem.cs @@ -12,7 +12,6 @@ namespace Content.Server.Plants [UsedImplicitly] public class PlantSystem : EntitySystem { - [Dependency] private readonly IComponentManager _componentManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; private int _nextUid = 0; @@ -69,7 +68,7 @@ namespace Content.Server.Plants _timer = 0f; - foreach (var plantHolder in _componentManager.EntityQuery(true)) + foreach (var plantHolder in EntityManager.EntityQuery(true)) { plantHolder.Update(); } diff --git a/Content.Server/Pointing/EntitySystems/PointingSystem.cs b/Content.Server/Pointing/EntitySystems/PointingSystem.cs index 68949852ca..2280b779b0 100644 --- a/Content.Server/Pointing/EntitySystems/PointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/PointingSystem.cs @@ -202,7 +202,7 @@ namespace Content.Server.Pointing.EntitySystems public override void Update(float frameTime) { - foreach (var component in ComponentManager.EntityQuery(true)) + foreach (var component in EntityManager.EntityQuery(true)) { component.Update(frameTime); } diff --git a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs index 11e9d0a554..268a8626c0 100644 --- a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs @@ -9,7 +9,7 @@ namespace Content.Server.Pointing.EntitySystems { public override void Update(float frameTime) { - foreach (var component in ComponentManager.EntityQuery(true)) + foreach (var component in EntityManager.EntityQuery(true)) { component.Update(frameTime); } diff --git a/Content.Server/Power/Components/CablePlacerComponent.cs b/Content.Server/Power/Components/CablePlacerComponent.cs index 131016654e..97363c7f32 100644 --- a/Content.Server/Power/Components/CablePlacerComponent.cs +++ b/Content.Server/Power/Components/CablePlacerComponent.cs @@ -40,7 +40,7 @@ namespace Content.Server.Power.Components return true; foreach (var anchored in grid.GetAnchoredEntities(snapPos)) { - if (Owner.EntityManager.ComponentManager.TryGetComponent(anchored, out var wire) && wire.CableType == _blockingCableType) + if (Owner.EntityManager.TryGetComponent(anchored, out var wire) && wire.CableType == _blockingCableType) { return true; } diff --git a/Content.Server/Power/DrainAllBatteriesCommand.cs b/Content.Server/Power/DrainAllBatteriesCommand.cs index 068a3df89a..6e6b3fb354 100644 --- a/Content.Server/Power/DrainAllBatteriesCommand.cs +++ b/Content.Server/Power/DrainAllBatteriesCommand.cs @@ -22,8 +22,8 @@ namespace Content.Server.Power return; } - var comp = IoCManager.Resolve(); - foreach (var batteryComp in comp.EntityQuery()) + var entMan = IoCManager.Resolve(); + foreach (var batteryComp in entMan.EntityQuery()) { batteryComp.CurrentCharge = 0; } diff --git a/Content.Server/Power/EntitySystems/BaseChargerSystem.cs b/Content.Server/Power/EntitySystems/BaseChargerSystem.cs index bc2bb26f25..bf7b5be615 100644 --- a/Content.Server/Power/EntitySystems/BaseChargerSystem.cs +++ b/Content.Server/Power/EntitySystems/BaseChargerSystem.cs @@ -9,7 +9,7 @@ namespace Content.Server.Power.EntitySystems { public override void Update(float frameTime) { - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { comp.OnUpdate(frameTime); } diff --git a/Content.Server/Power/EntitySystems/BatterySystem.cs b/Content.Server/Power/EntitySystems/BatterySystem.cs index e97b007861..af1a317e2f 100644 --- a/Content.Server/Power/EntitySystems/BatterySystem.cs +++ b/Content.Server/Power/EntitySystems/BatterySystem.cs @@ -17,7 +17,7 @@ namespace Content.Server.Power.EntitySystems private void PreSync(NetworkBatteryPreSync ev) { - foreach (var (bat, netBat) in ComponentManager.EntityQuery()) + foreach (var (bat, netBat) in EntityManager.EntityQuery()) { netBat.NetworkBattery.Capacity = bat.MaxCharge; netBat.NetworkBattery.CurrentStorage = bat.CurrentCharge; @@ -26,7 +26,7 @@ namespace Content.Server.Power.EntitySystems private void PostSync(NetworkBatteryPostSync ev) { - foreach (var (bat, netBat) in ComponentManager.EntityQuery()) + foreach (var (bat, netBat) in EntityManager.EntityQuery()) { bat.CurrentCharge = netBat.NetworkBattery.CurrentStorage; } @@ -34,7 +34,7 @@ namespace Content.Server.Power.EntitySystems public override void Update(float frameTime) { - foreach (var comp in ComponentManager.EntityQuery()) + foreach (var comp in EntityManager.EntityQuery()) { comp.OnUpdate(frameTime); } diff --git a/Content.Server/Power/EntitySystems/CableVisSystem.cs b/Content.Server/Power/EntitySystems/CableVisSystem.cs index d0425d63b5..e9b5480550 100644 --- a/Content.Server/Power/EntitySystems/CableVisSystem.cs +++ b/Content.Server/Power/EntitySystems/CableVisSystem.cs @@ -37,9 +37,9 @@ namespace Content.Server.Power.EntitySystems foreach (var uid in _toUpdate) { - if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) - || !ComponentManager.TryGetComponent(uid, out CableVisComponent? cableVis) - || !ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + || !EntityManager.TryGetComponent(uid, out CableVisComponent? cableVis) + || !EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { continue; } @@ -49,7 +49,7 @@ namespace Content.Server.Power.EntitySystems var mask = WireVisDirFlags.None; - var transform = ComponentManager.GetComponent(uid); + var transform = EntityManager.GetComponent(uid); var grid = _mapManager.GetGrid(transform.GridID); var tile = grid.TileIndicesFor(transform.Coordinates); var node = nodeContainer.GetNode(cableVis.Node); diff --git a/Content.Server/Power/EntitySystems/PowerApcSystem.cs b/Content.Server/Power/EntitySystems/PowerApcSystem.cs index c41a7a4df1..744bde6b41 100644 --- a/Content.Server/Power/EntitySystems/PowerApcSystem.cs +++ b/Content.Server/Power/EntitySystems/PowerApcSystem.cs @@ -16,7 +16,7 @@ namespace Content.Server.Power.EntitySystems public override void Update(float frameTime) { - foreach (var apc in ComponentManager.EntityQuery()) + foreach (var apc in EntityManager.EntityQuery()) { apc.Update(); } diff --git a/Content.Server/Power/EntitySystems/PowerNetSystem.cs b/Content.Server/Power/EntitySystems/PowerNetSystem.cs index d8eee5d111..605d1839c7 100644 --- a/Content.Server/Power/EntitySystems/PowerNetSystem.cs +++ b/Content.Server/Power/EntitySystems/PowerNetSystem.cs @@ -184,7 +184,7 @@ namespace Content.Server.Power.EntitySystems // Send events where necessary. { - foreach (var apcReceiver in ComponentManager.EntityQuery()) + foreach (var apcReceiver in EntityManager.EntityQuery()) { var recv = apcReceiver.NetworkLoad.ReceivingPower; ref var last = ref apcReceiver.LastPowerReceived; @@ -196,7 +196,7 @@ namespace Content.Server.Power.EntitySystems } } - foreach (var consumer in ComponentManager.EntityQuery()) + foreach (var consumer in EntityManager.EntityQuery()) { var newRecv = consumer.NetworkLoad.ReceivingPower; ref var lastRecv = ref consumer.LastReceived; diff --git a/Content.Server/Power/Nodes/CableDeviceNode.cs b/Content.Server/Power/Nodes/CableDeviceNode.cs index 48a7942728..b5179da313 100644 --- a/Content.Server/Power/Nodes/CableDeviceNode.cs +++ b/Content.Server/Power/Nodes/CableDeviceNode.cs @@ -15,11 +15,11 @@ namespace Content.Server.Power.Nodes { public override IEnumerable GetReachableNodes() { - var compMgr = IoCManager.Resolve(); + var entMan = IoCManager.Resolve(); var grid = IoCManager.Resolve().GetGrid(Owner.Transform.GridID); var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates); - foreach (var node in NodeHelpers.GetNodesInTile(compMgr, grid, gridIndex)) + foreach (var node in NodeHelpers.GetNodesInTile(entMan, grid, gridIndex)) { if (node is CableNode) yield return node; diff --git a/Content.Server/Power/Nodes/CableNode.cs b/Content.Server/Power/Nodes/CableNode.cs index 07d519656d..bfb0c44629 100644 --- a/Content.Server/Power/Nodes/CableNode.cs +++ b/Content.Server/Power/Nodes/CableNode.cs @@ -17,7 +17,7 @@ namespace Content.Server.Power.Nodes if (!Anchored) yield break; - var compMgr = IoCManager.Resolve(); + var entMan = IoCManager.Resolve(); var grid = IoCManager.Resolve().GetGrid(Owner.Transform.GridID); var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates); @@ -26,7 +26,7 @@ namespace Content.Server.Power.Nodes var terminalDirs = 0; List<(Direction, Node)> nodeDirs = new(); - foreach (var (dir, node) in NodeHelpers.GetCardinalNeighborNodes(compMgr, grid, gridIndex)) + foreach (var (dir, node) in NodeHelpers.GetCardinalNeighborNodes(entMan, grid, gridIndex)) { if (node is CableNode && node != this) { diff --git a/Content.Server/Power/Nodes/CableTerminalNode.cs b/Content.Server/Power/Nodes/CableTerminalNode.cs index 7bcf0a323c..0920956db1 100644 --- a/Content.Server/Power/Nodes/CableTerminalNode.cs +++ b/Content.Server/Power/Nodes/CableTerminalNode.cs @@ -12,14 +12,14 @@ namespace Content.Server.Power.Nodes { public override IEnumerable GetReachableNodes() { - var compMgr = IoCManager.Resolve(); + var entMan = IoCManager.Resolve(); var grid = IoCManager.Resolve().GetGrid(Owner.Transform.GridID); var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates); var dir = Owner.Transform.LocalRotation.GetDir(); var targetIdx = gridIndex + NodeHelpers.TileOffsetForDir(dir); - foreach (var node in NodeHelpers.GetNodesInTile(compMgr, grid, targetIdx)) + foreach (var node in NodeHelpers.GetNodesInTile(entMan, grid, targetIdx)) { if (node is CableTerminalPortNode) yield return node; diff --git a/Content.Server/Power/Nodes/CableTerminalPortNode.cs b/Content.Server/Power/Nodes/CableTerminalPortNode.cs index aa703aefd8..5d3db43702 100644 --- a/Content.Server/Power/Nodes/CableTerminalPortNode.cs +++ b/Content.Server/Power/Nodes/CableTerminalPortNode.cs @@ -12,11 +12,11 @@ namespace Content.Server.Power.Nodes { public override IEnumerable GetReachableNodes() { - var compMgr = IoCManager.Resolve(); + var entMan = IoCManager.Resolve(); var grid = IoCManager.Resolve().GetGrid(Owner.Transform.GridID); var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates); - var nodes = NodeHelpers.GetCardinalNeighborNodes(compMgr, grid, gridIndex, includeSameTile: false); + var nodes = NodeHelpers.GetCardinalNeighborNodes(entMan, grid, gridIndex, includeSameTile: false); foreach (var (_, node) in nodes) { if (node is CableTerminalNode) diff --git a/Content.Server/Power/SMES/PowerSmesSystem.cs b/Content.Server/Power/SMES/PowerSmesSystem.cs index e0dcc760a2..98c4b4541a 100644 --- a/Content.Server/Power/SMES/PowerSmesSystem.cs +++ b/Content.Server/Power/SMES/PowerSmesSystem.cs @@ -8,7 +8,7 @@ namespace Content.Server.Power.SMES { public override void Update(float frameTime) { - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { comp.OnUpdate(); } diff --git a/Content.Server/Projectiles/ProjectileSystem.cs b/Content.Server/Projectiles/ProjectileSystem.cs index b59b29d9ec..70d8f7ed8c 100644 --- a/Content.Server/Projectiles/ProjectileSystem.cs +++ b/Content.Server/Projectiles/ProjectileSystem.cs @@ -71,7 +71,7 @@ namespace Content.Server.Projectiles { base.Update(frameTime); - foreach (var component in ComponentManager.EntityQuery()) + foreach (var component in EntityManager.EntityQuery()) { component.TimeLeft -= frameTime; diff --git a/Content.Server/Radiation/RadiationPulseSystem.cs b/Content.Server/Radiation/RadiationPulseSystem.cs index daed81f417..093251ef39 100644 --- a/Content.Server/Radiation/RadiationPulseSystem.cs +++ b/Content.Server/Radiation/RadiationPulseSystem.cs @@ -26,7 +26,7 @@ namespace Content.Server.Radiation { _accumulator -= RadiationCooldown; - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { comp.Update(frameTime); var ent = comp.Owner; diff --git a/Content.Server/Radio/EntitySystems/ListeningSystem.cs b/Content.Server/Radio/EntitySystems/ListeningSystem.cs index 44370632c5..7bc4dc93c1 100644 --- a/Content.Server/Radio/EntitySystems/ListeningSystem.cs +++ b/Content.Server/Radio/EntitySystems/ListeningSystem.cs @@ -9,7 +9,7 @@ namespace Content.Server.Radio.EntitySystems { public void PingListeners(IEntity source, string message) { - foreach (var listener in ComponentManager.EntityQuery(true)) + foreach (var listener in EntityManager.EntityQuery(true)) { // TODO: Map Position distance if (listener.CanListen(message, source)) diff --git a/Content.Server/Radio/EntitySystems/RadioSystem.cs b/Content.Server/Radio/EntitySystems/RadioSystem.cs index 7d2df3f19e..ee2e749585 100644 --- a/Content.Server/Radio/EntitySystems/RadioSystem.cs +++ b/Content.Server/Radio/EntitySystems/RadioSystem.cs @@ -17,7 +17,7 @@ namespace Content.Server.Radio.EntitySystems _messages.Add(message); - foreach (var radio in ComponentManager.EntityQuery(true)) + foreach (var radio in EntityManager.EntityQuery(true)) { if (radio.Channels.Contains(channel)) { diff --git a/Content.Server/Research/ResearchSystem.cs b/Content.Server/Research/ResearchSystem.cs index d43277ddb6..dc263dcf0a 100644 --- a/Content.Server/Research/ResearchSystem.cs +++ b/Content.Server/Research/ResearchSystem.cs @@ -71,7 +71,7 @@ namespace Content.Server.Research if (_timer >= ResearchConsoleUIUpdateTime) { - foreach (var console in ComponentManager.EntityQuery()) + foreach (var console in EntityManager.EntityQuery()) { console.UpdateUserInterface(); } diff --git a/Content.Server/Shuttles/ShuttleConsoleSystem.cs b/Content.Server/Shuttles/ShuttleConsoleSystem.cs index a288c614a8..46c48f500c 100644 --- a/Content.Server/Shuttles/ShuttleConsoleSystem.cs +++ b/Content.Server/Shuttles/ShuttleConsoleSystem.cs @@ -28,7 +28,7 @@ namespace Content.Server.Shuttles public override void Update(float frameTime) { base.Update(frameTime); - foreach (var comp in ComponentManager.EntityQuery().ToArray()) + foreach (var comp in EntityManager.EntityQuery().ToArray()) { if (comp.Console == null) continue; @@ -147,7 +147,7 @@ namespace Content.Server.Shuttles pilotComponent.Owner.PopupMessage(Loc.GetString("shuttle-pilot-end")); // TODO: RemoveComponent is cooked and doesn't sync to client so this fucks up movement prediction. - // ComponentManager.RemoveComponent(pilotComponent.Owner.Uid); + // EntityManager.RemoveComponent(pilotComponent.Owner.Uid); pilotComponent.Console = null; pilotComponent.Dirty(); } diff --git a/Content.Server/Singularity/EntitySystems/SingularitySystem.cs b/Content.Server/Singularity/EntitySystems/SingularitySystem.cs index b2b2745a73..4665461bbe 100644 --- a/Content.Server/Singularity/EntitySystems/SingularitySystem.cs +++ b/Content.Server/Singularity/EntitySystems/SingularitySystem.cs @@ -61,7 +61,7 @@ namespace Content.Server.Singularity.EntitySystems { _accumulator -= _updateInterval; - foreach (var singularity in ComponentManager.EntityQuery()) + foreach (var singularity in EntityManager.EntityQuery()) { singularity.Energy -= singularity.EnergyDrain; } @@ -71,7 +71,7 @@ namespace Content.Server.Singularity.EntitySystems { _gravityAccumulator -= GravityCooldown; - foreach (var singularity in ComponentManager.EntityQuery()) + foreach (var singularity in EntityManager.EntityQuery()) { Update(singularity, GravityCooldown); } diff --git a/Content.Server/Singularity/StartSingularityEngineCommand.cs b/Content.Server/Singularity/StartSingularityEngineCommand.cs index 48f9ca665e..b683cae410 100644 --- a/Content.Server/Singularity/StartSingularityEngineCommand.cs +++ b/Content.Server/Singularity/StartSingularityEngineCommand.cs @@ -26,15 +26,15 @@ namespace Content.Server.Singularity } var entityManager = IoCManager.Resolve(); - foreach (var comp in entityManager.ComponentManager.EntityQuery()) + foreach (var comp in entityManager.EntityQuery()) { EntitySystem.Get().SwitchOn(comp); } - foreach (var comp in entityManager.ComponentManager.EntityQuery()) + foreach (var comp in entityManager.EntityQuery()) { comp.Collecting = true; } - foreach (var comp in entityManager.ComponentManager.EntityQuery()) + foreach (var comp in entityManager.EntityQuery()) { comp.RescanParts(); comp.SetStrength(ParticleAcceleratorPowerState.Level0); diff --git a/Content.Server/Solar/EntitySystems/PowerSolarControlConsoleSystem.cs b/Content.Server/Solar/EntitySystems/PowerSolarControlConsoleSystem.cs index 72bc7e5dfc..27c2582772 100644 --- a/Content.Server/Solar/EntitySystems/PowerSolarControlConsoleSystem.cs +++ b/Content.Server/Solar/EntitySystems/PowerSolarControlConsoleSystem.cs @@ -21,7 +21,7 @@ namespace Content.Server.Solar.EntitySystems if (_updateTimer >= 1) { _updateTimer -= 1; - foreach (var component in ComponentManager.EntityQuery(true)) + foreach (var component in EntityManager.EntityQuery(true)) { component.UpdateUIState(); } diff --git a/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs b/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs index 31a952594d..f773aeaf76 100644 --- a/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs +++ b/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs @@ -86,7 +86,7 @@ namespace Content.Server.Solar.EntitySystems TotalPanelPower = 0; - foreach (var panel in ComponentManager.EntityQuery(true)) + foreach (var panel in EntityManager.EntityQuery(true)) { // There's supposed to be rotational logic here, but that implies putting it somewhere. panel.Owner.Transform.WorldRotation = TargetPanelRotation; diff --git a/Content.Server/Spawners/EntitySystems/ConditionalSpawnerSystem.cs b/Content.Server/Spawners/EntitySystems/ConditionalSpawnerSystem.cs index 19f14925ee..467061965c 100644 --- a/Content.Server/Spawners/EntitySystems/ConditionalSpawnerSystem.cs +++ b/Content.Server/Spawners/EntitySystems/ConditionalSpawnerSystem.cs @@ -17,7 +17,7 @@ namespace Content.Server.Spawners.EntitySystems private void OnRuleAdded(GameRuleAddedEvent args) { - foreach (var spawner in ComponentManager.EntityQuery()) + foreach (var spawner in EntityManager.EntityQuery()) { spawner.RuleAdded(args); } diff --git a/Content.Server/Speech/AccentManager.cs b/Content.Server/Speech/AccentManager.cs index 99abd2c33c..c75f0548d0 100644 --- a/Content.Server/Speech/AccentManager.cs +++ b/Content.Server/Speech/AccentManager.cs @@ -14,7 +14,7 @@ namespace Content.Server.Speech public class AccentManager : IAccentManager { [Dependency] private readonly IChatManager _chatManager = default!; - [Dependency] private readonly IComponentManager _componentManager = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; public static readonly Regex SentenceRegex = new(@"(?<=[\.!\?])"); @@ -28,7 +28,7 @@ namespace Content.Server.Speech public string AccentHandler(IEntity player, string message) { //TODO: give accents a prio? - var accents = _componentManager.GetComponents(player.Uid); + var accents = _entityManager.GetComponents(player.Uid); foreach (var accent in accents) { message = accent.Accentuate(message); diff --git a/Content.Server/StationEvents/Events/MeteorSwarm.cs b/Content.Server/StationEvents/Events/MeteorSwarm.cs index 99656db046..78918fb1a1 100644 --- a/Content.Server/StationEvents/Events/MeteorSwarm.cs +++ b/Content.Server/StationEvents/Events/MeteorSwarm.cs @@ -13,7 +13,6 @@ namespace Content.Server.StationEvents.Events { public sealed class MeteorSwarm : StationEvent { - [Dependency] private readonly IComponentManager _compManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; @@ -90,7 +89,7 @@ namespace Content.Server.StationEvents.Events foreach (var grid in _mapManager.GetAllGrids()) { - if (grid.ParentMapId != mapId || !_compManager.TryGetComponent(grid.GridEntityId, out PhysicsComponent? gridBody)) continue; + if (grid.ParentMapId != mapId || !_entityManager.TryGetComponent(grid.GridEntityId, out PhysicsComponent? gridBody)) continue; var aabb = gridBody.GetWorldAABB(); playableArea = playableArea?.Union(aabb) ?? aabb; } @@ -112,7 +111,7 @@ namespace Content.Server.StationEvents.Events var offset = angle.RotateVec(new Vector2((maximumDistance - minimumDistance) * _robustRandom.NextFloat() + minimumDistance, 0)); var spawnPosition = new MapCoordinates(center + offset, mapId); var meteor = _entityManager.SpawnEntity("MeteorLarge", spawnPosition); - var physics = _compManager.GetComponent(meteor.Uid); + var physics = _entityManager.GetComponent(meteor.Uid); physics.BodyStatus = BodyStatus.InAir; physics.ApplyLinearImpulse(-offset.Normalized * MeteorVelocity * physics.Mass); physics.ApplyAngularImpulse( diff --git a/Content.Server/StationEvents/Events/PowerGridCheck.cs b/Content.Server/StationEvents/Events/PowerGridCheck.cs index 999b7f9268..43e632b975 100644 --- a/Content.Server/StationEvents/Events/PowerGridCheck.cs +++ b/Content.Server/StationEvents/Events/PowerGridCheck.cs @@ -38,9 +38,9 @@ namespace Content.Server.StationEvents.Events public override void Startup() { - var componentManager = IoCManager.Resolve(); + var entityManager = IoCManager.Resolve(); - foreach (var component in componentManager.EntityQuery(true)) + foreach (var component in entityManager.EntityQuery(true)) { component.PowerDisabled = true; _powered.Add(component.Owner); diff --git a/Content.Server/Storage/Components/CursedEntityStorageComponent.cs b/Content.Server/Storage/Components/CursedEntityStorageComponent.cs index 9606dddcd9..cd51d95045 100644 --- a/Content.Server/Storage/Components/CursedEntityStorageComponent.cs +++ b/Content.Server/Storage/Components/CursedEntityStorageComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.Storage.Components // No contents, we do nothing if (Contents.ContainedEntities.Count == 0) return; - var lockers = Owner.EntityManager.ComponentManager.EntityQuery().Select(c => c.Owner).ToList(); + var lockers = Owner.EntityManager.EntityQuery().Select(c => c.Owner).ToList(); if (lockers.Contains(Owner)) lockers.Remove(Owner); diff --git a/Content.Server/Storage/EntitySystems/StorageSystem.cs b/Content.Server/Storage/EntitySystems/StorageSystem.cs index e5e7bee2fa..657725b81e 100644 --- a/Content.Server/Storage/EntitySystems/StorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/StorageSystem.cs @@ -31,7 +31,7 @@ namespace Content.Server.Storage.EntitySystems private void OnRelayMovement(EntityUid uid, EntityStorageComponent component, RelayMovementEntityEvent args) { - if (ComponentManager.HasComponent(uid)) + if (EntityManager.HasComponent(uid)) { if (_gameTiming.CurTime < component.LastInternalOpenAttempt + EntityStorageComponent.InternalOpenAttemptDelay) @@ -47,7 +47,7 @@ namespace Content.Server.Storage.EntitySystems /// public override void Update(float frameTime) { - foreach (var component in ComponentManager.EntityQuery(true)) + foreach (var component in EntityManager.EntityQuery(true)) { CheckSubscribedEntities(component); } diff --git a/Content.Server/Stunnable/StunbatonSystem.cs b/Content.Server/Stunnable/StunbatonSystem.cs index 57073cd59b..e1b29bee8b 100644 --- a/Content.Server/Stunnable/StunbatonSystem.cs +++ b/Content.Server/Stunnable/StunbatonSystem.cs @@ -41,7 +41,7 @@ namespace Content.Server.Stunnable if (!comp.Activated || !args.HitEntities.Any()) return; - if (!ComponentManager.TryGetComponent(uid, out var slot) || slot.Cell == null || !slot.Cell.TryUseCharge(comp.EnergyPerUse)) + if (!EntityManager.TryGetComponent(uid, out var slot) || slot.Cell == null || !slot.Cell.TryUseCharge(comp.EnergyPerUse)) return; foreach (IEntity entity in args.HitEntities) @@ -55,7 +55,7 @@ namespace Content.Server.Stunnable if (!comp.Activated) return; - if (!ComponentManager.TryGetComponent(uid, out var slot) || slot.Cell == null || !slot.Cell.TryUseCharge(comp.EnergyPerUse)) + if (!EntityManager.TryGetComponent(uid, out var slot) || slot.Cell == null || !slot.Cell.TryUseCharge(comp.EnergyPerUse)) return; if (args.Entity.HasComponent()) @@ -82,7 +82,7 @@ namespace Content.Server.Stunnable private void OnThrowCollide(EntityUid uid, StunbatonComponent comp, ThrowDoHitEvent args) { - if (!ComponentManager.TryGetComponent(uid, out var slot)) return; + if (!EntityManager.TryGetComponent(uid, out var slot)) return; if (!comp.Activated || slot.Cell == null || !slot.Cell.TryUseCharge(comp.EnergyPerUse)) return; StunEntity(args.Target, comp); @@ -101,7 +101,7 @@ namespace Content.Server.Stunnable if (!Get().CanInteract(args.User)) return; - if (ComponentManager.TryGetComponent(uid, out var cellslot)) + if (EntityManager.TryGetComponent(uid, out var cellslot)) cellslot.InsertCell(args.Used); } diff --git a/Content.Server/Tabletop/TabletopSystem.Draggable.cs b/Content.Server/Tabletop/TabletopSystem.Draggable.cs index 7e31ba7909..a12292dc6c 100644 --- a/Content.Server/Tabletop/TabletopSystem.Draggable.cs +++ b/Content.Server/Tabletop/TabletopSystem.Draggable.cs @@ -28,7 +28,7 @@ namespace Content.Server.Tabletop if (args.SenderSession as IPlayerSession is not { AttachedEntity: { } playerEntity } playerSession) return; - if (!ComponentManager.TryGetComponent(msg.TableUid, out TabletopGameComponent? tabletop) || tabletop.Session is not {} session) + if (!EntityManager.TryGetComponent(msg.TableUid, out TabletopGameComponent? tabletop) || tabletop.Session is not {} session) return; // Check if player is actually playing at this table @@ -46,13 +46,13 @@ namespace Content.Server.Tabletop if (!EntityManager.TryGetEntity(msg.MovedEntityUid, out var movedEntity)) return; - if (!ComponentManager.HasComponent(movedEntity.Uid)) + if (!EntityManager.HasComponent(movedEntity.Uid)) return; // TODO: some permission system, disallow movement if you're not permitted to move the item // Move the entity and dirty it (we use the map ID from the entity so noone can try to be funny and move the item to another map) - var transform = ComponentManager.GetComponent(movedEntity.Uid); + var transform = EntityManager.GetComponent(movedEntity.Uid); var entityCoordinates = new EntityCoordinates(_mapManager.GetMapEntityId(transform.MapID), msg.Coordinates.Position); transform.Coordinates = entityCoordinates; movedEntity.Dirty(); diff --git a/Content.Server/Tabletop/TabletopSystem.Map.cs b/Content.Server/Tabletop/TabletopSystem.Map.cs index eebd4894d7..0aaeea7dee 100644 --- a/Content.Server/Tabletop/TabletopSystem.Map.cs +++ b/Content.Server/Tabletop/TabletopSystem.Map.cs @@ -52,7 +52,7 @@ namespace Content.Server.Tabletop TabletopMap = _mapManager.CreateMap(); _tabletops = 0; - var mapComp = ComponentManager.GetComponent(_mapManager.GetMapEntityId(TabletopMap)); + var mapComp = EntityManager.GetComponent(_mapManager.GetMapEntityId(TabletopMap)); // Lighting is always disabled in tabletop world. mapComp.LightingEnabled = false; diff --git a/Content.Server/Tabletop/TabletopSystem.Session.cs b/Content.Server/Tabletop/TabletopSystem.Session.cs index 97d3e6cef3..e5bdd14b11 100644 --- a/Content.Server/Tabletop/TabletopSystem.Session.cs +++ b/Content.Server/Tabletop/TabletopSystem.Session.cs @@ -46,7 +46,7 @@ namespace Content.Server.Tabletop /// The UID of the tabletop game entity. public void CleanupSession(EntityUid uid) { - if (!ComponentManager.TryGetComponent(uid, out TabletopGameComponent? tabletop)) + if (!EntityManager.TryGetComponent(uid, out TabletopGameComponent? tabletop)) return; if (tabletop.Session is not { } session) @@ -72,7 +72,7 @@ namespace Content.Server.Tabletop /// The UID of the tabletop game entity. public void OpenSessionFor(IPlayerSession player, EntityUid uid) { - if (!ComponentManager.TryGetComponent(uid, out TabletopGameComponent? tabletop) || player.AttachedEntity is not {} attachedEntity) + if (!EntityManager.TryGetComponent(uid, out TabletopGameComponent? tabletop) || player.AttachedEntity is not {} attachedEntity) return; // Make sure we have a session, and add the player to it if not added already. @@ -104,7 +104,7 @@ namespace Content.Server.Tabletop /// Whether to remove the from the player's attached entity. public void CloseSessionFor(IPlayerSession player, EntityUid uid, bool removeGamerComponent = true) { - if (!ComponentManager.TryGetComponent(uid, out TabletopGameComponent? tabletop) || tabletop.Session is not { } session) + if (!EntityManager.TryGetComponent(uid, out TabletopGameComponent? tabletop) || tabletop.Session is not { } session) return; if (!session.Players.TryGetValue(player, out var data)) diff --git a/Content.Server/Tabletop/TabletopSystem.cs b/Content.Server/Tabletop/TabletopSystem.cs index 7fe9fd53e5..7c1b5f13b9 100644 --- a/Content.Server/Tabletop/TabletopSystem.cs +++ b/Content.Server/Tabletop/TabletopSystem.cs @@ -36,7 +36,7 @@ namespace Content.Server.Tabletop private void OnTabletopActivate(EntityUid uid, TabletopGameComponent component, ActivateInWorldEvent args) { // Check that a player is attached to the entity. - if (!ComponentManager.TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!EntityManager.TryGetComponent(args.User.Uid, out ActorComponent? actor)) return; // Check that the entity can interact with the game board. @@ -62,7 +62,7 @@ namespace Content.Server.Tabletop private void OnGamerShutdown(EntityUid uid, TabletopGamerComponent component, ComponentShutdown args) { - if (!ComponentManager.TryGetComponent(uid, out ActorComponent? actor)) + if (!EntityManager.TryGetComponent(uid, out ActorComponent? actor)) return; if(component.Tabletop.IsValid()) @@ -73,7 +73,7 @@ namespace Content.Server.Tabletop { base.Update(frameTime); - foreach (var gamer in ComponentManager.EntityQuery(true)) + foreach (var gamer in EntityManager.EntityQuery(true)) { if (!EntityManager.TryGetEntity(gamer.Tabletop, out var table)) continue; diff --git a/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs b/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs index a3fc0d2c06..49277ae485 100644 --- a/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs +++ b/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs @@ -132,7 +132,7 @@ namespace Content.Server.Weapon.Melee if (entity.IsInContainer() || entity == args.User) continue; - if (ComponentManager.HasComponent(entity.Uid)) + if (EntityManager.HasComponent(entity.Uid)) { hitEntities.Add(entity); } diff --git a/Content.Server/Wieldable/WieldableSystem.cs b/Content.Server/Wieldable/WieldableSystem.cs index 2500ae8a3c..fabb5bd06f 100644 --- a/Content.Server/Wieldable/WieldableSystem.cs +++ b/Content.Server/Wieldable/WieldableSystem.cs @@ -46,7 +46,7 @@ namespace Content.Server.Wieldable public bool CanWield(EntityUid uid, WieldableComponent component, IEntity user, bool quiet=false) { // Do they have enough hands free? - if (!ComponentManager.TryGetComponent(user.Uid, out var hands)) + if (!EntityManager.TryGetComponent(user.Uid, out var hands)) { if(!quiet) user.PopupMessage(Loc.GetString("wieldable-component-no-hands")); @@ -138,7 +138,7 @@ namespace Content.Server.Wieldable if (!CanWield(uid, component, args.User) || component.Wielded) return; - if (ComponentManager.TryGetComponent(uid, out var item)) + if (EntityManager.TryGetComponent(uid, out var item)) { component.OldInhandPrefix = item.EquippedPrefix; item.EquippedPrefix = component.WieldedInhandPrefix; @@ -167,7 +167,7 @@ namespace Content.Server.Wieldable if (!component.Wielded) return; - if (ComponentManager.TryGetComponent(uid, out var item)) + if (EntityManager.TryGetComponent(uid, out var item)) { item.EquippedPrefix = component.OldInhandPrefix; } @@ -204,7 +204,7 @@ namespace Content.Server.Wieldable private void OnMeleeHit(EntityUid uid, IncreaseDamageOnWieldComponent component, MeleeHitEvent args) { - if (ComponentManager.TryGetComponent(uid, out var wield)) + if (EntityManager.TryGetComponent(uid, out var wield)) { if (!wield.Wielded) return; diff --git a/Content.Shared/Actions/SharedActionSystem.cs b/Content.Shared/Actions/SharedActionSystem.cs index a5d90216ee..114907c12f 100644 --- a/Content.Shared/Actions/SharedActionSystem.cs +++ b/Content.Shared/Actions/SharedActionSystem.cs @@ -19,7 +19,7 @@ namespace Content.Shared.Actions _timeSinceCooldownCheck += frameTime; if (_timeSinceCooldownCheck < CooldownCheckIntervalSeconds) return; - foreach (var comp in ComponentManager.EntityQuery(false)) + foreach (var comp in EntityManager.EntityQuery(false)) { comp.ExpireCooldowns(); } diff --git a/Content.Shared/Audio/SharedAmbientSoundSystem.cs b/Content.Shared/Audio/SharedAmbientSoundSystem.cs index f5500e69e5..0922024f0b 100644 --- a/Content.Shared/Audio/SharedAmbientSoundSystem.cs +++ b/Content.Shared/Audio/SharedAmbientSoundSystem.cs @@ -17,7 +17,7 @@ namespace Content.Shared.Audio // Reason I didn't make this eventbus for the callers is because it seemed a bit silly // trying to account for damageable + powered + toggle, plus we can't just check if it's powered. // So we'll just call it directly for whatever. - if (!ComponentManager.TryGetComponent(uid, out var ambience) || + if (!EntityManager.TryGetComponent(uid, out var ambience) || ambience.Enabled == value) return; ambience.Enabled = value; diff --git a/Content.Shared/Body/Mechanism/MechanismSystem.cs b/Content.Shared/Body/Mechanism/MechanismSystem.cs index af5057fd55..afed4bda57 100644 --- a/Content.Shared/Body/Mechanism/MechanismSystem.cs +++ b/Content.Shared/Body/Mechanism/MechanismSystem.cs @@ -10,7 +10,7 @@ namespace Content.Shared.Body.Mechanism { base.Update(frameTime); - foreach (var mechanism in ComponentManager.EntityQuery(true)) + foreach (var mechanism in EntityManager.EntityQuery(true)) { mechanism.Update(frameTime); } diff --git a/Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.Capabilities.cs b/Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.Capabilities.cs index 8885f0db26..06bee7b4e5 100644 --- a/Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.Capabilities.cs +++ b/Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.Capabilities.cs @@ -10,7 +10,7 @@ namespace Content.Shared.Chemistry.EntitySystems { public void Refill(EntityUid targetUid, Solution targetSolution, Solution addedSolution) { - if (!ComponentManager.HasComponent(targetUid)) + if (!EntityManager.HasComponent(targetUid)) return; TryAddSolution(targetUid, targetSolution, addedSolution); @@ -18,7 +18,7 @@ namespace Content.Shared.Chemistry.EntitySystems public void Inject(EntityUid targetUid, Solution targetSolution, Solution addedSolution) { - if (!ComponentManager.HasComponent(targetUid)) + if (!EntityManager.HasComponent(targetUid)) return; TryAddSolution(targetUid, targetSolution, addedSolution); @@ -26,7 +26,7 @@ namespace Content.Shared.Chemistry.EntitySystems public Solution Draw(EntityUid targetUid, Solution solution, ReagentUnit amount) { - if (!ComponentManager.HasComponent(targetUid)) + if (!EntityManager.HasComponent(targetUid)) { return new Solution(); } @@ -36,7 +36,7 @@ namespace Content.Shared.Chemistry.EntitySystems public Solution Drain(EntityUid targetUid, Solution targetSolution, ReagentUnit amount) { - if (!ComponentManager.HasComponent(targetUid)) + if (!EntityManager.HasComponent(targetUid)) { return new Solution(); } @@ -47,8 +47,8 @@ namespace Content.Shared.Chemistry.EntitySystems public bool TryGetInjectableSolution(EntityUid targetUid, [NotNullWhen(true)] out Solution? solution) { - if (ComponentManager.TryGetComponent(targetUid, out InjectableSolutionComponent? injectable) && - ComponentManager.TryGetComponent(targetUid, out SolutionContainerManagerComponent? manager) && + if (EntityManager.TryGetComponent(targetUid, out InjectableSolutionComponent? injectable) && + EntityManager.TryGetComponent(targetUid, out SolutionContainerManagerComponent? manager) && manager.Solutions.TryGetValue(injectable.Solution, out solution)) { return true; @@ -61,8 +61,8 @@ namespace Content.Shared.Chemistry.EntitySystems public bool TryGetRefillableSolution(EntityUid targetUid, [NotNullWhen(true)] out Solution? solution) { - if (ComponentManager.TryGetComponent(targetUid, out RefillableSolutionComponent? refillable) && - ComponentManager.TryGetComponent(targetUid, out SolutionContainerManagerComponent? manager) && + if (EntityManager.TryGetComponent(targetUid, out RefillableSolutionComponent? refillable) && + EntityManager.TryGetComponent(targetUid, out SolutionContainerManagerComponent? manager) && manager.Solutions.TryGetValue(refillable.Solution, out var refillableSolution)) { solution = refillableSolution; @@ -76,9 +76,9 @@ namespace Content.Shared.Chemistry.EntitySystems public bool TryGetDrainableSolution(EntityUid targetUid, [NotNullWhen(true)] out Solution? solution) { - if (ComponentManager.TryGetComponent(targetUid,out DrainableSolutionComponent? drainable) && - ComponentManager.TryGetComponent(targetUid,out SolutionContainerManagerComponent? manager) && - manager.Solutions.TryGetValue(drainable.Solution, out solution)) + if (EntityManager.TryGetComponent(targetUid,out DrainableSolutionComponent? drainable) && + EntityManager.TryGetComponent(targetUid,out SolutionContainerManagerComponent? manager) && + manager.Solutions.TryGetValue(drainable.Solution, out solution)) { return true; } diff --git a/Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.cs b/Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.cs index 6f51044f1e..ef9254afb3 100644 --- a/Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.cs +++ b/Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.cs @@ -144,7 +144,7 @@ namespace Content.Shared.Chemistry.EntitySystems public void RemoveAllSolution(EntityUid uid) { - if (!ComponentManager.TryGetComponent(uid, out SolutionContainerManagerComponent? solutionContainerManager)) + if (!EntityManager.TryGetComponent(uid, out SolutionContainerManagerComponent? solutionContainerManager)) return; foreach (var solution in solutionContainerManager.Solutions.Values) @@ -224,7 +224,7 @@ namespace Content.Shared.Chemistry.EntitySystems public bool TryGetSolution(EntityUid uid, string name, [NotNullWhen(true)] out Solution? solution) { - if (!ComponentManager.TryGetComponent(uid, out SolutionContainerManagerComponent? solutionsMgr)) + if (!EntityManager.TryGetComponent(uid, out SolutionContainerManagerComponent? solutionsMgr)) { solution = null; return false; diff --git a/Content.Shared/Chemistry/MetabolismMovespeedModifierSystem.cs b/Content.Shared/Chemistry/MetabolismMovespeedModifierSystem.cs index ba4f52ba43..62499006a8 100644 --- a/Content.Shared/Chemistry/MetabolismMovespeedModifierSystem.cs +++ b/Content.Shared/Chemistry/MetabolismMovespeedModifierSystem.cs @@ -29,9 +29,9 @@ namespace Content.Shared.Chemistry if (args.Current is not MovespeedModifierMetabolismComponentState cast) return; - if (ComponentManager.TryGetComponent(uid, out var modifier) && + if (EntityManager.TryGetComponent(uid, out var modifier) && (!component.WalkSpeedModifier.Equals(cast.WalkSpeedModifier) || - !component.SprintSpeedModifier.Equals(cast.SprintSpeedModifier))) + !component.SprintSpeedModifier.Equals(cast.SprintSpeedModifier))) { modifier.RefreshMovementSpeedModifiers(); } @@ -65,7 +65,7 @@ namespace Content.Shared.Chemistry if (component.ModifierTimer > currentTime) continue; _components.RemoveAt(i); - ComponentManager.RemoveComponent(component.Owner.Uid); + EntityManager.RemoveComponent(component.Owner.Uid); if (component.Owner.TryGetComponent(out MovementSpeedModifierComponent? modifier)) { diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs index 2891da884c..473925515e 100644 --- a/Content.Shared/Cuffs/SharedCuffableSystem.cs +++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs @@ -16,7 +16,7 @@ namespace Content.Shared.Cuffs private void HandleMoveAttempt(EntityUid uid, SharedCuffableComponent component, MovementAttemptEvent args) { - if (component.CanStillInteract || !ComponentManager.TryGetComponent(uid, out SharedPullableComponent? pullable) || !pullable.BeingPulled) + if (component.CanStillInteract || !EntityManager.TryGetComponent(uid, out SharedPullableComponent? pullable) || !pullable.BeingPulled) return; args.Cancel(); diff --git a/Content.Shared/Damage/DamageableSystem.cs b/Content.Shared/Damage/DamageableSystem.cs index a918c16434..117dfebba9 100644 --- a/Content.Shared/Damage/DamageableSystem.cs +++ b/Content.Shared/Damage/DamageableSystem.cs @@ -100,7 +100,7 @@ namespace Content.Shared.Damage /// public DamageSpecifier? TryChangeDamage(EntityUid uid, DamageSpecifier damage, bool ignoreResistances = false) { - if (!ComponentManager.TryGetComponent(uid, out var damageable)) + if (!EntityManager.TryGetComponent(uid, out var damageable)) { // TODO BODY SYSTEM pass damage onto body system return null; diff --git a/Content.Shared/Disposal/SharedDisposalUnitSystem.cs b/Content.Shared/Disposal/SharedDisposalUnitSystem.cs index 84cc3e0506..e3aa904c2f 100644 --- a/Content.Shared/Disposal/SharedDisposalUnitSystem.cs +++ b/Content.Shared/Disposal/SharedDisposalUnitSystem.cs @@ -34,8 +34,8 @@ namespace Content.Shared.Disposal var otherBody = args.BodyB.Owner.Uid; // Items dropped shouldn't collide but items thrown should - if (ComponentManager.HasComponent(otherBody) && - !ComponentManager.HasComponent(otherBody)) + if (EntityManager.HasComponent(otherBody) && + !EntityManager.HasComponent(otherBody)) { args.Cancel(); return; diff --git a/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs b/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs index 42abb1c66c..f7bca869a5 100644 --- a/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs @@ -40,7 +40,7 @@ namespace Content.Shared.Nutrition.EntitySystems creamPied.CreamPied = value; - if (ComponentManager.TryGetComponent(uid, out SharedAppearanceComponent? appearance)) + if (EntityManager.TryGetComponent(uid, out SharedAppearanceComponent? appearance)) { appearance.SetData(CreamPiedVisuals.Creamed, value); } @@ -64,7 +64,7 @@ namespace Content.Shared.Nutrition.EntitySystems CreamedEntity(uid, creamPied, args); - if (ComponentManager.TryGetComponent(uid, out SharedStunnableComponent? stun)) + if (EntityManager.TryGetComponent(uid, out SharedStunnableComponent? stun)) { stun.Paralyze(creamPie.ParalyzeTime); } diff --git a/Content.Shared/Pulling/Systems/SharedPullerSystem.cs b/Content.Shared/Pulling/Systems/SharedPullerSystem.cs index 7f2ed7262c..d4cd71e31c 100644 --- a/Content.Shared/Pulling/Systems/SharedPullerSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullerSystem.cs @@ -26,7 +26,7 @@ namespace Content.Shared.Pulling.Systems if (component.Pulling == EntityManager.GetEntity(args.BlockingEntity)) { - if (ComponentManager.TryGetComponent(args.BlockingEntity, out var comp)) + if (EntityManager.TryGetComponent(args.BlockingEntity, out var comp)) { comp.TryStopPull(EntityManager.GetEntity(uid)); } diff --git a/Content.Shared/Slippery/SharedSlipperySystem.cs b/Content.Shared/Slippery/SharedSlipperySystem.cs index 7ddde559aa..e23a0a0857 100644 --- a/Content.Shared/Slippery/SharedSlipperySystem.cs +++ b/Content.Shared/Slippery/SharedSlipperySystem.cs @@ -50,7 +50,7 @@ namespace Content.Shared.Slippery if (!component.Slippery || component.Owner.IsInContainer() || component.Slipped.Contains(uid) - || !ComponentManager.TryGetComponent(uid, out stunnableComponent)) + || !EntityManager.TryGetComponent(uid, out stunnableComponent)) { stunnableComponent = null; return false; @@ -99,7 +99,7 @@ namespace Content.Shared.Slippery if (component.Deleted || !component.Slippery || component.Colliding.Count == 0) return true; - if (!ComponentManager.TryGetComponent(component.Owner.Uid, out PhysicsComponent? body)) + if (!EntityManager.TryGetComponent(component.Owner.Uid, out PhysicsComponent? body)) { component.Colliding.Clear(); return true; diff --git a/Content.Shared/Stunnable/StunSystem.cs b/Content.Shared/Stunnable/StunSystem.cs index bd44708f96..e73c8d7123 100644 --- a/Content.Shared/Stunnable/StunSystem.cs +++ b/Content.Shared/Stunnable/StunSystem.cs @@ -23,7 +23,7 @@ namespace Content.Shared.Stunnable { base.Update(frameTime); - foreach (var component in ComponentManager.EntityQuery(true)) + foreach (var component in EntityManager.EntityQuery(true)) { component.Update(frameTime); } diff --git a/Content.Shared/SubFloor/SubFloorHideSystem.cs b/Content.Shared/SubFloor/SubFloorHideSystem.cs index f386ad4a5b..21b01cc898 100644 --- a/Content.Shared/SubFloor/SubFloorHideSystem.cs +++ b/Content.Shared/SubFloor/SubFloorHideSystem.cs @@ -118,7 +118,7 @@ namespace Content.Shared.SubFloor private void UpdateAll() { - foreach (var comp in ComponentManager.EntityQuery(true)) + foreach (var comp in EntityManager.EntityQuery(true)) { UpdateEntity(comp.Owner.Uid); } @@ -130,14 +130,14 @@ namespace Content.Shared.SubFloor foreach (var uid in grid.GetAnchoredEntities(position)) { - if(ComponentManager.HasComponent(uid)) + if(EntityManager.HasComponent(uid)) UpdateEntity(uid, isSubFloor); } } private void UpdateEntity(EntityUid uid) { - var transform = ComponentManager.GetComponent(uid); + var transform = EntityManager.GetComponent(uid); if (!_mapManager.TryGetGrid(transform.GridID, out var grid)) { @@ -162,7 +162,7 @@ namespace Content.Shared.SubFloor // We only need to query the subfloor component to check if it's enabled or not when we're not on subfloor. // Getting components is expensive, after all. - if (!subFloor && ComponentManager.TryGetComponent(uid, out SubFloorHideComponent? subFloorHideComponent)) + if (!subFloor && EntityManager.TryGetComponent(uid, out SubFloorHideComponent? subFloorHideComponent)) { // If the component isn't enabled, then subfloor will always be true, and the entity will be shown. if (!subFloorHideComponent.Enabled) @@ -170,7 +170,7 @@ namespace Content.Shared.SubFloor subFloor = true; } // We only need to query the TransformComp if the SubfloorHide is enabled and requires anchoring. - else if (subFloorHideComponent.RequireAnchored && ComponentManager.TryGetComponent(uid, out ITransformComponent? transformComponent)) + else if (subFloorHideComponent.RequireAnchored && EntityManager.TryGetComponent(uid, out ITransformComponent? transformComponent)) { // If we require the entity to be anchored but it's not, this will set subfloor to true, unhiding it. subFloor = !transformComponent.Anchored; @@ -181,19 +181,19 @@ namespace Content.Shared.SubFloor var subFloorVisible = ShowAll || subFloor; // Show sprite - if (ComponentManager.TryGetComponent(uid, out SharedSpriteComponent? spriteComponent)) + if (EntityManager.TryGetComponent(uid, out SharedSpriteComponent? spriteComponent)) { spriteComponent.Visible = subFloorVisible; } // Set an appearance data value so visualizers can use this as needed. - if (ComponentManager.TryGetComponent(uid, out SharedAppearanceComponent? appearanceComponent)) + if (EntityManager.TryGetComponent(uid, out SharedAppearanceComponent? appearanceComponent)) { appearanceComponent.SetData(SubFloorVisuals.SubFloor, subFloorVisible); } // So for collision all we care about is that the component is running. - if (ComponentManager.TryGetComponent(uid, out PhysicsComponent? physicsComponent)) + if (EntityManager.TryGetComponent(uid, out PhysicsComponent? physicsComponent)) { physicsComponent.CanCollide = subFloor; } diff --git a/Content.Shared/Throwing/ThrownItemSystem.cs b/Content.Shared/Throwing/ThrownItemSystem.cs index 509ed1f6af..51ed84842f 100644 --- a/Content.Shared/Throwing/ThrownItemSystem.cs +++ b/Content.Shared/Throwing/ThrownItemSystem.cs @@ -98,7 +98,7 @@ namespace Content.Shared.Throwing if (thrownItem.Owner.TryGetContainerMan(out var containerManager) && containerManager.Owner.HasComponent()) { - ComponentManager.RemoveComponent(landing.Uid, thrownItem); + EntityManager.RemoveComponent(landing.Uid, thrownItem); return; } @@ -108,7 +108,7 @@ namespace Content.Shared.Throwing var landMsg = new LandEvent(user, landing, coordinates); RaiseLocalEvent(landing.Uid, landMsg, false); - ComponentManager.RemoveComponent(landing.Uid, thrownItem); + EntityManager.RemoveComponent(landing.Uid, thrownItem); } ///