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

@@ -82,7 +82,7 @@ namespace Content.Server.Tabletop
if (session.Players.ContainsKey(player))
return;
if(IoCManager.Resolve<IEntityManager>().TryGetComponent<TabletopGamerComponent?>(attachedEntity, out var gamer))
if(EntityManager.TryGetComponent<TabletopGamerComponent?>(attachedEntity, out var gamer))
CloseSessionFor(player, gamer.Tabletop, false);
// Set the entity as an absolute GAMER.
@@ -111,13 +111,13 @@ namespace Content.Server.Tabletop
if (!session.Players.TryGetValue(player, out var data))
return;
if(removeGamerComponent && player.AttachedEntity is {} attachedEntity && IoCManager.Resolve<IEntityManager>().TryGetComponent(attachedEntity, out TabletopGamerComponent? gamer))
if(removeGamerComponent && player.AttachedEntity is {} attachedEntity && EntityManager.TryGetComponent(attachedEntity, out TabletopGamerComponent? gamer))
{
// We invalidate this to prevent an infinite feedback from removing the component.
gamer.Tabletop = EntityUid.Invalid;
// You stop being a gamer.......
IoCManager.Resolve<IEntityManager>().RemoveComponent<TabletopGamerComponent>(attachedEntity);
EntityManager.RemoveComponent<TabletopGamerComponent>(attachedEntity);
}
session.Players.Remove(player);