Inline GetComponent

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 11:55:25 +01:00
parent c2e6da1e54
commit b835bea086
131 changed files with 363 additions and 299 deletions

View File

@@ -191,7 +191,7 @@ namespace Content.Server.GameTicking
var mob = SpawnObserverMob();
mob.Name = name;
var ghost = mob.GetComponent<GhostComponent>();
var ghost = IoCManager.Resolve<IEntityManager>().GetComponent<GhostComponent>(mob.Uid);
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghost, false);
newMind.TransferTo(mob.Uid);
@@ -238,7 +238,7 @@ namespace Content.Server.GameTicking
if (!string.IsNullOrEmpty(equipmentStr))
{
var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, entity.Transform.Coordinates);
inventory.Equip(slot, equipmentEntity.GetComponent<ItemComponent>());
inventory.Equip(slot, IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(equipmentEntity.Uid));
}
}
}
@@ -273,7 +273,7 @@ namespace Content.Server.GameTicking
_cardSystem.TryChangeFullName(card.Owner.Uid, characterName, card);
_cardSystem.TryChangeJobTitle(card.Owner.Uid, jobPrototype.Name, card);
var access = card.Owner.GetComponent<AccessComponent>();
var access = IoCManager.Resolve<IEntityManager>().GetComponent<AccessComponent>(card.Owner.Uid);
var accessTags = access.Tags;
accessTags.UnionWith(jobPrototype.Access);
EntityManager.EntitySysManager.GetEntitySystem<PDASystem>()

View File

@@ -82,7 +82,7 @@ namespace Content.Server.GameTicking.Presets
else if (!string.IsNullOrWhiteSpace(mind.Session?.Name))
ghost.Name = mind.Session.Name;
var ghostComponent = ghost.GetComponent<GhostComponent>();
var ghostComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GhostComponent>(ghost.Uid);
if (mind.TimeOfDeath.HasValue)
{

View File

@@ -93,15 +93,15 @@ namespace Content.Server.GameTicking.Presets
// pda
var newPDA = _entityManager.SpawnEntity(PDAPrototypeName, mind.OwnedEntity.Transform.Coordinates);
inventory.Equip(EquipmentSlotDefines.Slots.IDCARD, newPDA.GetComponent<ItemComponent>());
inventory.Equip(EquipmentSlotDefines.Slots.IDCARD, IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(newPDA.Uid));
// belt
var newTmp = _entityManager.SpawnEntity(BeltPrototypeName, mind.OwnedEntity.Transform.Coordinates);
inventory.Equip(EquipmentSlotDefines.Slots.BELT, newTmp.GetComponent<ItemComponent>());
inventory.Equip(EquipmentSlotDefines.Slots.BELT, IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(newTmp.Uid));
// backpack
newTmp = _entityManager.SpawnEntity(BackpackPrototypeName, mind.OwnedEntity.Transform.Coordinates);
inventory.Equip(EquipmentSlotDefines.Slots.BACKPACK, newTmp.GetComponent<ItemComponent>());
inventory.Equip(EquipmentSlotDefines.Slots.BACKPACK, IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(newTmp.Uid));
// Like normal traitors, they need access to a traitor account.
var uplinkAccount = new UplinkAccount(startingBalance, mind.OwnedEntity.Uid);
@@ -114,7 +114,7 @@ namespace Content.Server.GameTicking.Presets
_allOriginalNames[uplinkAccount] = mind.OwnedEntity.Name;
// The PDA needs to be marked with the correct owner.
var pda = newPDA.GetComponent<PDAComponent>();
var pda = IoCManager.Resolve<IEntityManager>().GetComponent<PDAComponent>(newPDA.Uid);
_entityManager.EntitySysManager.GetEntitySystem<PDASystem>()
.SetOwner(pda, mind.OwnedEntity.Name);
IoCManager.Resolve<IEntityManager>().AddComponent<TraitorDeathMatchReliableOwnerTagComponent>(newPDA).UserId = mind.UserId;