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

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