From 836930e733c9e0aca5450d100b7610573ef408e7 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Thu, 3 Mar 2022 21:18:35 +1100 Subject: [PATCH] EntityLookup as a system for content (#6931) --- Content.Client/Actions/UI/ActionSlot.cs | 2 +- Content.Client/Administration/AdminNameOverlay.cs | 6 +++--- Content.Client/Administration/AdminSystem.Menu.cs | 2 +- Content.Client/Audio/AmbientSoundSystem.cs | 2 +- Content.Client/DragDrop/DragDropSystem.cs | 2 +- Content.Client/NodeContainer/NodeGroupSystem.cs | 2 +- Content.Client/NodeContainer/NodeVisualizationOverlay.cs | 4 ++-- Content.Client/Outline/TargetOutlineSystem.cs | 2 +- Content.Client/Verbs/VerbSystem.cs | 2 +- Content.Client/Viewport/GameScreenBase.cs | 2 +- .../Tests/Destructible/DestructibleDestructionTest.cs | 2 +- Content.Server/Atmos/EntitySystems/AirtightSystem.cs | 2 +- .../Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs | 2 +- Content.Server/Cargo/Components/CargoConsoleComponent.cs | 2 +- Content.Server/Chat/Commands/SuicideCommand.cs | 2 +- .../Chemistry/Components/SolutionAreaEffectComponent.cs | 2 +- .../Chemistry/TileReactions/CleanTileReaction.cs | 2 +- Content.Server/Construction/Conditions/ComponentInTile.cs | 2 +- Content.Server/Construction/ConstructionSystem.Initial.cs | 2 +- Content.Server/Electrocution/ElectrocutionSystem.cs | 2 +- Content.Server/Explosion/EntitySystems/ExplosionSystem.cs | 2 +- Content.Server/Flash/FlashSystem.cs | 2 +- Content.Server/Fluids/EntitySystems/SpillableSystem.cs | 2 +- Content.Server/Ghost/GhostSystem.cs | 2 +- .../Morgue/Components/MorgueEntityStorageComponent.cs | 2 +- Content.Server/Nuke/NukeSystem.cs | 2 +- Content.Server/Physics/Controllers/ConveyorController.cs | 2 +- Content.Server/Pinpointer/ServerPinpointerSystem.cs | 2 +- Content.Server/Radiation/RadiationPulseSystem.cs | 2 +- .../Singularity/EntitySystems/SingularitySystem.cs | 2 +- .../Storage/Components/EntityStorageComponent.cs | 2 +- .../Storage/Components/ServerStorageComponent.cs | 2 +- .../Effects/Systems/TelepathicArtifactSystem.cs | 2 +- Content.Shared/Follower/FollowerSystem.cs | 2 +- Content.Shared/Maps/TurfHelpers.cs | 8 ++++---- Resources/Prototypes/Entities/Mobs/NPCs/dummy_npcs.yml | 1 + 36 files changed, 42 insertions(+), 41 deletions(-) diff --git a/Content.Client/Actions/UI/ActionSlot.cs b/Content.Client/Actions/UI/ActionSlot.cs index 6c2f8a7950..e787499209 100644 --- a/Content.Client/Actions/UI/ActionSlot.cs +++ b/Content.Client/Actions/UI/ActionSlot.cs @@ -233,7 +233,7 @@ namespace Content.Client.Actions.UI { _actionsUI.Component.Actions.Remove(Action); } - } + } _actionsUI.StopTargeting(); _actionsUI.UpdateUI(); diff --git a/Content.Client/Administration/AdminNameOverlay.cs b/Content.Client/Administration/AdminNameOverlay.cs index e4963cbfa6..67f3a0202b 100644 --- a/Content.Client/Administration/AdminNameOverlay.cs +++ b/Content.Client/Administration/AdminNameOverlay.cs @@ -12,10 +12,10 @@ namespace Content.Client.Administration private readonly AdminSystem _system; private readonly IEntityManager _entityManager; private readonly IEyeManager _eyeManager; - private readonly IEntityLookup _entityLookup; + private readonly EntityLookupSystem _entityLookup; private readonly Font _font; - public AdminNameOverlay(AdminSystem system, IEntityManager entityManager, IEyeManager eyeManager, IResourceCache resourceCache, IEntityLookup entityLookup) + public AdminNameOverlay(AdminSystem system, IEntityManager entityManager, IEyeManager eyeManager, IResourceCache resourceCache, EntityLookupSystem entityLookup) { _system = system; _entityManager = entityManager; @@ -46,7 +46,7 @@ namespace Content.Client.Administration continue; } - var aabb = _entityLookup.GetWorldAabbFromEntity(entity); + var aabb = _entityLookup.GetWorldAABB(entity); // if not on screen, continue if (!aabb.Intersects(in viewport)) diff --git a/Content.Client/Administration/AdminSystem.Menu.cs b/Content.Client/Administration/AdminSystem.Menu.cs index 964dcf4114..0def38a099 100644 --- a/Content.Client/Administration/AdminSystem.Menu.cs +++ b/Content.Client/Administration/AdminSystem.Menu.cs @@ -29,7 +29,7 @@ namespace Content.Client.Administration [Dependency] private readonly IOverlayManager _overlayManager = default!; [Dependency] private readonly IResourceCache _resourceCache = default!; [Dependency] private readonly IEntityManager _entityManager = default!; - [Dependency] private readonly IEntityLookup _entityLookup = default!; + [Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly IClientConsoleHost _clientConsoleHost = default!; [Dependency] private readonly VerbSystem _verbSystem = default!; diff --git a/Content.Client/Audio/AmbientSoundSystem.cs b/Content.Client/Audio/AmbientSoundSystem.cs index de275387d9..d2cf387c4e 100644 --- a/Content.Client/Audio/AmbientSoundSystem.cs +++ b/Content.Client/Audio/AmbientSoundSystem.cs @@ -19,7 +19,7 @@ namespace Content.Client.Audio /// public sealed class AmbientSoundSystem : SharedAmbientSoundSystem { - [Dependency] private IEntityLookup _lookup = default!; + [Dependency] private EntityLookupSystem _lookup = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IRobustRandom _random = default!; diff --git a/Content.Client/DragDrop/DragDropSystem.cs b/Content.Client/DragDrop/DragDropSystem.cs index 7afe513b64..e671e4c7a8 100644 --- a/Content.Client/DragDrop/DragDropSystem.cs +++ b/Content.Client/DragDrop/DragDropSystem.cs @@ -364,7 +364,7 @@ namespace Content.Client.DragDrop // TODO: Duplicated in SpriteSystem and TargetOutlineSystem. Should probably be cached somewhere for a frame? var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition).Position; var bounds = new Box2(mousePos - 1.5f, mousePos + 1.5f); - var pvsEntities = IoCManager.Resolve().GetEntitiesIntersecting(_eyeManager.CurrentMap, bounds, LookupFlags.Approximate | LookupFlags.IncludeAnchored); + var pvsEntities = EntitySystem.Get().GetEntitiesIntersecting(_eyeManager.CurrentMap, bounds, LookupFlags.Approximate | LookupFlags.IncludeAnchored); foreach (var pvsEntity in pvsEntities) { if (!EntityManager.TryGetComponent(pvsEntity, out ISpriteComponent? inRangeSprite) || diff --git a/Content.Client/NodeContainer/NodeGroupSystem.cs b/Content.Client/NodeContainer/NodeGroupSystem.cs index 565e158fad..4afc5ffc48 100644 --- a/Content.Client/NodeContainer/NodeGroupSystem.cs +++ b/Content.Client/NodeContainer/NodeGroupSystem.cs @@ -15,7 +15,7 @@ namespace Content.Client.NodeContainer public sealed class NodeGroupSystem : EntitySystem { [Dependency] private readonly IOverlayManager _overlayManager = default!; - [Dependency] private readonly IEntityLookup _entityLookup = default!; + [Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IResourceCache _resourceCache = default!; diff --git a/Content.Client/NodeContainer/NodeVisualizationOverlay.cs b/Content.Client/NodeContainer/NodeVisualizationOverlay.cs index c2ccfae442..13c00fc6be 100644 --- a/Content.Client/NodeContainer/NodeVisualizationOverlay.cs +++ b/Content.Client/NodeContainer/NodeVisualizationOverlay.cs @@ -14,7 +14,7 @@ namespace Content.Client.NodeContainer public sealed class NodeVisualizationOverlay : Overlay { private readonly NodeGroupSystem _system; - private readonly IEntityLookup _lookup; + private readonly EntityLookupSystem _lookup; private readonly IMapManager _mapManager; private readonly IInputManager _inputManager; private readonly IEntityManager _entityManager; @@ -32,7 +32,7 @@ namespace Content.Client.NodeContainer public NodeVisualizationOverlay( NodeGroupSystem system, - IEntityLookup lookup, + EntityLookupSystem lookup, IMapManager mapManager, IInputManager inputManager, IResourceCache cache, diff --git a/Content.Client/Outline/TargetOutlineSystem.cs b/Content.Client/Outline/TargetOutlineSystem.cs index 98ef20c0de..b004d34289 100644 --- a/Content.Client/Outline/TargetOutlineSystem.cs +++ b/Content.Client/Outline/TargetOutlineSystem.cs @@ -14,7 +14,7 @@ namespace Content.Client.Outline; public sealed class TargetOutlineSystem : EntitySystem { [Dependency] private readonly IEyeManager _eyeManager = default!; - [Dependency] private readonly IEntityLookup _lookup = default!; + [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; diff --git a/Content.Client/Verbs/VerbSystem.cs b/Content.Client/Verbs/VerbSystem.cs index 0c62d7bdd0..b1277d5c97 100644 --- a/Content.Client/Verbs/VerbSystem.cs +++ b/Content.Client/Verbs/VerbSystem.cs @@ -30,7 +30,7 @@ namespace Content.Client.Verbs [Dependency] private readonly ExamineSystem _examineSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly IStateManager _stateManager = default!; - [Dependency] private readonly IEntityLookup _entityLookup = default!; + [Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; /// diff --git a/Content.Client/Viewport/GameScreenBase.cs b/Content.Client/Viewport/GameScreenBase.cs index 3c92961824..94491a659a 100644 --- a/Content.Client/Viewport/GameScreenBase.cs +++ b/Content.Client/Viewport/GameScreenBase.cs @@ -59,7 +59,7 @@ namespace Content.Client.Viewport public IList GetEntitiesUnderPosition(MapCoordinates coordinates) { // Find all the entities intersecting our click - var entities = IoCManager.Resolve().GetEntitiesIntersecting(coordinates.MapId, + var entities = EntitySystem.Get().GetEntitiesIntersecting(coordinates.MapId, Box2.CenteredAround(coordinates.Position, (1, 1))); var containerSystem = _entitySystemManager.GetEntitySystem(); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs index e924272a4d..7a6eb33953 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs @@ -66,7 +66,7 @@ namespace Content.IntegrationTests.Tests.Destructible Assert.That(spawnEntitiesBehavior.Spawn.Keys.Single(), Is.EqualTo(SpawnedEntityId)); Assert.That(spawnEntitiesBehavior.Spawn.Values.Single(), Is.EqualTo(new MinMax {Min = 1, Max = 1})); - var entitiesInRange = IoCManager.Resolve().GetEntitiesInRange(coordinates, 2); + var entitiesInRange = EntitySystem.Get().GetEntitiesInRange(coordinates, 2); var found = false; foreach (var entity in entitiesInRange) diff --git a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs index dcfe1289aa..db2f173bbf 100644 --- a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs @@ -29,7 +29,7 @@ namespace Content.Server.Atmos.EntitySystems if (airtight.FixAirBlockedDirectionInitialize) { - var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, xform.WorldRotation); + var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, xform.WorldRotation, xform); OnAirtightRotated(uid, airtight, ref rotateEvent); } diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs index 9e78f4acb6..5cbb3a9653 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs @@ -15,7 +15,7 @@ namespace Content.Server.Atmos.EntitySystems { public sealed partial class AtmosphereSystem { - [Dependency] private readonly IEntityLookup _lookup = default!; + [Dependency] private readonly EntityLookupSystem _lookup = default!; private const int HotspotSoundCooldownCycles = 200; diff --git a/Content.Server/Cargo/Components/CargoConsoleComponent.cs b/Content.Server/Cargo/Components/CargoConsoleComponent.cs index f2c3ecb8dc..1d74b681ec 100644 --- a/Content.Server/Cargo/Components/CargoConsoleComponent.cs +++ b/Content.Server/Cargo/Components/CargoConsoleComponent.cs @@ -167,7 +167,7 @@ namespace Content.Server.Cargo.Components var offsets = new Vector2i[] { new Vector2i(0, 1), new Vector2i(1, 1), new Vector2i(1, 0), new Vector2i(1, -1), new Vector2i(0, -1), new Vector2i(-1, -1), new Vector2i(-1, 0), new Vector2i(-1, 1), }; - var lookup = IoCManager.Resolve(); + var lookup = EntitySystem.Get(); var gridId = _entMan.GetComponent(Owner).GridID; // TODO: Should use anchoring. diff --git a/Content.Server/Chat/Commands/SuicideCommand.cs b/Content.Server/Chat/Commands/SuicideCommand.cs index 3baceb8bed..a7df9d709d 100644 --- a/Content.Server/Chat/Commands/SuicideCommand.cs +++ b/Content.Server/Chat/Commands/SuicideCommand.cs @@ -101,7 +101,7 @@ namespace Content.Server.Chat.Commands } } // Get all entities in range of the suicider - var entities = IoCManager.Resolve().GetEntitiesInRange(owner, 1, LookupFlags.Approximate | LookupFlags.IncludeAnchored).ToArray(); + var entities = EntitySystem.Get().GetEntitiesInRange(owner, 1, LookupFlags.Approximate | LookupFlags.IncludeAnchored).ToArray(); if (entities.Length > 0) { diff --git a/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs b/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs index 20ae64e6d9..a1808579e4 100644 --- a/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs +++ b/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs @@ -139,7 +139,7 @@ namespace Content.Server.Chemistry.Components var xform = _entities.GetComponent(Owner); var mapGrid = MapManager.GetGrid(xform.GridID); var tile = mapGrid.GetTileRef(xform.Coordinates.ToVector2i(_entities, MapManager)); - var lookup = IoCManager.Resolve(); + var lookup = EntitySystem.Get(); var solutionFraction = 1 / Math.Floor(averageExposures); diff --git a/Content.Server/Chemistry/TileReactions/CleanTileReaction.cs b/Content.Server/Chemistry/TileReactions/CleanTileReaction.cs index c5ec9ad92e..ddeceec2d9 100644 --- a/Content.Server/Chemistry/TileReactions/CleanTileReaction.cs +++ b/Content.Server/Chemistry/TileReactions/CleanTileReaction.cs @@ -26,7 +26,7 @@ namespace Content.Server.Chemistry.TileReactions FixedPoint2 ITileReaction.TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume) { - var entities = IoCManager.Resolve().GetEntitiesIntersecting(tile).ToArray(); + var entities = EntitySystem.Get().GetEntitiesIntersecting(tile).ToArray(); var amount = FixedPoint2.Zero; var entMan = IoCManager.Resolve(); foreach (var entity in entities) diff --git a/Content.Server/Construction/Conditions/ComponentInTile.cs b/Content.Server/Construction/Conditions/ComponentInTile.cs index d3ca7736e8..9c9b2c0876 100644 --- a/Content.Server/Construction/Conditions/ComponentInTile.cs +++ b/Content.Server/Construction/Conditions/ComponentInTile.cs @@ -52,7 +52,7 @@ namespace Content.Server.Construction.Conditions var transform = entityManager.GetComponent(uid); var indices = transform.Coordinates.ToVector2i(entityManager, IoCManager.Resolve()); - var entities = indices.GetEntitiesInTile(transform.GridID, LookupFlags.Approximate | LookupFlags.IncludeAnchored, IoCManager.Resolve()); + var entities = indices.GetEntitiesInTile(transform.GridID, LookupFlags.Approximate | LookupFlags.IncludeAnchored, EntitySystem.Get()); foreach (var ent in entities) { diff --git a/Content.Server/Construction/ConstructionSystem.Initial.cs b/Content.Server/Construction/ConstructionSystem.Initial.cs index ff59aa518e..9436289df2 100644 --- a/Content.Server/Construction/ConstructionSystem.Initial.cs +++ b/Content.Server/Construction/ConstructionSystem.Initial.cs @@ -76,7 +76,7 @@ namespace Content.Server.Construction } } - foreach (var near in IoCManager.Resolve().GetEntitiesInRange(user!, 2f, LookupFlags.Approximate)) + foreach (var near in EntitySystem.Get().GetEntitiesInRange(user!, 2f, LookupFlags.Approximate)) { yield return near; } diff --git a/Content.Server/Electrocution/ElectrocutionSystem.cs b/Content.Server/Electrocution/ElectrocutionSystem.cs index 9f21653f46..c4f3ced4c2 100644 --- a/Content.Server/Electrocution/ElectrocutionSystem.cs +++ b/Content.Server/Electrocution/ElectrocutionSystem.cs @@ -36,7 +36,7 @@ namespace Content.Server.Electrocution { public sealed class ElectrocutionSystem : SharedElectrocutionSystem { - [Dependency] private readonly IEntityLookup _entityLookup = default!; + [Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index 8ecf1d6993..c1b14d15eb 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -45,7 +45,7 @@ namespace Content.Server.Explosion.EntitySystems // TODO move this to the component private static readonly SoundSpecifier ExplosionSound = new SoundCollectionSpecifier("explosion"); - [Dependency] private readonly IEntityLookup _entityLookup = default!; + [Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IMapManager _maps = default!; [Dependency] private readonly IRobustRandom _random = default!; diff --git a/Content.Server/Flash/FlashSystem.cs b/Content.Server/Flash/FlashSystem.cs index 8b624661df..869442d474 100644 --- a/Content.Server/Flash/FlashSystem.cs +++ b/Content.Server/Flash/FlashSystem.cs @@ -18,7 +18,7 @@ namespace Content.Server.Flash { internal sealed class FlashSystem : SharedFlashSystem { - [Dependency] private readonly IEntityLookup _entityLookup = default!; + [Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly StunSystem _stunSystem = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!; diff --git a/Content.Server/Fluids/EntitySystems/SpillableSystem.cs b/Content.Server/Fluids/EntitySystems/SpillableSystem.cs index 047c6ba518..07ecda9c47 100644 --- a/Content.Server/Fluids/EntitySystems/SpillableSystem.cs +++ b/Content.Server/Fluids/EntitySystems/SpillableSystem.cs @@ -24,7 +24,7 @@ public sealed class SpillableSystem : EntitySystem [Dependency] private readonly PuddleSystem _puddleSystem = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [Dependency] private readonly IEntityLookup _entityLookup = default!; + [Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly AdminLogSystem _logSystem = default!; public override void Initialize() diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index 893ff986a0..f3f07a2765 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -29,7 +29,7 @@ namespace Content.Server.Ghost [Dependency] private readonly MindSystem _mindSystem = default!; [Dependency] private readonly SharedActionsSystem _actions = default!; [Dependency] private readonly VisibilitySystem _visibilitySystem = default!; - [Dependency] private readonly IEntityLookup _lookup = default!; + [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly FollowerSystem _followerSystem = default!; public override void Initialize() diff --git a/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs b/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs index 2fa6d0ac6c..0d6ca40b62 100644 --- a/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs +++ b/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs @@ -161,7 +161,7 @@ namespace Content.Server.Morgue.Components yield break; } - var entityLookup = IoCManager.Resolve(); + var entityLookup = EntitySystem.Get(); foreach (var entity in entityLookup.GetEntitiesIntersecting(_tray.Value, flags: LookupFlags.None)) { yield return entity; diff --git a/Content.Server/Nuke/NukeSystem.cs b/Content.Server/Nuke/NukeSystem.cs index aec9537853..0da655b40c 100644 --- a/Content.Server/Nuke/NukeSystem.cs +++ b/Content.Server/Nuke/NukeSystem.cs @@ -19,7 +19,7 @@ namespace Content.Server.Nuke [Dependency] private readonly NukeCodeSystem _codes = default!; [Dependency] private readonly ItemSlotsSystem _itemSlots = default!; [Dependency] private readonly PopupSystem _popups = default!; - [Dependency] private readonly IEntityLookup _lookup = default!; + [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly IChatManager _chat = default!; public override void Initialize() diff --git a/Content.Server/Physics/Controllers/ConveyorController.cs b/Content.Server/Physics/Controllers/ConveyorController.cs index 84b8583f08..2ddf040a82 100644 --- a/Content.Server/Physics/Controllers/ConveyorController.cs +++ b/Content.Server/Physics/Controllers/ConveyorController.cs @@ -10,7 +10,7 @@ namespace Content.Server.Physics.Controllers { public sealed class ConveyorController : VirtualController { - [Dependency] private readonly IEntityLookup _lookup = default!; + [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly ConveyorSystem _conveyor = default!; [Dependency] private readonly SharedContainerSystem _container = default!; diff --git a/Content.Server/Pinpointer/ServerPinpointerSystem.cs b/Content.Server/Pinpointer/ServerPinpointerSystem.cs index bddc65d1a7..5cf4e267c5 100644 --- a/Content.Server/Pinpointer/ServerPinpointerSystem.cs +++ b/Content.Server/Pinpointer/ServerPinpointerSystem.cs @@ -11,7 +11,7 @@ namespace Content.Server.Pinpointer { public sealed class ServerPinpointerSystem : SharedPinpointerSystem { - [Dependency] private readonly IEntityLookup _entityLookup = default!; + [Dependency] private readonly EntityLookupSystem _entityLookup = default!; public override void Initialize() { diff --git a/Content.Server/Radiation/RadiationPulseSystem.cs b/Content.Server/Radiation/RadiationPulseSystem.cs index 4c87f7f656..a6f5a78c69 100644 --- a/Content.Server/Radiation/RadiationPulseSystem.cs +++ b/Content.Server/Radiation/RadiationPulseSystem.cs @@ -13,7 +13,7 @@ namespace Content.Server.Radiation public sealed class RadiationPulseSystem : EntitySystem { [Dependency] private readonly IEntityManager _entMan = default!; - [Dependency] private readonly IEntityLookup _lookup = default!; + [Dependency] private readonly EntityLookupSystem _lookup = default!; private const float RadiationCooldown = 1.0f; private float _accumulator; diff --git a/Content.Server/Singularity/EntitySystems/SingularitySystem.cs b/Content.Server/Singularity/EntitySystems/SingularitySystem.cs index 506c64be46..0d10616e2d 100644 --- a/Content.Server/Singularity/EntitySystems/SingularitySystem.cs +++ b/Content.Server/Singularity/EntitySystems/SingularitySystem.cs @@ -17,7 +17,7 @@ namespace Content.Server.Singularity.EntitySystems [UsedImplicitly] public sealed class SingularitySystem : SharedSingularitySystem { - [Dependency] private readonly IEntityLookup _lookup = default!; + [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly SharedContainerSystem _container = default!; diff --git a/Content.Server/Storage/Components/EntityStorageComponent.cs b/Content.Server/Storage/Components/EntityStorageComponent.cs index 7540779d43..bee8ec4a0e 100644 --- a/Content.Server/Storage/Components/EntityStorageComponent.cs +++ b/Content.Server/Storage/Components/EntityStorageComponent.cs @@ -475,7 +475,7 @@ namespace Content.Server.Storage.Components protected virtual IEnumerable DetermineCollidingEntities() { - var entityLookup = IoCManager.Resolve(); + var entityLookup = EntitySystem.Get(); return entityLookup.GetEntitiesIntersecting(Owner, _enteringRange, LookupFlags.Approximate); } diff --git a/Content.Server/Storage/Components/ServerStorageComponent.cs b/Content.Server/Storage/Components/ServerStorageComponent.cs index af70f6e286..9d22e21338 100644 --- a/Content.Server/Storage/Components/ServerStorageComponent.cs +++ b/Content.Server/Storage/Components/ServerStorageComponent.cs @@ -565,7 +565,7 @@ namespace Content.Server.Storage.Components if (_areaInsert && (eventArgs.Target == null || !_entityManager.HasComponent(eventArgs.Target.Value))) { var validStorables = new List(); - foreach (var entity in IoCManager.Resolve().GetEntitiesInRange(eventArgs.ClickLocation, _areaInsertRadius, LookupFlags.None)) + foreach (var entity in EntitySystem.Get().GetEntitiesInRange(eventArgs.ClickLocation, _areaInsertRadius, LookupFlags.None)) { if (entity.IsInContainer() || entity == eventArgs.User diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/TelepathicArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/TelepathicArtifactSystem.cs index 7566075905..87181dd97d 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/TelepathicArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/TelepathicArtifactSystem.cs @@ -10,7 +10,7 @@ namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; public sealed class TelepathicArtifactSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly IEntityLookup _lookup = default!; + [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; public override void Initialize() diff --git a/Content.Shared/Follower/FollowerSystem.cs b/Content.Shared/Follower/FollowerSystem.cs index d83e99e909..b6146be2af 100644 --- a/Content.Shared/Follower/FollowerSystem.cs +++ b/Content.Shared/Follower/FollowerSystem.cs @@ -51,7 +51,7 @@ public sealed class FollowerSystem : EntitySystem // Since we parent our observer to the followed entity, we need to detach // before they get deleted so that we don't get recursively deleted too. - private void OnFollowedTerminating(EntityUid uid, FollowedComponent component, EntityTerminatingEvent args) + private void OnFollowedTerminating(EntityUid uid, FollowedComponent component, ref EntityTerminatingEvent args) { StopAllFollowers(uid, component); } diff --git a/Content.Shared/Maps/TurfHelpers.cs b/Content.Shared/Maps/TurfHelpers.cs index 36ac9ea839..ffbe77133d 100644 --- a/Content.Shared/Maps/TurfHelpers.cs +++ b/Content.Shared/Maps/TurfHelpers.cs @@ -157,9 +157,9 @@ namespace Content.Shared.Maps /// Helper that returns all entities in a turf. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static IEnumerable GetEntitiesInTile(this TileRef turf, LookupFlags flags = LookupFlags.IncludeAnchored, IEntityLookup? lookupSystem = null) + public static IEnumerable GetEntitiesInTile(this TileRef turf, LookupFlags flags = LookupFlags.IncludeAnchored, EntityLookupSystem? lookupSystem = null) { - lookupSystem ??= IoCManager.Resolve(); + lookupSystem ??= EntitySystem.Get(); if (!GetWorldTileBox(turf, out var worldBox)) return Enumerable.Empty(); @@ -170,7 +170,7 @@ namespace Content.Shared.Maps /// /// Helper that returns all entities in a turf. /// - public static IEnumerable GetEntitiesInTile(this EntityCoordinates coordinates, LookupFlags flags = LookupFlags.IncludeAnchored, IEntityLookup? lookupSystem = null) + public static IEnumerable GetEntitiesInTile(this EntityCoordinates coordinates, LookupFlags flags = LookupFlags.IncludeAnchored, EntityLookupSystem? lookupSystem = null) { var turf = coordinates.GetTileRef(); @@ -183,7 +183,7 @@ namespace Content.Shared.Maps /// /// Helper that returns all entities in a turf. /// - public static IEnumerable GetEntitiesInTile(this Vector2i indices, GridId gridId, LookupFlags flags = LookupFlags.IncludeAnchored, IEntityLookup? lookupSystem = null) + public static IEnumerable GetEntitiesInTile(this Vector2i indices, GridId gridId, LookupFlags flags = LookupFlags.IncludeAnchored, EntityLookupSystem? lookupSystem = null) { return GetEntitiesInTile(indices.GetTileRef(gridId), flags, lookupSystem); } diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/dummy_npcs.yml b/Resources/Prototypes/Entities/Mobs/NPCs/dummy_npcs.yml index 150217aafb..edca406560 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/dummy_npcs.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/dummy_npcs.yml @@ -7,5 +7,6 @@ suffix: AI components: - type: UtilityAI + startingGear: AssistantGear behaviorSets: - PathingDummy