diff --git a/Content.Client/AI/ClientPathfindingDebugSystem.cs b/Content.Client/AI/ClientPathfindingDebugSystem.cs index 1ea8bd4fe4..1068bcae54 100644 --- a/Content.Client/AI/ClientPathfindingDebugSystem.cs +++ b/Content.Client/AI/ClientPathfindingDebugSystem.cs @@ -18,6 +18,12 @@ namespace Content.Client.AI #if DEBUG public class ClientPathfindingDebugSystem : EntitySystem { + [Dependency] private readonly IOverlayManager _overlayManager = default!; + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + [Dependency] private readonly IEyeManager _eyeManager = default!; + [Dependency] private readonly IPlayerManager _playerManager = default!; + + private PathfindingDebugMode _modes = PathfindingDebugMode.None; private float _routeDuration = 4.0f; // How long before we remove a route from the overlay private DebugPathfindingOverlay? _overlay; @@ -91,7 +97,7 @@ namespace Content.Client.AI } var overlayManager = IoCManager.Resolve(); - _overlay = new DebugPathfindingOverlay {Modes = _modes}; + _overlay = new DebugPathfindingOverlay(EntityManager, _eyeManager, _playerManager, _prototypeManager) {Modes = _modes}; overlayManager.AddOverlay(_overlay); return _overlay; @@ -210,12 +216,12 @@ namespace Content.Client.AI public readonly List AStarRoutes = new(); public readonly List JpsRoutes = new(); - public DebugPathfindingOverlay() + public DebugPathfindingOverlay(IEntityManager entities, IEyeManager eyeManager, IPlayerManager playerManager, IPrototypeManager prototypeManager) { - _shader = IoCManager.Resolve().Index("unshaded").Instance(); - _eyeManager = IoCManager.Resolve(); - _playerManager = IoCManager.Resolve(); - _entities = IoCManager.Resolve(); + _entities = entities; + _eyeManager = eyeManager; + _playerManager = playerManager; + _shader = prototypeManager.Index("unshaded").Instance(); } #region Graph diff --git a/Content.Client/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs b/Content.Client/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs index ba26c62db0..b12a2339ba 100644 --- a/Content.Client/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs +++ b/Content.Client/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs @@ -107,13 +107,12 @@ namespace Content.Client.CharacterAppearance.Systems // Scaffolding until Body is moved to ECS. private void BodyPartAdded(HumanoidAppearanceBodyPartAddedEvent args) { - var entityManager = IoCManager.Resolve(); - if (!entityManager.TryGetComponent(args.Uid, out SpriteComponent? sprite)) + if (!EntityManager.TryGetComponent(args.Uid, out SpriteComponent? sprite)) { return; } - if (!entityManager.HasComponent(args.Args.Part.Owner)) + if (!EntityManager.HasComponent(args.Args.Part.Owner)) { return; } diff --git a/Content.Client/Popups/PopupSystem.cs b/Content.Client/Popups/PopupSystem.cs index 8562eac402..eb4e447917 100644 --- a/Content.Client/Popups/PopupSystem.cs +++ b/Content.Client/Popups/PopupSystem.cs @@ -53,7 +53,7 @@ namespace Content.Client.Popups public void PopupMessage(string message, ScreenCoordinates coordinates, EntityUid entity = default) { - var label = new PopupLabel(_eyeManager) + var label = new PopupLabel(_eyeManager, EntityManager) { Entity = entity, Text = message, @@ -142,14 +142,16 @@ namespace Content.Client.Popups private class PopupLabel : Label { private readonly IEyeManager _eyeManager; + private readonly IEntityManager _entityManager; public float TimeLeft { get; private set; } public Vector2 InitialPos { get; set; } public EntityUid Entity { get; set; } - public PopupLabel(IEyeManager eyeManager) + public PopupLabel(IEyeManager eyeManager, IEntityManager entityManager) { _eyeManager = eyeManager; + _entityManager = entityManager; ShadowOffsetXOverride = 1; ShadowOffsetYOverride = 1; FontColorShadowOverride = Color.Black; @@ -161,7 +163,7 @@ namespace Content.Client.Popups var position = Entity == default ? InitialPos - : (_eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(Entity).Coordinates).Position / UIScale) - DesiredSize / 2; + : (_eyeManager.CoordinatesToScreen(_entityManager.GetComponent(Entity).Coordinates).Position / UIScale) - DesiredSize / 2; LayoutContainer.SetPosition(this, position - (0, 20 * (TimeLeft * TimeLeft + TimeLeft))); diff --git a/Content.Server/Body/Systems/MetabolizerSystem.cs b/Content.Server/Body/Systems/MetabolizerSystem.cs index 81adef2e9b..792b71ecea 100644 --- a/Content.Server/Body/Systems/MetabolizerSystem.cs +++ b/Content.Server/Body/Systems/MetabolizerSystem.cs @@ -165,7 +165,7 @@ namespace Content.Server.Body.Systems { var entity = args.SolutionEntity; _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, - $"Metabolism effect {effect.GetType().Name} of reagent {args.Reagent.Name:reagent} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity).Coordinates}"); + $"Metabolism effect {effect.GetType().Name} of reagent {args.Reagent.Name:reagent} applied on entity {entity} at {EntityManager.GetComponent(entity).Coordinates}"); } effect.Effect(args); diff --git a/Content.Server/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs b/Content.Server/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs index 6146ec96d7..1866ff3c6b 100644 --- a/Content.Server/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs +++ b/Content.Server/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs @@ -22,7 +22,7 @@ namespace Content.Server.CharacterAppearance.Systems { foreach (var (part, _) in body.Parts) { - if (IoCManager.Resolve().TryGetComponent(part.Owner, out SpriteComponent? sprite)) + if (EntityManager.TryGetComponent(part.Owner, out SpriteComponent? sprite)) { sprite!.Color = component.Appearance.SkinColor; } diff --git a/Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs b/Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs index 414b12f276..1642319c08 100644 --- a/Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs +++ b/Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs @@ -35,7 +35,7 @@ namespace Content.Server.Containers { if (!EntityManager.TryGetComponent(uid, out var mComp)) return; - var baseCoords = IoCManager.Resolve().GetComponent(component.Owner).Coordinates; + var baseCoords = EntityManager.GetComponent(component.Owner).Coordinates; foreach (var v in component.Containers) { if (mComp.TryGetContainer(v, out var container)) diff --git a/Content.Server/Light/EntitySystems/MatchboxSystem.cs b/Content.Server/Light/EntitySystems/MatchboxSystem.cs index 1e43ec6dbe..434c036898 100644 --- a/Content.Server/Light/EntitySystems/MatchboxSystem.cs +++ b/Content.Server/Light/EntitySystems/MatchboxSystem.cs @@ -17,7 +17,7 @@ namespace Content.Server.Light.EntitySystems private void OnInteractUsing(EntityUid uid, MatchboxComponent component, InteractUsingEvent args) { if (!args.Handled - && IoCManager.Resolve().TryGetComponent(args.Used, out var matchstick) + && EntityManager.TryGetComponent(args.Used, out var matchstick) && matchstick.CurrentState == SmokableState.Unlit) { Get().Ignite(matchstick, args.User); diff --git a/Content.Server/Movement/StressTestMovementSystem.cs b/Content.Server/Movement/StressTestMovementSystem.cs index 087aee0d83..317a5bfe97 100644 --- a/Content.Server/Movement/StressTestMovementSystem.cs +++ b/Content.Server/Movement/StressTestMovementSystem.cs @@ -16,7 +16,7 @@ namespace Content.Server.Movement foreach (var stressTest in EntityManager.EntityQuery(true)) { - var transform = IoCManager.Resolve().GetComponent(stressTest.Owner); + var transform = EntityManager.GetComponent(stressTest.Owner); stressTest.Progress += frameTime;