diff --git a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs index 0c5daace70..f3607ae1d2 100644 --- a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs +++ b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs @@ -25,8 +25,6 @@ namespace Content.Client.GameObjects.Components.Storage [RegisterComponent] public class ClientStorageComponent : SharedStorageComponent, IDraggable { - [Dependency] private readonly IEntityManager _entityManager = default!; - private List _storedEntities = new List(); private int StorageSizeUsed; private int StorageCapacityMax; @@ -58,7 +56,7 @@ namespace Content.Client.GameObjects.Components.Storage } _storedEntities = state.StoredEntities - .Select(id => _entityManager.GetEntity(id)) + .Select(id => Owner.EntityManager.GetEntity(id)) .ToList(); } @@ -88,7 +86,7 @@ namespace Content.Client.GameObjects.Components.Storage /// private void HandleStorageMessage(StorageHeldItemsMessage storageState) { - _storedEntities = storageState.StoredEntities.Select(id => _entityManager.GetEntity(id)).ToList(); + _storedEntities = storageState.StoredEntities.Select(id => Owner.EntityManager.GetEntity(id)).ToList(); StorageSizeUsed = storageState.StorageSizeUsed; StorageCapacityMax = storageState.StorageSizeMax; Window.BuildEntityList(); diff --git a/Content.Client/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs b/Content.Client/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs index 3739093ea1..99e0153e3e 100644 --- a/Content.Client/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs +++ b/Content.Client/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs @@ -21,7 +21,6 @@ namespace Content.Client.GameObjects.Components.Suspicion public class SuspicionRoleComponent : SharedSuspicionRoleComponent { [Dependency] private readonly IGameHud _gameHud = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IOverlayManager _overlayManager = default!; [Dependency] private readonly IResourceCache _resourceCache = default!; [Dependency] private readonly IEyeManager _eyeManager = default!; @@ -107,7 +106,7 @@ namespace Content.Client.GameObjects.Components.Suspicion return; } - var overlay = new TraitorOverlay(Owner, _entityManager, _resourceCache, _eyeManager); + var overlay = new TraitorOverlay(Owner, Owner.EntityManager, _resourceCache, _eyeManager); _overlayManager.AddOverlay(overlay); } diff --git a/Content.Client/GameObjects/EntitySystems/ConstructionSystem.cs b/Content.Client/GameObjects/EntitySystems/ConstructionSystem.cs index 022044cdc5..aaa426bfb5 100644 --- a/Content.Client/GameObjects/EntitySystems/ConstructionSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/ConstructionSystem.cs @@ -27,7 +27,6 @@ namespace Content.Client.GameObjects.EntitySystems { [Dependency] private readonly IGameHud _gameHud = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; private int _nextId; private readonly Dictionary _ghosts = new Dictionary(); @@ -124,7 +123,7 @@ namespace Content.Client.GameObjects.EntitySystems if (!args.EntityUid.IsValid() || !args.EntityUid.IsClientSide()) return false; - var entity = _entityManager.GetEntity(args.EntityUid); + var entity = EntityManager.GetEntity(args.EntityUid); if (!entity.TryGetComponent(out ConstructionGhostComponent ghostComp)) return false; @@ -167,7 +166,7 @@ namespace Content.Client.GameObjects.EntitySystems return; } - var ghost = _entityManager.SpawnEntity("constructionghost", loc); + var ghost = EntityManager.SpawnEntity("constructionghost", loc); var comp = ghost.GetComponent(); comp.Prototype = prototype; comp.GhostID = _nextId++; diff --git a/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterSystem.cs b/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterSystem.cs index 7dfb8225d0..4a89a54b78 100644 --- a/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterSystem.cs @@ -27,7 +27,6 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter * It'll also handle overall cleanup when one is removed (i.e. removing it from DoAfterGui). */ [Dependency] private readonly IGameTiming _gameTiming = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; /// /// We'll use an excess time so stuff like finishing effects can show. @@ -39,7 +38,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter private HashSet _knownComponents = new HashSet(); private IEntity? _attachedEntity; - + public override void Initialize() { base.Initialize(); @@ -50,14 +49,14 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter { _attachedEntity = message.AttachedEntity; } - + public override void Update(float frameTime) { base.Update(frameTime); var currentTime = _gameTiming.CurTime; var foundComps = new HashSet(); - + // Can't see any I guess? if (_attachedEntity == null || _attachedEntity.Deleted) return; @@ -68,7 +67,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter { _knownComponents.Add(comp); } - + var doAfters = comp.DoAfters.ToList(); if (doAfters.Count == 0) @@ -88,10 +87,10 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter { if (comp.Gui != null) comp.Gui.FirstDraw = true; - + return; } - + comp.Enable(); var userGrid = comp.Owner.Transform.Coordinates; @@ -124,7 +123,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter if (doAfter.BreakOnTargetMove) { - if (_entityManager.TryGetEntity(doAfter.TargetUid, out var targetEntity) && targetEntity.Transform.Coordinates != doAfter.TargetGrid) + if (EntityManager.TryGetEntity(doAfter.TargetUid, out var targetEntity) && targetEntity.Transform.Coordinates != doAfter.TargetGrid) { comp.Cancel(id, currentTime); continue; @@ -142,7 +141,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter comp.Remove(cancelled.Message); } } - + // Remove any components that we no longer need to track foundComps.Add(comp); } diff --git a/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs b/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs index 4aadc3a0a7..a145bbacff 100644 --- a/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs @@ -30,7 +30,6 @@ namespace Content.Client.GameObjects.EntitySystems public class DragDropSystem : EntitySystem { [Dependency] private readonly IStateManager _stateManager = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; @@ -137,7 +136,7 @@ namespace Content.Client.GameObjects.EntitySystems // possibly initiating a drag // check if the clicked entity is draggable - if (_entityManager.TryGetEntity(args.EntityUid, out var entity)) + if (EntityManager.TryGetEntity(args.EntityUid, out var entity)) { // check if the entity is reachable if (!_interactionSystem.InRangeUnobstructed(dragger, entity)) @@ -241,7 +240,7 @@ namespace Content.Client.GameObjects.EntitySystems _state = DragState.Dragging; // pop up drag shadow under mouse var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition); - _dragShadow = _entityManager.SpawnEntity("dragshadow", mousePos); + _dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos); var dragSprite = _dragShadow.GetComponent(); dragSprite.CopyFrom(draggedSprite); dragSprite.RenderOrder = EntityManager.CurrentTick.Value; @@ -328,7 +327,7 @@ namespace Content.Client.GameObjects.EntitySystems RemoveHighlights(); if (_dragShadow != null) { - _entityManager.DeleteEntity(_dragShadow); + EntityManager.DeleteEntity(_dragShadow); } _dragShadow = null; diff --git a/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs b/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs index e26a5b658e..d31f1835cd 100644 --- a/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs @@ -27,7 +27,6 @@ namespace Content.Client.GameObjects.EntitySystems { [Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; public const string StyleClassEntityTooltip = "entity-tooltip"; @@ -52,7 +51,7 @@ namespace Content.Client.GameObjects.EntitySystems private bool HandleExamine(ICommonSession session, EntityCoordinates coords, EntityUid uid) { - if (!uid.IsValid() || !_entityManager.TryGetEntity(uid, out var examined)) + if (!uid.IsValid() || !EntityManager.TryGetEntity(uid, out var examined)) { return false; } diff --git a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs index 9b48bca5f3..a2681507f4 100644 --- a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs @@ -43,7 +43,6 @@ namespace Content.Client.GameObjects.EntitySystems public sealed class VerbSystem : SharedVerbSystem, IResettingEntitySystem { [Dependency] private readonly IStateManager _stateManager = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IItemSlotManager _itemSlotManager = default!; @@ -148,7 +147,7 @@ namespace Content.Client.GameObjects.EntitySystems return false; } - var mapCoordinates = args.Coordinates.ToMap(_entityManager); + var mapCoordinates = args.Coordinates.ToMap(EntityManager); var playerEntity = _playerManager.LocalPlayer?.ControlledEntity; if (playerEntity == null || !TryGetContextEntities(playerEntity, mapCoordinates, out var entities)) @@ -196,7 +195,7 @@ namespace Content.Client.GameObjects.EntitySystems private void FillEntityPopup(VerbSystemMessages.VerbsResponseMessage msg) { - if (_currentEntity != msg.Entity || !_entityManager.TryGetEntity(_currentEntity, out var entity)) + if (_currentEntity != msg.Entity || !EntityManager.TryGetEntity(_currentEntity, out var entity)) { return; } diff --git a/Content.Server/GameObjects/Components/Atmos/FlammableComponent.cs b/Content.Server/GameObjects/Components/Atmos/FlammableComponent.cs index 137725f25d..a687edc752 100644 --- a/Content.Server/GameObjects/Components/Atmos/FlammableComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/FlammableComponent.cs @@ -31,8 +31,6 @@ namespace Content.Server.GameObjects.Components.Atmos [RegisterComponent] public class FlammableComponent : SharedFlammableComponent, ICollideBehavior, IFireAct, IReagentReaction { - [Dependency] private IEntityManager _entityManager = default!; - private bool _resisting = false; private readonly List _collided = new List(); @@ -137,13 +135,13 @@ namespace Content.Server.GameObjects.Components.Atmos foreach (var uid in _collided.ToArray()) { - if (!uid.IsValid() || !_entityManager.EntityExists(uid)) + if (!uid.IsValid() || !Owner.EntityManager.EntityExists(uid)) { _collided.Remove(uid); continue; } - var entity = _entityManager.GetEntity(uid); + var entity = Owner.EntityManager.GetEntity(uid); var physics = Owner.GetComponent(); var otherPhysics = entity.GetComponent(); diff --git a/Content.Server/GameObjects/Components/Atmos/GasAnalyzerComponent.cs b/Content.Server/GameObjects/Components/Atmos/GasAnalyzerComponent.cs index fc594dd9ac..1f86632d0c 100644 --- a/Content.Server/GameObjects/Components/Atmos/GasAnalyzerComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/GasAnalyzerComponent.cs @@ -26,8 +26,6 @@ namespace Content.Server.GameObjects.Components.Atmos [RegisterComponent] public class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract, IDropped, IUse { - [Dependency] private readonly IEntityManager _entityManager = default!; - private GasAnalyzerDanger _pressureDanger; private float _timeSinceSync; private const float TimeBetweenSyncs = 2f; @@ -183,14 +181,14 @@ namespace Content.Server.GameObjects.Components.Atmos if (!_checkPlayer && _position.HasValue) { // Check if position is out of range => don't update - if (!_position.Value.InRange(_entityManager, pos, SharedInteractionSystem.InteractionRange)) + if (!_position.Value.InRange(Owner.EntityManager, pos, SharedInteractionSystem.InteractionRange)) return; pos = _position.Value; } var atmosSystem = EntitySystem.Get(); - var gam = atmosSystem.GetGridAtmosphere(pos.GetGridId(_entityManager)); + var gam = atmosSystem.GetGridAtmosphere(pos.GetGridId(Owner.EntityManager)); var tile = gam?.GetTile(pos).Air; if (tile == null) { diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/Scrubbers/BaseSiphonComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/Scrubbers/BaseSiphonComponent.cs index 54a7674208..8d0d2826e5 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/Scrubbers/BaseSiphonComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/Scrubbers/BaseSiphonComponent.cs @@ -18,7 +18,6 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers /// public abstract class BaseSiphonComponent : PipeNetDeviceComponent { - [Dependency] private readonly IEntityManager _entityManager = default!; [ViewVariables] private PipeNode _scrubberOutlet; @@ -65,7 +64,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers if (!SiphonEnabled) return; - var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(_entityManager); + var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(Owner.EntityManager); if (tileAtmos == null) return; ScrubGas(tileAtmos.Air, _scrubberOutlet.Air); diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/Vents/BaseVentComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/Vents/BaseVentComponent.cs index 6a47760c45..36a618aab3 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/Vents/BaseVentComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/Vents/BaseVentComponent.cs @@ -18,7 +18,6 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents /// public abstract class BaseVentComponent : PipeNetDeviceComponent { - [Dependency] private readonly IEntityManager _entityManager = default!; [ViewVariables] private PipeNode _ventInlet; @@ -65,7 +64,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents if (!VentEnabled) return; - var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(_entityManager); + var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(Owner.EntityManager); if (tileAtmos == null) return; VentGas(_ventInlet.Air, tileAtmos.Air); diff --git a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs index e44e52deaa..0e88104614 100644 --- a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs +++ b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs @@ -31,7 +31,6 @@ namespace Content.Server.GameObjects.Components.Construction public class ConstructionComponent : Component, IExamine, IInteractUsing { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; public override string Name => "Construction"; @@ -392,7 +391,7 @@ namespace Content.Server.GameObjects.Components.Construction { if (node.Entity == Owner.Prototype?.ID || string.IsNullOrEmpty(node.Entity)) return false; - var entity = _entityManager.SpawnEntity(node.Entity, Owner.Transform.Coordinates); + var entity = Owner.EntityManager.SpawnEntity(node.Entity, Owner.Transform.Coordinates); entity.Transform.LocalRotation = Owner.Transform.LocalRotation; diff --git a/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs b/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs index 44a08acaca..9e91be5b32 100644 --- a/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs @@ -50,8 +50,6 @@ namespace Content.Server.GameObjects.Components.Fluids [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; - public override string Name => "Puddle"; private CancellationTokenSource _evaporationToken; @@ -399,7 +397,7 @@ namespace Content.Server.GameObjects.Components.Fluids if (puddle == default) { var grid = _snapGrid.DirectionToGrid(direction); - puddle = () => _entityManager.SpawnEntity(Owner.Prototype.ID, grid).GetComponent(); + puddle = () => Owner.EntityManager.SpawnEntity(Owner.Prototype.ID, grid).GetComponent(); } return true; diff --git a/Content.Server/GameObjects/Components/Items/Storage/CursedEntityStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/CursedEntityStorageComponent.cs index 8f8f1c4eee..6018872270 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/CursedEntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/CursedEntityStorageComponent.cs @@ -17,8 +17,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage [RegisterComponent] public class CursedEntityStorageComponent : EntityStorageComponent { - [Dependency] private IEntityManager _entityManager = default!; - [Dependency] private IRobustRandom _robustRandom = default!; + [Dependency] private IRobustRandom _robustRandom = default!; public override string Name => "CursedEntityStorage"; @@ -29,7 +28,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage // No contents, we do nothing if (Contents.ContainedEntities.Count == 0) return; - var lockers = _entityManager.GetEntities(new TypeEntityQuery(typeof(EntityStorageComponent))).ToList(); + var lockers = Owner.EntityManager.GetEntities(new TypeEntityQuery(typeof(EntityStorageComponent))).ToList(); if (lockers.Contains(Owner)) lockers.Remove(Owner); diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index 95db5b6c57..8ce7324607 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -36,8 +36,6 @@ namespace Content.Server.GameObjects.Components.Items.Storage [ComponentReference(typeof(IStorageComponent))] public class ServerStorageComponent : SharedStorageComponent, IInteractUsing, IUse, IActivate, IStorageComponent, IDestroyAct, IExAct { - [Dependency] private readonly IEntityManager _entityManager = default!; - private const string LoggerName = "Storage"; private Container? _storage; @@ -361,14 +359,14 @@ namespace Content.Server.GameObjects.Components.Items.Storage var ownerTransform = Owner.Transform; var playerTransform = player.Transform; - if (!playerTransform.Coordinates.InRange(_entityManager, ownerTransform.Coordinates, 2) || + if (!playerTransform.Coordinates.InRange(Owner.EntityManager, ownerTransform.Coordinates, 2) || !ownerTransform.IsMapTransform && !playerTransform.ContainsEntity(ownerTransform)) { break; } - var entity = _entityManager.GetEntity(remove.EntityUid); + var entity = Owner.EntityManager.GetEntity(remove.EntityUid); if (entity == null || _storage?.Contains(entity) == false) { diff --git a/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs b/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs index 7a665dde13..2baf98a183 100644 --- a/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs +++ b/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs @@ -41,7 +41,6 @@ namespace Content.Server.GameObjects.Components.Kitchen [ComponentReference(typeof(IActivate))] public class MicrowaveComponent : SharedMicrowaveComponent, IActivate, IInteractUsing, ISolutionChange, ISuicideAct { - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly RecipeManager _recipeManager = default!; #region YAMLSERIALIZE @@ -340,7 +339,7 @@ namespace Content.Server.GameObjects.Components.Kitchen if (recipeToCook != null) { var entityToSpawn = goodMeal ? recipeToCook.Result : _badRecipeName; - _entityManager.SpawnEntity(entityToSpawn, Owner.Transform.Coordinates); + Owner.EntityManager.SpawnEntity(entityToSpawn, Owner.Transform.Coordinates); } } _audioSystem.PlayFromEntity(_cookingCompleteSound, Owner, AudioParams.Default.WithVolume(-1f)); @@ -391,9 +390,9 @@ namespace Content.Server.GameObjects.Components.Kitchen private void EjectSolid(EntityUid entityID) { - if (_entityManager.EntityExists(entityID)) + if (Owner.EntityManager.EntityExists(entityID)) { - _storage.Remove(_entityManager.GetEntity(entityID)); + _storage.Remove(Owner.EntityManager.GetEntity(entityID)); } } diff --git a/Content.Server/GameObjects/Components/MachineLinking/SignalTransmitterComponent.cs b/Content.Server/GameObjects/Components/MachineLinking/SignalTransmitterComponent.cs index 0018e82017..2968611b4c 100644 --- a/Content.Server/GameObjects/Components/MachineLinking/SignalTransmitterComponent.cs +++ b/Content.Server/GameObjects/Components/MachineLinking/SignalTransmitterComponent.cs @@ -18,8 +18,6 @@ namespace Content.Server.GameObjects.Components.MachineLinking [RegisterComponent] public class SignalTransmitterComponent : Component, IInteractUsing { - [Dependency] private readonly IEntityManager _entityManager = default!; - public override string Name => "SignalTransmitter"; private List _unresolvedReceivers; @@ -62,7 +60,7 @@ namespace Content.Server.GameObjects.Components.MachineLinking _unresolvedReceivers = new List(); foreach (var entityUid in entityUids) { - if (!_entityManager.TryGetEntity(entityUid, out var entity) + if (!Owner.EntityManager.TryGetEntity(entityUid, out var entity) || !entity.TryGetComponent(out var receiver)) { continue; diff --git a/Content.Server/GameObjects/Components/Markers/ConditionalSpawnerComponent.cs b/Content.Server/GameObjects/Components/Markers/ConditionalSpawnerComponent.cs index adb46a368b..c0f1978962 100644 --- a/Content.Server/GameObjects/Components/Markers/ConditionalSpawnerComponent.cs +++ b/Content.Server/GameObjects/Components/Markers/ConditionalSpawnerComponent.cs @@ -20,7 +20,6 @@ namespace Content.Server.GameObjects.Components.Markers { [Dependency] private readonly IGameTicker _gameTicker = default!; [Dependency] private readonly IReflectionManager _reflectionManager = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; public override string Name => "ConditionalSpawner"; @@ -87,7 +86,7 @@ namespace Content.Server.GameObjects.Components.Markers } if(!Owner.Deleted) - _entityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates); + Owner.EntityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates); } public virtual void MapInit() diff --git a/Content.Server/GameObjects/Components/Markers/TimedSpawnerComponent.cs b/Content.Server/GameObjects/Components/Markers/TimedSpawnerComponent.cs index 323ffec02b..7d96681a10 100644 --- a/Content.Server/GameObjects/Components/Markers/TimedSpawnerComponent.cs +++ b/Content.Server/GameObjects/Components/Markers/TimedSpawnerComponent.cs @@ -16,7 +16,6 @@ namespace Content.Server.GameObjects.Components.Markers [RegisterComponent] public class TimedSpawnerComponent : Component { - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; public override string Name => "TimedSpawner"; @@ -81,7 +80,7 @@ namespace Content.Server.GameObjects.Components.Markers for (int i = 0; i < number; i++) { var entity = _robustRandom.Pick(Prototypes); - _entityManager.SpawnEntity(entity, Owner.Transform.Coordinates); + Owner.EntityManager.SpawnEntity(entity, Owner.Transform.Coordinates); } } } diff --git a/Content.Server/GameObjects/Components/Markers/TrashSpawnerComponent.cs b/Content.Server/GameObjects/Components/Markers/TrashSpawnerComponent.cs index 1235f2d6cb..d56a712e80 100644 --- a/Content.Server/GameObjects/Components/Markers/TrashSpawnerComponent.cs +++ b/Content.Server/GameObjects/Components/Markers/TrashSpawnerComponent.cs @@ -14,7 +14,6 @@ namespace Content.Server.GameObjects.Components.Markers [RegisterComponent] public class TrashSpawnerComponent : ConditionalSpawnerComponent { - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; public override string Name => "TrashSpawner"; @@ -42,7 +41,7 @@ namespace Content.Server.GameObjects.Components.Markers { if (RarePrototypes.Count > 0 && (RareChance == 1.0f || _robustRandom.Prob(RareChance))) { - _entityManager.SpawnEntity(_robustRandom.Pick(RarePrototypes), Owner.Transform.Coordinates); + Owner.EntityManager.SpawnEntity(_robustRandom.Pick(RarePrototypes), Owner.Transform.Coordinates); return; } @@ -64,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Markers var x_negative = random.Prob(0.5f) ? -1 : 1; var y_negative = random.Prob(0.5f) ? -1 : 1; - var entity = _entityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates); + var entity = Owner.EntityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates); entity.Transform.LocalPosition += new Vector2(random.NextFloat() * Offset * x_negative, random.NextFloat() * Offset * y_negative); } diff --git a/Content.Server/GameObjects/Components/Medical/CloningPodComponent.cs b/Content.Server/GameObjects/Components/Medical/CloningPodComponent.cs index dd41fae7ba..65e9a87daf 100644 --- a/Content.Server/GameObjects/Components/Medical/CloningPodComponent.cs +++ b/Content.Server/GameObjects/Components/Medical/CloningPodComponent.cs @@ -32,7 +32,6 @@ namespace Content.Server.GameObjects.Components.Medical public class CloningPodComponent : SharedCloningPodComponent, IActivate { [Dependency] private readonly IServerPreferencesManager _prefsManager = null!; - [Dependency] private readonly IEntityManager _entityManager = null!; [Dependency] private readonly IPlayerManager _playerManager = null!; [ViewVariables] @@ -169,7 +168,7 @@ namespace Content.Server.GameObjects.Components.Medical if (!dead) return; - var mob = _entityManager.SpawnEntity("HumanMob_Content", Owner.Transform.MapPosition); + var mob = Owner.EntityManager.SpawnEntity("HumanMob_Content", Owner.Transform.MapPosition); var client = _playerManager.GetSessionByUserId(mind.UserId!.Value); var profile = GetPlayerProfileAsync(client.UserId); mob.GetComponent().UpdateFromProfile(profile); diff --git a/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs b/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs index 05ed21f0e2..2c6a52d00f 100644 --- a/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs +++ b/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs @@ -31,7 +31,6 @@ namespace Content.Server.GameObjects.Components.Metabolism public class MetabolismComponent : Component { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; [ComponentDependency] private readonly IBody? _body = default!; @@ -294,7 +293,7 @@ namespace Content.Server.GameObjects.Components.Metabolism } // creadth: sweating does not help in airless environment - if (Owner.Transform.Coordinates.TryGetTileAir(out _, _entityManager)) + if (Owner.Transform.Coordinates.TryGetTileAir(out _, Owner.EntityManager)) { temperatureComponent.RemoveHeat(Math.Min(targetHeat, SweatHeatRegulation)); } diff --git a/Content.Server/GameObjects/Components/Movement/ShuttleControllerComponent.cs b/Content.Server/GameObjects/Components/Movement/ShuttleControllerComponent.cs index db25892f5b..e21cabb0d5 100644 --- a/Content.Server/GameObjects/Components/Movement/ShuttleControllerComponent.cs +++ b/Content.Server/GameObjects/Components/Movement/ShuttleControllerComponent.cs @@ -24,7 +24,6 @@ namespace Content.Server.GameObjects.Components.Movement internal class ShuttleControllerComponent : Component, IMoverComponent { [Dependency] private readonly IMapManager _mapManager = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; private bool _movingUp; private bool _movingDown; @@ -67,7 +66,7 @@ namespace Content.Server.GameObjects.Components.Movement var gridId = Owner.Transform.GridID; if (_mapManager.TryGetGrid(gridId, out var grid) && - _entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity)) + Owner.EntityManager.TryGetEntity(grid.GridEntityId, out var gridEntity)) { //TODO: Switch to shuttle component if (!gridEntity.TryGetComponent(out IPhysicsComponent? physics)) diff --git a/Content.Server/GameObjects/Components/Nutrition/FoodContainerComponent.cs b/Content.Server/GameObjects/Components/Nutrition/FoodContainerComponent.cs index ee766595f9..aa0d7e71a4 100644 --- a/Content.Server/GameObjects/Components/Nutrition/FoodContainerComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/FoodContainerComponent.cs @@ -23,8 +23,6 @@ namespace Content.Server.GameObjects.Components.Nutrition public sealed class FoodContainer : SharedFoodContainerComponent, IUse { [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; - public override string Name => "FoodContainer"; private AppearanceComponent _appearance; @@ -60,7 +58,7 @@ namespace Content.Server.GameObjects.Components.Nutrition return false; } - var itemToSpawn = _entityManager.SpawnEntity(GetRandomPrototype(), Owner.Transform.Coordinates); + var itemToSpawn = Owner.EntityManager.SpawnEntity(GetRandomPrototype(), Owner.Transform.Coordinates); handsComponent.PutInHandOrDrop(itemToSpawn.GetComponent()); _count--; if (_count < 1) diff --git a/Content.Server/GameObjects/Components/PA/ParticleAcceleratorEmitterComponent.cs b/Content.Server/GameObjects/Components/PA/ParticleAcceleratorEmitterComponent.cs index dd7643d3ff..1fcb0d71df 100644 --- a/Content.Server/GameObjects/Components/PA/ParticleAcceleratorEmitterComponent.cs +++ b/Content.Server/GameObjects/Components/PA/ParticleAcceleratorEmitterComponent.cs @@ -11,8 +11,6 @@ namespace Content.Server.GameObjects.Components.PA [ComponentReference(typeof(ParticleAcceleratorPartComponent))] public class ParticleAcceleratorEmitterComponent : ParticleAcceleratorPartComponent { - [Dependency] private IEntityManager _entityManager = null!; - public override string Name => "ParticleAcceleratorEmitter"; public ParticleAcceleratorEmitterType Type; @@ -25,7 +23,7 @@ namespace Content.Server.GameObjects.Components.PA public void Fire(ParticleAcceleratorPowerState strength) { - var projectile = _entityManager.SpawnEntity("ParticlesProjectile", Owner.Transform.Coordinates); + var projectile = Owner.EntityManager.SpawnEntity("ParticlesProjectile", Owner.Transform.Coordinates); if (!projectile.TryGetComponent(out var particleProjectileComponent)) { diff --git a/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs b/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs index a18c900d9f..feb36ce473 100644 --- a/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs +++ b/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs @@ -14,7 +14,6 @@ namespace Content.Server.GameObjects.Components.Power [RegisterComponent] internal class WirePlacerComponent : Component, IAfterInteract { - [Dependency] private readonly IServerEntityManager _entityManager = default!; [Dependency] private readonly IMapManager _mapManager = default!; /// @@ -37,7 +36,7 @@ namespace Content.Server.GameObjects.Components.Power public void AfterInteract(AfterInteractEventArgs eventArgs) { if (!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true)) return; - if(!_mapManager.TryGetGrid(eventArgs.ClickLocation.GetGridId(_entityManager), out var grid)) + if(!_mapManager.TryGetGrid(eventArgs.ClickLocation.GetGridId(Owner.EntityManager), out var grid)) return; var snapPos = grid.SnapGridCellFor(eventArgs.ClickLocation, SnapGridOffset.Center); var snapCell = grid.GetSnapGridCell(snapPos, SnapGridOffset.Center); @@ -52,7 +51,7 @@ namespace Content.Server.GameObjects.Components.Power } if (Owner.TryGetComponent(out StackComponent stack) && !stack.Use(1)) return; - _entityManager.SpawnEntity(_wirePrototypeID, grid.GridTileToLocal(snapPos)); + Owner.EntityManager.SpawnEntity(_wirePrototypeID, grid.GridTileToLocal(snapPos)); } } } diff --git a/Content.Server/GameObjects/Components/Radio/HandheldRadioComponent.cs b/Content.Server/GameObjects/Components/Radio/HandheldRadioComponent.cs index f5e7f3af62..6a10aea330 100644 --- a/Content.Server/GameObjects/Components/Radio/HandheldRadioComponent.cs +++ b/Content.Server/GameObjects/Components/Radio/HandheldRadioComponent.cs @@ -22,8 +22,6 @@ namespace Content.Server.GameObjects.Components.Radio public class HandheldRadioComponent : Component, IUse, IListen, IRadio, IActivate, IExamine { [Dependency] private readonly IChatManager _chatManager = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; - public override string Name => "Radio"; private RadioSystem _radioSystem = default!; @@ -91,7 +89,7 @@ namespace Content.Server.GameObjects.Components.Radio public bool CanListen(string message, IEntity source) { return RadioOn && - Owner.Transform.Coordinates.TryDistance(_entityManager, source.Transform.Coordinates, out var distance) && + Owner.Transform.Coordinates.TryDistance(Owner.EntityManager, source.Transform.Coordinates, out var distance) && distance <= ListenRange; } diff --git a/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs b/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs index 482ab4da30..9405fbdb4c 100644 --- a/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs +++ b/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs @@ -26,8 +26,6 @@ namespace Content.Server.GameObjects.Components.Recycling [RegisterComponent] public class RecyclerComponent : Component, ICollideBehavior { - [Dependency] private readonly IEntityManager _entityManager = default!; - public override string Name => "Recycler"; private List _intersecting = new List(); @@ -164,7 +162,7 @@ namespace Content.Server.GameObjects.Components.Recycling { var entity = _intersecting[i]; - if (entity.Deleted || !CanMove(entity) || !_entityManager.IsIntersecting(Owner, entity)) + if (entity.Deleted || !CanMove(entity) || !Owner.EntityManager.IsIntersecting(Owner, entity)) { _intersecting.RemoveAt(i); continue; diff --git a/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs b/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs index 825a82897d..3a5ce91118 100644 --- a/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs +++ b/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs @@ -35,7 +35,6 @@ namespace Content.Server.GameObjects.Components.Singularity [ComponentReference(typeof(IActivate))] public class EmitterComponent : Component, IActivate, IInteractUsing { - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; [ComponentDependency] private AppearanceComponent? _appearance = default; @@ -251,7 +250,7 @@ namespace Content.Server.GameObjects.Components.Singularity private void Fire() { - var projectile = _entityManager.SpawnEntity(_boltType, Owner.Transform.Coordinates); + var projectile = Owner.EntityManager.SpawnEntity(_boltType, Owner.Transform.Coordinates); if (!projectile.TryGetComponent(out var physicsComponent)) { diff --git a/Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs b/Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs index 361da0921e..3f0ab51504 100644 --- a/Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs +++ b/Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs @@ -175,7 +175,7 @@ namespace Content.Server.GameObjects.Components.Singularity } _previousPulledEntites.Clear(); - var entitiesToPull = _entityManager.GetEntitiesInRange(Owner.Transform.Coordinates, Level * 10); + var entitiesToPull = Owner.EntityManager.GetEntitiesInRange(Owner.Transform.Coordinates, Level * 10); foreach (var entity in entitiesToPull) { if (!entity.TryGetComponent(out var collidableComponent)) continue; diff --git a/Content.Server/GameObjects/Components/Stack/StackComponent.cs b/Content.Server/GameObjects/Components/Stack/StackComponent.cs index fe202bdc02..e7712ae14f 100644 --- a/Content.Server/GameObjects/Components/Stack/StackComponent.cs +++ b/Content.Server/GameObjects/Components/Stack/StackComponent.cs @@ -24,8 +24,6 @@ namespace Content.Server.GameObjects.Components.Stack [ComponentReference(typeof(SharedStackComponent))] public class StackComponent : SharedStackComponent, IInteractUsing, IExamine { - [Dependency] private IEntityManager _entityManager = default!; - private bool _throwIndividually = false; public override int Count @@ -78,7 +76,7 @@ namespace Content.Server.GameObjects.Components.Stack { Count -= amount; - stack = _entityManager.SpawnEntity(Owner.Prototype?.ID, spawnPosition); + stack = Owner.EntityManager.SpawnEntity(Owner.Prototype?.ID, spawnPosition); if (stack.TryGetComponent(out StackComponent? stackComp)) { diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs index 8e7be3056f..5130373ee1 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs @@ -23,8 +23,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee [RegisterComponent] public class FlashComponent : MeleeWeaponComponent, IUse, IExamine { - [Dependency] private readonly IEntityManager _entityManager = default!; - public override string Name => "Flash"; [ViewVariables(VVAccess.ReadWrite)] private int _flashDuration = 5000; @@ -84,7 +82,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee return false; } - foreach (var entity in _entityManager.GetEntitiesInRange(Owner.Transform.Coordinates, _range)) + foreach (var entity in Owner.EntityManager.GetEntitiesInRange(Owner.Transform.Coordinates, _range)) { Flash(entity, eventArgs.User, _aoeFlashDuration); } diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs index 78d3778c8a..c62b983a41 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs @@ -33,7 +33,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding { [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; - + public IReadOnlyDictionary> Graph => _graph; private readonly Dictionary> _graph = new Dictionary>(); @@ -361,7 +361,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding // Also look at increasing tile cost the more physics entities are on it public bool CanTraverse(IEntity entity, EntityCoordinates coordinates) { - var gridId = coordinates.GetGridId(_entityManager); + var gridId = coordinates.GetGridId(EntityManager); var tile = _mapManager.GetGrid(gridId).GetTileRef(coordinates); var node = GetNode(tile); return CanTraverse(entity, node); diff --git a/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs index 14bc59cd05..8cd45f6ba3 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs @@ -27,7 +27,6 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering // http://www.red3d.com/cwr/papers/1999/gdc99steer.html for a steering overview [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IPauseManager _pauseManager = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; private PathfindingSystem _pathfindingSystem; @@ -269,7 +268,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering // Validation // Check if we can even arrive -> Currently only samegrid movement supported - if (entity.Transform.GridID != steeringRequest.TargetGrid.GetGridId(_entityManager)) + if (entity.Transform.GridID != steeringRequest.TargetGrid.GetGridId(EntityManager)) { controller.VelocityDir = Vector2.Zero; return SteeringStatus.NoPath; diff --git a/Content.Server/GameObjects/EntitySystems/AtmosExposedSystem.cs b/Content.Server/GameObjects/EntitySystems/AtmosExposedSystem.cs index 16f22dfc8d..94b0c3adb6 100644 --- a/Content.Server/GameObjects/EntitySystems/AtmosExposedSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AtmosExposedSystem.cs @@ -11,7 +11,6 @@ namespace Content.Server.GameObjects.EntitySystems public class AtmosExposedSystem : EntitySystem { - [Dependency] private readonly IEntityManager _entityManager = default!; private const float UpdateDelay = 1f; private float _lastUpdate; @@ -24,7 +23,7 @@ namespace Content.Server.GameObjects.EntitySystems // creadth: everything exposable by atmos should be updated as well foreach (var atmosExposedComponent in EntityManager.ComponentManager.EntityQuery()) { - var tile = atmosExposedComponent.Owner.Transform.Coordinates.GetTileAtmosphere(_entityManager); + var tile = atmosExposedComponent.Owner.Transform.Coordinates.GetTileAtmosphere(EntityManager); if (tile == null) continue; atmosExposedComponent.Update(tile, _lastUpdate); } diff --git a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs index 969b1a28a7..a2ef44c52a 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs @@ -11,8 +11,6 @@ namespace Content.Server.GameObjects.EntitySystems.Click { public class ExamineSystem : ExamineSystemShared { - [Dependency] private IEntityManager _entityManager = default!; - private static readonly FormattedMessage _entityNotFoundMessage; static ExamineSystem() @@ -38,7 +36,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click var channel = player.ConnectedClient; if (playerEnt == null - || !_entityManager.TryGetEntity(request.EntityUid, out var entity) + || !EntityManager.TryGetEntity(request.EntityUid, out var entity) || !CanExamine(playerEnt, entity)) { RaiseNetworkEvent(new ExamineSystemMessages.ExamineInfoResponseMessage( diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index 5ac39cf648..0740a7caeb 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -805,7 +805,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click private void DoAttack(IEntity player, EntityCoordinates coordinates, bool wideAttack, EntityUid target = default) { // Verify player is on the same map as the entity he clicked on - if (_mapManager.GetGrid(coordinates.GetGridId(_entityManager)).ParentMapId != player.Transform.MapID) + if (_mapManager.GetGrid(coordinates.GetGridId(EntityManager)).ParentMapId != player.Transform.MapID) { Logger.WarningS("system.interaction", $"Player named {player.Name} clicked on a map he isn't located on"); diff --git a/Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs b/Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs index f415bf2b98..7bcfccf960 100644 --- a/Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs @@ -35,7 +35,6 @@ namespace Content.Server.GameObjects.EntitySystems [UsedImplicitly] internal class ConstructionSystem : SharedConstructionSystem { - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; @@ -83,7 +82,7 @@ namespace Content.Server.GameObjects.EntitySystems } } - foreach (var near in _entityManager.GetEntitiesInRange(user!, 2f, true)) + foreach (var near in EntityManager.GetEntitiesInRange(user!, 2f, true)) { yield return near; } @@ -264,7 +263,7 @@ namespace Content.Server.GameObjects.EntitySystems return null; } - var newEntity = _entityManager.SpawnEntity(graph.Nodes[edge.Target].Entity, user.Transform.Coordinates); + var newEntity = EntityManager.SpawnEntity(graph.Nodes[edge.Target].Entity, user.Transform.Coordinates); // Yes, this should throw if it's missing the component. var construction = newEntity.GetComponent(); diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index 409ea2f988..c3f7f22c14 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -27,7 +27,6 @@ namespace Content.Server.GameObjects.EntitySystems [UsedImplicitly] internal sealed class HandsSystem : EntitySystem { - [Dependency] private readonly IEntityManager _entityManager = default!; private const float ThrowForce = 1.5f; // Throwing force of mobs in Newtons @@ -122,7 +121,7 @@ namespace Content.Server.GameObjects.EntitySystems var entCoords = ent.Transform.Coordinates.Position; var entToDesiredDropCoords = coords.Position - entCoords; var targetLength = Math.Min(entToDesiredDropCoords.Length, SharedInteractionSystem.InteractionRange - 0.001f); // InteractionRange is reduced due to InRange not dealing with floating point error - var newCoords = coords.WithPosition(entToDesiredDropCoords.Normalized * targetLength + entCoords).ToMap(_entityManager); + var newCoords = coords.WithPosition(entToDesiredDropCoords.Normalized * targetLength + entCoords).ToMap(EntityManager); var rayLength = Get().UnobstructedDistance(ent.Transform.MapPosition, newCoords, ignoredEnt: ent); handsComp.Drop(handsComp.ActiveHand, coords.WithPosition(entCoords + entToDesiredDropCoords.Normalized * rayLength)); diff --git a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs index dc9e6f6974..50219e5c07 100644 --- a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs @@ -35,7 +35,6 @@ namespace Content.Server.GameObjects.EntitySystems [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; private AudioSystem _audioSystem = default!; @@ -94,7 +93,7 @@ namespace Content.Server.GameObjects.EntitySystems if (_mapManager.GridExists(mover.LastPosition.GetGridId(EntityManager))) { // Can happen when teleporting between grids. - if (!transform.Coordinates.TryDistance(_entityManager, mover.LastPosition, out var distance)) + if (!transform.Coordinates.TryDistance(EntityManager, mover.LastPosition, out var distance)) { mover.LastPosition = transform.Coordinates; return; diff --git a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs index 396631aded..4b3185f080 100644 --- a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs @@ -17,7 +17,6 @@ namespace Content.Server.GameObjects.EntitySystems { public class VerbSystem : SharedVerbSystem, IResettingEntitySystem { - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; private readonly HashSet _seesThroughContainers = new HashSet(); @@ -76,7 +75,7 @@ namespace Content.Server.GameObjects.EntitySystems private void UseVerb(UseVerbMessage use, EntitySessionEventArgs eventArgs) { - if (!_entityManager.TryGetEntity(use.EntityUid, out var entity)) + if (!EntityManager.TryGetEntity(use.EntityUid, out var entity)) { return; } @@ -127,7 +126,7 @@ namespace Content.Server.GameObjects.EntitySystems { var player = (IPlayerSession) eventArgs.SenderSession; - if (!_entityManager.TryGetEntity(req.EntityUid, out var entity)) + if (!EntityManager.TryGetEntity(req.EntityUid, out var entity)) { Logger.Warning($"{nameof(RequestVerbs)} called on a nonexistant entity with id {req.EntityUid} by player {player}."); return; diff --git a/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs b/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs index 72b2246514..9f12850f8b 100644 --- a/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs @@ -16,7 +16,6 @@ namespace Content.Shared.GameObjects.Components.Movement { public abstract class SharedSlipperyComponent : Component, ICollideBehavior { - [Dependency] private readonly IEntityManager _entityManager = default!; public sealed override string Name => "Slippery"; @@ -110,13 +109,13 @@ namespace Content.Shared.GameObjects.Components.Movement { foreach (var uid in _slipped.ToArray()) { - if (!uid.IsValid() || !_entityManager.EntityExists(uid)) + if (!uid.IsValid() || !Owner.EntityManager.EntityExists(uid)) { _slipped.Remove(uid); continue; } - var entity = _entityManager.GetEntity(uid); + var entity = Owner.EntityManager.GetEntity(uid); var physics = Owner.GetComponent(); var otherPhysics = entity.GetComponent();