Gets rid of all ComponentManager usages. (#4707)

This commit is contained in:
Vera Aguilera Puerto
2021-09-28 13:35:29 +02:00
committed by GitHub
parent 7953e5b962
commit 0be5ff829b
158 changed files with 321 additions and 333 deletions

View File

@@ -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<IEntity> _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<IComponentManager, EntityManager>();
IoCManager.Register<IEntityManager, EntityManager>();
IoCManager.Register<IRuntimeLog, RuntimeLog>();
IoCManager.Register<ILogManager, LogManager>();
IoCManager.Register<IDynamicTypeFactory, DynamicTypeFactory>();
IoCManager.Register<IEntitySystemManager, EntitySystemManager>();
var entityManager = new Mock<IEntityManager>().Object;
IoCManager.RegisterInstance<IEntityManager>(entityManager);
IoCManager.RegisterInstance<IReflectionManager>(new Mock<IReflectionManager>().Object);
var dummyReg = new Mock<IComponentRegistration>();
@@ -56,16 +53,14 @@ namespace Content.Benchmarks
IoCManager.RegisterInstance<IComponentFactory>(componentFactory.Object);
IoCManager.BuildGraph();
_componentManager = IoCManager.Resolve<IComponentManager>();
_componentManager.Initialize();
_entityManager = IoCManager.Resolve<IEntityManager>();
_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<DummyComponent>(entity);
var entity = _entityManager.SpawnEntity(null, EntityCoordinates.Invalid);
_entityManager.AddComponent<DummyComponent>(entity);
}
}
@@ -74,7 +69,7 @@ namespace Content.Benchmarks
{
var count = 0;
foreach (var _ in _componentManager.EntityQuery<DummyComponent>(true))
foreach (var _ in _entityManager.EntityQuery<DummyComponent>(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;
}

View File

@@ -10,7 +10,7 @@ namespace Content.Client.Camera
{
base.FrameUpdate(frameTime);
foreach (var recoil in EntityManager.ComponentManager.EntityQuery<CameraRecoilComponent>(true))
foreach (var recoil in EntityManager.EntityQuery<CameraRecoilComponent>(true))
{
recoil.FrameUpdate(frameTime);
}

View File

@@ -50,7 +50,7 @@ namespace Content.Client.Commands
EntitySystem.Get<SubFloorHideSystem>()
.ShowAll = true;
var components = IoCManager.Resolve<IEntityManager>().ComponentManager
var components = IoCManager.Resolve<IEntityManager>()
.EntityQuery<SubFloorHideComponent>(true);
foreach (var component in components)

View File

@@ -16,8 +16,8 @@ namespace Content.Client.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var componentManager = IoCManager.Resolve<IComponentManager>();
var mechanisms = componentManager.EntityQuery<SharedMechanismComponent>(true);
var entityManager = IoCManager.Resolve<IEntityManager>();
var mechanisms = entityManager.EntityQuery<SharedMechanismComponent>(true);
foreach (var mechanism in mechanisms)
{

View File

@@ -18,8 +18,8 @@ namespace Content.Client.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var componentManager = IoCManager.Resolve<IComponentManager>();
var mechanisms = componentManager.EntityQuery<SharedMechanismComponent>(true);
var entityManager = IoCManager.Resolve<IEntityManager>();
var mechanisms = entityManager.EntityQuery<SharedMechanismComponent>(true);
foreach (var mechanism in mechanisms)
{

View File

@@ -56,7 +56,7 @@ namespace Content.Client.DoAfter
var viewbox = _eyeManager.GetWorldViewport().Enlarged(2.0f);
foreach (var comp in ComponentManager.EntityQuery<DoAfterComponent>(true))
foreach (var comp in EntityManager.EntityQuery<DoAfterComponent>(true))
{
var doAfters = comp.DoAfters.ToList();
var compPos = comp.Owner.Transform.WorldPosition;

View File

@@ -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))
{

View File

@@ -79,7 +79,7 @@ namespace Content.Client.HealthOverlay
var viewBox = _eyeManager.GetWorldViewport().Enlarged(2.0f);
foreach (var (mobState, _) in ComponentManager.EntityQuery<IMobStateComponent, DamageableComponent>())
foreach (var (mobState, _) in EntityManager.EntityQuery<IMobStateComponent, DamageableComponent>())
{
var entity = mobState.Owner;

View File

@@ -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;
}

View File

@@ -100,7 +100,7 @@ namespace Content.Client.IconSmoothing
{
foreach (var entity in candidates)
{
if (ComponentManager.HasComponent<IconSmoothComponent>(entity))
if (EntityManager.HasComponent<IconSmoothComponent>(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;

View File

@@ -44,7 +44,7 @@ namespace Content.Client.Instruments
return;
}
foreach (var instrumentComponent in EntityManager.ComponentManager.EntityQuery<InstrumentComponent>(true))
foreach (var instrumentComponent in EntityManager.EntityQuery<InstrumentComponent>(true))
{
instrumentComponent.Update(frameTime);
}

View File

@@ -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<EntityUid> _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;
}

View File

@@ -63,7 +63,7 @@ namespace Content.Client.Light
private void HandleAnimationComplete(EntityUid uid, EmergencyLightComponent component, AnimationCompletedEvent args)
{
if (!component.Enabled ||
!ComponentManager.TryGetComponent<AnimationPlayerComponent>(uid, out var playerComponent)) return;
!EntityManager.TryGetComponent<AnimationPlayerComponent>(uid, out var playerComponent)) return;
playerComponent.Play(Animation, AnimKey);
}

View File

@@ -18,7 +18,7 @@ namespace Content.Client.Markers
private void UpdateMarkers()
{
foreach (var markerComponent in EntityManager.ComponentManager.EntityQuery<MarkerComponent>(true))
foreach (var markerComponent in EntityManager.EntityQuery<MarkerComponent>(true))
{
markerComponent.UpdateVisibility();
}

View File

@@ -49,7 +49,7 @@ namespace Content.Client.Popups
if (!EntityManager.EntityExists(uid))
return;
var transform = ComponentManager.GetComponent<ITransformComponent>(uid);
var transform = EntityManager.GetComponent<ITransformComponent>(uid);
PopupMessage(message, _eyeManager.CoordinatesToScreen(transform.Coordinates));
}

View File

@@ -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<SingularityDistortionComponent>();
var distortions = _entityManager.EntityQuery<SingularityDistortionComponent>();
foreach (var distortion in distortions) //Add all singulos that are not added yet but qualify
{
var singuloEntity = distortion.Owner;

View File

@@ -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<RadiationPulseComponent>(true)
.ToList();

View File

@@ -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<EyeComponent>(camera.Uid, out var eyeComponent))
if (!EntityManager.TryGetComponent<EyeComponent>(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<TabletopDraggableComponent>(draggedEntity.Uid))
if (!EntityManager.HasComponent<TabletopDraggableComponent>(draggedEntity.Uid))
{
return false;
}

View File

@@ -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;
}

View File

@@ -11,7 +11,7 @@ namespace Content.Client.Weapons.Melee
{
base.FrameUpdate(frameTime);
foreach (var meleeLungeComponent in EntityManager.ComponentManager.EntityQuery<MeleeLungeComponent>(true))
foreach (var meleeLungeComponent in EntityManager.EntityQuery<MeleeLungeComponent>(true))
{
meleeLungeComponent.Update(frameTime);
}

View File

@@ -30,7 +30,7 @@ namespace Content.Client.Weapons.Melee
{
base.FrameUpdate(frameTime);
foreach (var arcAnimationComponent in EntityManager.ComponentManager.EntityQuery<MeleeWeaponArcAnimationComponent>(true))
foreach (var arcAnimationComponent in EntityManager.EntityQuery<MeleeWeaponArcAnimationComponent>(true))
{
arcAnimationComponent.Update(frameTime);
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -68,7 +68,7 @@ namespace Content.Server.AI.EntitySystems
yield break;
}
foreach (var component in ComponentManager.EntityQuery<AiFactionTagComponent>(true))
foreach (var component in EntityManager.EntityQuery<AiFactionTagComponent>(true))
{
if ((component.Factions & hostile) == 0)
continue;

View File

@@ -58,7 +58,7 @@ namespace Content.Server.AI.Utils
public static IEnumerable<IEntity> GetEntitiesInRange(EntityCoordinates grid, Type component, float range)
{
var entityManager = IoCManager.Resolve<IEntityManager>();
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))
{

View File

@@ -15,7 +15,7 @@ namespace Content.Server.AME
_accumulatedFrameTime += frameTime;
if (_accumulatedFrameTime >= 10)
{
foreach (var comp in ComponentManager.EntityQuery<AMEControllerComponent>(true))
foreach (var comp in EntityManager.EntityQuery<AMEControllerComponent>(true))
{
comp.OnUpdate(frameTime);
}

View File

@@ -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<AMEShieldComponent>(sc)))
if (mapGrid.GetAnchoredEntities(snapPos).Any(sc => _serverEntityManager.HasComponent<AMEShieldComponent>(sc)))
{
Owner.PopupMessage(args.User, Loc.GetString("ame-part-component-shielding-already-present"));
return true;

View File

@@ -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++;
}

View File

@@ -36,7 +36,7 @@ namespace Content.Server.Administration.Commands
var entityManager = IoCManager.Resolve<IEntityManager>();
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<IEntity>(entitiesWithComponents.First()), (h, e) => { h.IntersectWith(e); return h; });
var count = 0;

View File

@@ -47,7 +47,7 @@ namespace Content.Server.Administration.Commands
var entityManager = IoCManager.Resolve<IEntityManager>();
var entityIds = new HashSet<string>();
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<IEntity>(entitiesWithComponents.First()), (h, e) => { h.IntersectWith(e); return h; });
foreach (var entity in entitiesWithAllComponents)

View File

@@ -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;

View File

@@ -38,12 +38,12 @@ namespace Content.Server.Administration.Commands
return;
}
var comp = IoCManager.Resolve<IComponentManager>();
var entMan = IoCManager.Resolve<IEntityManager>();
var location = args[0];
if (location == "?")
{
var locations = string.Join(", ",
comp.EntityQuery<WarpPointComponent>(true)
entMan.EntityQuery<WarpPointComponent>(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<IMapManager>();
var currentMap = player.AttachedEntity.Transform.MapID;
var currentGrid = player.AttachedEntity.Transform.GridID;
var entityManager = IoCManager.Resolve<IEntityManager>();
var found = comp.EntityQuery<WarpPointComponent>(true)
var found = entMan.EntityQuery<WarpPointComponent>(true)
.Where(p => p.Location == location)
.Select(p => p.Owner.Transform.Coordinates)
.OrderBy(p => p, Comparer<EntityCoordinates>.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))

View File

@@ -108,7 +108,7 @@ namespace Content.Server.Advertise
var curTime = _gameTiming.CurTime;
foreach (var advertise in ComponentManager.EntityQuery<AdvertiseComponent>())
foreach (var advertise in EntityManager.EntityQuery<AdvertiseComponent>())
{
if (!advertise.Enabled)
continue;

View File

@@ -64,7 +64,7 @@ namespace Content.Server.Arcade
public override void Update(float frameTime)
{
foreach (var comp in ComponentManager.EntityQuery<BlockGameArcadeComponent>(true))
foreach (var comp in EntityManager.EntityQuery<BlockGameArcadeComponent>(true))
{
comp.DoGameTick(frameTime);
}

View File

@@ -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<GridAtmosphereComponent>(mapGrid.GridEntityId))
if (EntityManager.HasComponent<GridAtmosphereComponent>(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<GasMixture>();
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<AirtightComponent>(uid, out var ac))
if (EntityManager.TryGetComponent<AirtightComponent>(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<Vector2i>();
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<GasMixture>();
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;

View File

@@ -468,7 +468,7 @@ namespace Content.Server.Atmos.EntitySystems
{
var direction = ((Vector2)_depressurizeTiles[tileCount - 1].GridIndices - tile.GridIndices).Normalized;
var gridPhysics = ComponentManager.GetComponent<PhysicsComponent>(mapGrid.GridEntityId);
var gridPhysics = EntityManager.GetComponent<PhysicsComponent>(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();

View File

@@ -231,7 +231,7 @@ namespace Content.Server.Atmos.EntitySystems
{
_currentRunAtmosphereIndex = 0;
_currentRunAtmosphere.Clear();
_currentRunAtmosphere.AddRange(ComponentManager.EntityQuery<GridAtmosphereComponent>());
_currentRunAtmosphere.AddRange(EntityManager.EntityQuery<GridAtmosphereComponent>());
}
// We set this to true just in case we have to stop processing due to time constraints.

View File

@@ -68,7 +68,7 @@ namespace Content.Server.Atmos.EntitySystems
if (_exposedTimer >= ExposedUpdateDelay)
{
foreach (var exposed in EntityManager.ComponentManager.EntityQuery<AtmosExposedComponent>())
foreach (var exposed in EntityManager.EntityQuery<AtmosExposedComponent>())
{
// TODO ATMOS: Kill this with fire.
var tile = GetTileMixture(exposed.Owner.Transform.Coordinates);

View File

@@ -68,7 +68,7 @@ namespace Content.Server.Atmos.EntitySystems
_timer -= UpdateTimer;
foreach (var (barotrauma, transform) in ComponentManager.EntityQuery<BarotraumaComponent, ITransformComponent>())
foreach (var (barotrauma, transform) in EntityManager.EntityQuery<BarotraumaComponent, ITransformComponent>())
{
var uid = barotrauma.Owner.Uid;

View File

@@ -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<FlammableComponent, PhysicsComponent, ITransformComponent>())
foreach (var (flammable, physics, transform) in EntityManager.EntityQuery<FlammableComponent, PhysicsComponent, ITransformComponent>())
{
var uid = flammable.Owner.Uid;
@@ -237,7 +237,7 @@ namespace Content.Server.Atmos.EntitySystems
continue;
}
var otherPhysics = ComponentManager.GetComponent<IPhysBody>(uid);
var otherPhysics = EntityManager.GetComponent<IPhysBody>(uid);
// TODO: Sloth, please save our souls!
if (!physics.GetWorldAABB().Intersects(otherPhysics.GetWorldAABB()))

View File

@@ -9,7 +9,7 @@ namespace Content.Server.Atmos.EntitySystems
{
public override void Update(float frameTime)
{
foreach (var analyzer in ComponentManager.EntityQuery<GasAnalyzerComponent>(true))
foreach (var analyzer in EntityManager.EntityQuery<GasAnalyzerComponent>(true))
{
analyzer.Update(frameTime);
}

View File

@@ -22,7 +22,7 @@ namespace Content.Server.Atmos.EntitySystems
if (_timer < TimerDelay) return;
_timer -= TimerDelay;
foreach (var gasTank in EntityManager.ComponentManager.EntityQuery<GasTankComponent>())
foreach (var gasTank in EntityManager.EntityQuery<GasTankComponent>())
{
_atmosphereSystem.React(gasTank.Air, gasTank);
gasTank.CheckStatus();

View File

@@ -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);
}

View File

@@ -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)

View File

@@ -27,7 +27,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
var appearance = pump.Owner.GetComponentOrNull<AppearanceComponent>();
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);
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -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);

View File

@@ -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)

View File

@@ -29,8 +29,8 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
var appearance = filter.Owner.GetComponentOrNull<AppearanceComponent>();
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)

View File

@@ -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)

View File

@@ -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<ContainerManagerComponent>(EntityManager.GetEntity(uid));
containerManager = EntityManager.AddComponent<ContainerManagerComponent>(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);

View File

@@ -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))

View File

@@ -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))

View File

@@ -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<GasPortComponent>(entityUid, out port))
if (EntityManager.TryGetComponent<GasPortComponent>(entityUid, out port))
{
return true;
}

View File

@@ -29,7 +29,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
var appearance = thermoMachine.Owner.GetComponentOrNull<AppearanceComponent>();
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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -14,7 +14,7 @@ namespace Content.Server.Audio
private void HandlePowerChange(EntityUid uid, AmbientOnPoweredComponent component, PowerChangedEvent args)
{
if (!ComponentManager.TryGetComponent<AmbientSoundComponent>(uid, out var ambientSound)) return;
if (!EntityManager.TryGetComponent<AmbientSoundComponent>(uid, out var ambientSound)) return;
if (ambientSound.Enabled == args.Powered) return;
ambientSound.Enabled = args.Powered;
ambientSound.Dirty();

View File

@@ -20,9 +20,9 @@ namespace Content.Server.Body
private void OnRelayMoveInput(EntityUid uid, BodyComponent component, RelayMoveInputEvent args)
{
if (ComponentManager.TryGetComponent<IMobStateComponent>(uid, out var mobState) &&
if (EntityManager.TryGetComponent<IMobStateComponent>(uid, out var mobState) &&
mobState.IsDead() &&
ComponentManager.TryGetComponent<MindComponent>(uid, out var mind) &&
EntityManager.TryGetComponent<MindComponent>(uid, out var mind) &&
mind.HasMind)
{
_ticker.OnGhostAttempt(mind.Mind!, true);

View File

@@ -35,7 +35,7 @@ namespace Content.Server.Body.Metabolism
{
base.Update(frameTime);
foreach (var metab in ComponentManager.EntityQuery<MetabolizerComponent>(false))
foreach (var metab in EntityManager.EntityQuery<MetabolizerComponent>(false))
{
metab.AccumulatedFrametime += frameTime;

View File

@@ -10,7 +10,7 @@ namespace Content.Server.Body.Respiratory
{
base.Update(frameTime);
foreach (var respirator in ComponentManager.EntityQuery<RespiratorComponent>(false))
foreach (var respirator in EntityManager.EntityQuery<RespiratorComponent>(false))
{
respirator.Update(frameTime);
}

View File

@@ -39,7 +39,7 @@ namespace Content.Server.Buckle
public override void Update(float frameTime)
{
foreach (var (buckle, physics) in ComponentManager.EntityQuery<BuckleComponent, PhysicsComponent>())
foreach (var (buckle, physics) in EntityManager.EntityQuery<BuckleComponent, PhysicsComponent>())
{
buckle.Update(physics);
}

View File

@@ -199,7 +199,7 @@ namespace Content.Server.Cargo
private void SyncComponentsWithId(int id)
{
foreach (var comp in ComponentManager.EntityQuery<CargoOrderDatabaseComponent>(true))
foreach (var comp in EntityManager.EntityQuery<CargoOrderDatabaseComponent>(true))
{
if (comp.Database == null || comp.Database.Id != id)
continue;

View File

@@ -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;
}

View File

@@ -10,7 +10,7 @@ namespace Content.Server.Chemistry.EntitySystems
{
public override void Update(float frameTime)
{
foreach (var inception in ComponentManager.EntityQuery<SolutionAreaEffectInceptionComponent>().ToArray())
foreach (var inception in EntityManager.EntityQuery<SolutionAreaEffectInceptionComponent>().ToArray())
{
inception.InceptionUpdate(frameTime);
}

View File

@@ -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<VaporComponent, SolutionContainerManagerComponent>(true))
{
foreach (var (_, value) in solution.Solutions)

View File

@@ -72,7 +72,7 @@ namespace Content.Server.Cloning
public override void Update(float frameTime)
{
foreach (var (cloning, power) in ComponentManager.EntityQuery<CloningPodComponent, ApcPowerReceiverComponent>(true))
foreach (var (cloning, power) in EntityManager.EntityQuery<CloningPodComponent, ApcPowerReceiverComponent>(true))
{
if (cloning.UiKnownPowerState != power.Powered)
{
@@ -127,7 +127,7 @@ namespace Content.Server.Cloning
public void OnChangeMadeToDnaScans()
{
foreach (var cloning in ComponentManager.EntityQuery<CloningPodComponent>(true))
foreach (var cloning in EntityManager.EntityQuery<CloningPodComponent>(true))
UpdateUserInterface(cloning);
}

View File

@@ -28,7 +28,7 @@ namespace Content.Server.Damage.Systems
private void HandleCollide(EntityUid uid, DamageOnHighSpeedImpactComponent component, StartCollideEvent args)
{
if (!ComponentManager.HasComponent<DamageableComponent>(uid)) return;
if (!EntityManager.HasComponent<DamageableComponent>(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;

View File

@@ -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;
}

View File

@@ -10,7 +10,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
public override void Update(float frameTime)
{
foreach (var comp in ComponentManager.EntityQuery<DisposalHolderComponent>(true))
foreach (var comp in EntityManager.EntityQuery<DisposalHolderComponent>(true))
{
comp.Update(frameTime);
}

View File

@@ -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<ItemComponent>(uid) && body.GetWorldAABB().Intersects(disposalsBounds!.Value)) continue;
if (!EntityManager.HasComponent<ItemComponent>(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<DisposalEntryComponent>(entity));
.FirstOrDefault(entity => EntityManager.HasComponent<DisposalEntryComponent>(entity));
if (entry == default)
{
@@ -348,7 +348,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
}
var air = component.Air;
var entryComponent = EntityManager.ComponentManager.GetComponent<DisposalEntryComponent>(entry);
var entryComponent = EntityManager.GetComponent<DisposalEntryComponent>(entry);
if (_atmosSystem.GetTileMixture(component.Owner.Transform.Coordinates, true) is {Temperature: > 0} environment)
{

View File

@@ -41,7 +41,7 @@ namespace Content.Server.DoAfter
{
base.Update(frameTime);
foreach (var comp in ComponentManager.EntityQuery<DoAfterComponent>(true))
foreach (var comp in EntityManager.EntityQuery<DoAfterComponent>(true))
{
foreach (var doAfter in comp.DoAfters.ToArray())
{

View File

@@ -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);
}

View File

@@ -120,14 +120,14 @@ namespace Content.Server.Flash
if (attempt.Cancelled)
return;
if (ComponentManager.TryGetComponent<FlashableComponent>(target, out var flashable))
if (EntityManager.TryGetComponent<FlashableComponent>(target, out var flashable))
{
flashable.LastFlash = _gameTiming.CurTime;
flashable.Duration = flashDuration / 1000f; // TODO: Make this sane...
flashable.Dirty();
}
if (ComponentManager.TryGetComponent<StunnableComponent>(target, out var stunnableComponent))
if (EntityManager.TryGetComponent<StunnableComponent>(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<ITransformComponent>(source);
var transform = EntityManager.GetComponent<ITransformComponent>(source);
foreach (var entity in _entityLookup.GetEntitiesInRange(transform.Coordinates, range))
{

View File

@@ -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)
{

View File

@@ -30,7 +30,7 @@ namespace Content.Server.Fluids
private void HandlePuddleExamined(EntityUid uid, PuddleComponent component, ExaminedEvent args)
{
if (ComponentManager.TryGetComponent<SlipperyComponent>(uid, out var slippery) && slippery.Slippery)
if (EntityManager.TryGetComponent<SlipperyComponent>(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<PuddleComponent>(true))
foreach (var puddle in EntityManager.EntityQuery<PuddleComponent>(true))
{
// If the tile becomes space then delete it (potentially change by design)
var puddleTransform = puddle.Owner.Transform;

View File

@@ -250,7 +250,7 @@ namespace Content.Server.GameTicking
_possiblePositions.Clear();
foreach (var (point, transform) in ComponentManager.EntityQuery<SpawnPointComponent, ITransformComponent>())
foreach (var (point, transform) in EntityManager.EntityQuery<SpawnPointComponent, ITransformComponent>())
{
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<SpawnPointComponent, ITransformComponent>())
foreach (var (point, transform) in EntityManager.EntityQuery<SpawnPointComponent, ITransformComponent>())
{
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<SpawnPointComponent, ITransformComponent>())
foreach (var (point, transform) in EntityManager.EntityQuery<SpawnPointComponent, ITransformComponent>())
{
if (point.SpawnType == SpawnPointType.Observer)
_possiblePositions.Add(transform.Coordinates);

View File

@@ -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<SpawnPointComponent>().Select(x => x.Owner).ToList();
var ents = _entityManager.EntityQuery<SpawnPointComponent>().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<DamageTypePrototype>("Asphyxiation"), 100);
EntitySystem.Get<DamageableSystem>().TryChangeDamage(entity.Uid, damage, true);
}
}
else if (!mobState.IsDead())
{
if (entity.HasComponent<HandsComponent>())
@@ -217,7 +217,7 @@ namespace Content.Server.GameTicking.Presets
{
var lines = new List<string>();
lines.Add("traitor-death-match-end-round-description-first-line");
foreach (var pda in _entityManager.ComponentManager.EntityQuery<PDAComponent>())
foreach (var pda in _entityManager.EntityQuery<PDAComponent>())
{
var uplink = pda.SyndicateUplinkAccount;
if (uplink != null && _allOriginalNames.ContainsKey(uplink))

View File

@@ -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<VisitingMindComponent>(uid)) return;
if (!ComponentManager.TryGetComponent<MindComponent>(uid, out var mind) || !mind.HasMind || mind.Mind!.IsVisitingEntity) return;
if (EntityManager.HasComponent<VisitingMindComponent>(uid)) return;
if (!EntityManager.TryGetComponent<MindComponent>(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<string> GetLocationNames()
{
foreach (var warp in ComponentManager.EntityQuery<WarpPointComponent>())
foreach (var warp in EntityManager.EntityQuery<WarpPointComponent>())
{
if (warp.Location != null)
{
@@ -204,7 +204,7 @@ namespace Content.Server.Ghost
private WarpPointComponent? FindLocation(string name)
{
foreach (var warp in ComponentManager.EntityQuery<WarpPointComponent>(true))
foreach (var warp in EntityManager.EntityQuery<WarpPointComponent>(true))
{
if (warp.Location == name)
{

View File

@@ -41,7 +41,7 @@ namespace Content.Server.Gravity.EntitySystems
{
if (ev.GridId == GridId.Invalid) return;
var gravity = ComponentManager.GetComponent<GravityComponent>(_mapManager.GetGrid(ev.GridId).GridEntityId);
var gravity = EntityManager.GetComponent<GravityComponent>(_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<GravityGeneratorComponent>(true))
foreach (var generator in EntityManager.EntityQuery<GravityGeneratorComponent>(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<GravityGeneratorComponent>(true))
foreach (var generator in EntityManager.EntityQuery<GravityGeneratorComponent>(true))
{
if (generator.NeedsUpdate)
{

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Hands.Systems
public bool TrySpawnVirtualItemInHand(EntityUid blockingEnt, EntityUid user)
{
if (ComponentManager.TryGetComponent<HandsComponent>(user, out var hands))
if (EntityManager.TryGetComponent<HandsComponent>(user, out var hands))
{
foreach (var handName in hands.ActivePriorityEnumerable())
{
@@ -82,7 +82,7 @@ namespace Content.Server.Hands.Systems
/// </summary>
public void DeleteInHandsMatching(EntityUid user, EntityUid matching)
{
if (ComponentManager.TryGetComponent<HandsComponent>(user, out var hands))
if (EntityManager.TryGetComponent<HandsComponent>(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<HandVirtualItemComponent>(hand.HeldEntity.Uid,
out var virt)
&& virt.BlockingEntity == matching)
if (EntityManager.TryGetComponent<HandVirtualItemComponent>(hand.HeldEntity.Uid,
out var virt)
&& virt.BlockingEntity == matching)
{
Delete(virt, user);
}

View File

@@ -51,7 +51,7 @@ namespace Content.Server.Instruments
{
base.Update(frameTime);
foreach (var component in ComponentManager.EntityQuery<InstrumentComponent>(true))
foreach (var component in EntityManager.EntityQuery<InstrumentComponent>(true))
{
component.Update(frameTime);
}

View File

@@ -20,7 +20,7 @@ namespace Content.Server.Jobs
var component = (Component)IoCManager.Resolve<IComponentFactory>().GetComponent(Component);
component.Owner = mob;
IoCManager.Resolve<IComponentManager>().AddComponent(mob, component);
IoCManager.Resolve<IEntityManager>().AddComponent(mob, component);
}
}
}

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Kitchen.EntitySystems
public override void Update(float frameTime)
{
base.Update(frameTime);
foreach (var comp in ComponentManager.EntityQuery<MicrowaveComponent>(true))
foreach (var comp in EntityManager.EntityQuery<MicrowaveComponent>(true))
{
comp.OnUpdate();
}

View File

@@ -9,7 +9,7 @@ namespace Content.Server.Lathe
{
public override void Update(float frameTime)
{
foreach (var comp in ComponentManager.EntityQuery<LatheComponent>(true))
foreach (var comp in EntityManager.EntityQuery<LatheComponent>(true))
{
if (comp.Producing == false && comp.Queue.Count > 0)
{

View File

@@ -9,7 +9,7 @@ namespace Content.Server.Light.EntitySystems
{
public override void Update(float frameTime)
{
foreach (var light in ComponentManager.EntityQuery<ExpendableLightComponent>(true))
foreach (var light in EntityManager.EntityQuery<ExpendableLightComponent>(true))
{
light.Update(frameTime);
}

View File

@@ -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<AppearanceComponent>(uid, out var appearanceComponent))
if (EntityManager.TryGetComponent<AppearanceComponent>(uid, out var appearanceComponent))
{
appearanceComponent.SetData(TwoWayLeverVisuals.State, component.State);
}

View File

@@ -37,7 +37,7 @@ namespace Content.Server.Medical
public override void Update(float frameTime)
{
foreach (var comp in ComponentManager.EntityQuery<MedicalScannerComponent>(true))
foreach (var comp in EntityManager.EntityQuery<MedicalScannerComponent>(true))
{
comp.Update(frameTime);
}

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Morgue
if (_accumulatedFrameTime >= 10)
{
foreach (var morgue in ComponentManager.EntityQuery<MorgueEntityStorageComponent>(true))
foreach (var morgue in EntityManager.EntityQuery<MorgueEntityStorageComponent>(true))
{
morgue.Update();
}

View File

@@ -13,7 +13,7 @@ namespace Content.Server.Movement
{
base.Update(frameTime);
foreach (var stressTest in ComponentManager.EntityQuery<StressTestMovementComponent>(true))
foreach (var stressTest in EntityManager.EntityQuery<StressTestMovementComponent>(true))
{
var transform = stressTest.Owner.Transform;

View File

@@ -337,7 +337,7 @@ namespace Content.Server.NodeContainer.EntitySystems
{
var msg = new NodeVis.MsgData();
var allNetworks = ComponentManager
var allNetworks = EntityManager
.EntityQuery<NodeContainerComponent>()
.SelectMany(nc => nc.Nodes.Values)
.Select(n => (BaseNodeGroup?) n.NodeGroup)

View File

@@ -17,11 +17,11 @@ namespace Content.Server.NodeContainer.Nodes
if (!Owner.Transform.Anchored)
yield break;
var compMgr = IoCManager.Resolve<IComponentManager>();
var entMan = IoCManager.Resolve<IEntityManager>();
var grid = IoCManager.Resolve<IMapManager>().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;

View File

@@ -12,11 +12,11 @@ namespace Content.Server.NodeContainer.Nodes
/// </summary>
public static class NodeHelpers
{
public static IEnumerable<Node> GetNodesInTile(IComponentManager compMgr, IMapGrid grid, Vector2i coords)
public static IEnumerable<Node> 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)

View File

@@ -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<NodeContainerComponent>(entity, out var container))
if (!Owner.EntityManager.TryGetComponent<NodeContainerComponent>(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<NodeContainerComponent>(entity, out var container))
if (!Owner.EntityManager.TryGetComponent<NodeContainerComponent>(entity, out var container))
continue;
foreach (var node in container.Nodes.Values)

View File

@@ -15,7 +15,7 @@ namespace Content.Server.Nutrition.EntitySystems
if (_accumulatedFrameTime > 1)
{
foreach (var comp in ComponentManager.EntityQuery<HungerComponent>(true))
foreach (var comp in EntityManager.EntityQuery<HungerComponent>(true))
{
comp.OnUpdate(_accumulatedFrameTime);
}

View File

@@ -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)

View File

@@ -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;

View File

@@ -15,7 +15,7 @@ namespace Content.Server.Nutrition.EntitySystems
if (_accumulatedFrameTime > 1)
{
foreach (var component in ComponentManager.EntityQuery<ThirstComponent>(true))
foreach (var component in EntityManager.EntityQuery<ThirstComponent>(true))
{
component.OnUpdate(_accumulatedFrameTime);
}

Some files were not shown because too many files have changed in this diff Show More