Replace IEntityManager resolves in systems for cached EntityManager

This commit is contained in:
Vera Aguilera Puerto
2021-12-08 13:00:43 +01:00
parent 2699540526
commit c8b65be747
98 changed files with 338 additions and 338 deletions

View File

@@ -33,7 +33,7 @@ namespace Content.Server.Atmos.EntitySystems
foreach (var entity in _gridtileLookupSystem.GetEntitiesIntersecting(tile.GridIndex, tile.GridIndices))
{
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out IPhysBody? physics)
if (!EntityManager.TryGetComponent(entity, out IPhysBody? physics)
|| !entity.IsMovedByPressure(out var pressure)
|| entity.IsInContainer())
continue;

View File

@@ -75,9 +75,9 @@ namespace Content.Server.Atmos.EntitySystems
{
foreach (var exposed in EntityManager.EntityQuery<AtmosExposedComponent>())
{
var tile = GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(exposed.Owner).Coordinates);
var tile = GetTileMixture(EntityManager.GetComponent<TransformComponent>(exposed.Owner).Coordinates);
if (tile == null) continue;
var updateEvent = new AtmosExposedUpdateEvent(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(exposed.Owner).Coordinates, tile);
var updateEvent = new AtmosExposedUpdateEvent(EntityManager.GetComponent<TransformComponent>(exposed.Owner).Coordinates, tile);
RaiseLocalEvent(exposed.Owner, ref updateEvent);
}

View File

@@ -86,7 +86,7 @@ namespace Content.Server.Atmos.EntitySystems
var uid = barotrauma.Owner;
var status = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ServerAlertsComponent>(barotrauma.Owner);
var status = EntityManager.GetComponentOrNull<ServerAlertsComponent>(barotrauma.Owner);
var pressure = 1f;

View File

@@ -224,7 +224,7 @@ namespace Content.Server.Atmos.EntitySystems
flammable.FireStacks = MathF.Min(0, flammable.FireStacks + 1);
}
IoCManager.Resolve<IEntityManager>().TryGetComponent(flammable.Owner, out ServerAlertsComponent? status);
EntityManager.TryGetComponent(flammable.Owner, out ServerAlertsComponent? status);
if (!flammable.OnFire)
{

View File

@@ -24,7 +24,7 @@ namespace Content.Server.Atmos.EntitySystems
private void AddOpenUIVerb(EntityUid uid, GasTankComponent component, GetActivationVerbsEvent args)
{
if (!args.CanAccess || !IoCManager.Resolve<IEntityManager>().TryGetComponent<ActorComponent?>(args.User, out var actor))
if (!args.CanAccess || !EntityManager.TryGetComponent<ActorComponent?>(args.User, out var actor))
return;
Verb verb = new();

View File

@@ -196,17 +196,17 @@ namespace Content.Server.Atmos.EntitySystems
// This is the max in any direction that we can get a chunk (e.g. max 2 chunks away of data).
var (maxXDiff, maxYDiff) = ((int) (_updateRange / ChunkSize) + 1, (int) (_updateRange / ChunkSize) + 1);
var worldBounds = Box2.CenteredAround(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).WorldPosition,
var worldBounds = Box2.CenteredAround(EntityManager.GetComponent<TransformComponent>(entity).WorldPosition,
new Vector2(_updateRange, _updateRange));
foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).MapID, worldBounds))
foreach (var grid in _mapManager.FindGridsIntersecting(EntityManager.GetComponent<TransformComponent>(entity).MapID, worldBounds))
{
if (!_overlay.TryGetValue(grid.Index, out var chunks))
{
continue;
}
var entityTile = grid.GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates).GridIndices;
var entityTile = grid.GetTileRef(EntityManager.GetComponent<TransformComponent>(entity).Coordinates).GridIndices;
for (var x = -maxXDiff; x <= maxXDiff; x++)
{