Replace IEntityManager resolves in systems for cached EntityManager
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user