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

@@ -28,7 +28,7 @@ namespace Content.Server.Tabletop
if (args.SenderSession as IPlayerSession is not { AttachedEntity: { } playerEntity } playerSession)
return;
if (!ComponentManager.TryGetComponent(msg.TableUid, out TabletopGameComponent? tabletop) || tabletop.Session is not {} session)
if (!EntityManager.TryGetComponent(msg.TableUid, out TabletopGameComponent? tabletop) || tabletop.Session is not {} session)
return;
// Check if player is actually playing at this table
@@ -46,13 +46,13 @@ namespace Content.Server.Tabletop
if (!EntityManager.TryGetEntity(msg.MovedEntityUid, out var movedEntity))
return;
if (!ComponentManager.HasComponent<TabletopDraggableComponent>(movedEntity.Uid))
if (!EntityManager.HasComponent<TabletopDraggableComponent>(movedEntity.Uid))
return;
// TODO: some permission system, disallow movement if you're not permitted to move the item
// Move the entity and dirty it (we use the map ID from the entity so noone can try to be funny and move the item to another map)
var transform = ComponentManager.GetComponent<ITransformComponent>(movedEntity.Uid);
var transform = EntityManager.GetComponent<ITransformComponent>(movedEntity.Uid);
var entityCoordinates = new EntityCoordinates(_mapManager.GetMapEntityId(transform.MapID), msg.Coordinates.Position);
transform.Coordinates = entityCoordinates;
movedEntity.Dirty();

View File

@@ -52,7 +52,7 @@ namespace Content.Server.Tabletop
TabletopMap = _mapManager.CreateMap();
_tabletops = 0;
var mapComp = ComponentManager.GetComponent<IMapComponent>(_mapManager.GetMapEntityId(TabletopMap));
var mapComp = EntityManager.GetComponent<IMapComponent>(_mapManager.GetMapEntityId(TabletopMap));
// Lighting is always disabled in tabletop world.
mapComp.LightingEnabled = false;

View File

@@ -46,7 +46,7 @@ namespace Content.Server.Tabletop
/// <param name="uid">The UID of the tabletop game entity.</param>
public void CleanupSession(EntityUid uid)
{
if (!ComponentManager.TryGetComponent(uid, out TabletopGameComponent? tabletop))
if (!EntityManager.TryGetComponent(uid, out TabletopGameComponent? tabletop))
return;
if (tabletop.Session is not { } session)
@@ -72,7 +72,7 @@ namespace Content.Server.Tabletop
/// <param name="uid">The UID of the tabletop game entity.</param>
public void OpenSessionFor(IPlayerSession player, EntityUid uid)
{
if (!ComponentManager.TryGetComponent(uid, out TabletopGameComponent? tabletop) || player.AttachedEntity is not {} attachedEntity)
if (!EntityManager.TryGetComponent(uid, out TabletopGameComponent? tabletop) || player.AttachedEntity is not {} attachedEntity)
return;
// Make sure we have a session, and add the player to it if not added already.
@@ -104,7 +104,7 @@ namespace Content.Server.Tabletop
/// <param name="removeGamerComponent">Whether to remove the <see cref="TabletopGamerComponent"/> from the player's attached entity.</param>
public void CloseSessionFor(IPlayerSession player, EntityUid uid, bool removeGamerComponent = true)
{
if (!ComponentManager.TryGetComponent(uid, out TabletopGameComponent? tabletop) || tabletop.Session is not { } session)
if (!EntityManager.TryGetComponent(uid, out TabletopGameComponent? tabletop) || tabletop.Session is not { } session)
return;
if (!session.Players.TryGetValue(player, out var data))

View File

@@ -36,7 +36,7 @@ namespace Content.Server.Tabletop
private void OnTabletopActivate(EntityUid uid, TabletopGameComponent component, ActivateInWorldEvent args)
{
// Check that a player is attached to the entity.
if (!ComponentManager.TryGetComponent(args.User.Uid, out ActorComponent? actor))
if (!EntityManager.TryGetComponent(args.User.Uid, out ActorComponent? actor))
return;
// Check that the entity can interact with the game board.
@@ -62,7 +62,7 @@ namespace Content.Server.Tabletop
private void OnGamerShutdown(EntityUid uid, TabletopGamerComponent component, ComponentShutdown args)
{
if (!ComponentManager.TryGetComponent(uid, out ActorComponent? actor))
if (!EntityManager.TryGetComponent(uid, out ActorComponent? actor))
return;
if(component.Tabletop.IsValid())
@@ -73,7 +73,7 @@ namespace Content.Server.Tabletop
{
base.Update(frameTime);
foreach (var gamer in ComponentManager.EntityQuery<TabletopGamerComponent>(true))
foreach (var gamer in EntityManager.EntityQuery<TabletopGamerComponent>(true))
{
if (!EntityManager.TryGetEntity(gamer.Tabletop, out var table))
continue;