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