Fix more errors

This commit is contained in:
DrSmugleaf
2021-12-06 00:52:58 +01:00
parent 2b1fecbe02
commit 215cae5655
55 changed files with 262 additions and 297 deletions

View File

@@ -124,19 +124,19 @@ namespace Content.Server.Sandbox
.EnumeratePrototypes<AccessLevelPrototype>()
.Select(p => p.ID).ToArray();
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(player.AttachedEntity, out InventoryComponent? inv)
if (_entityManager.TryGetComponent(player.AttachedEntity.Value, out InventoryComponent? inv)
&& inv.TryGetSlotItem(Slots.IDCARD, out ItemComponent? wornItem))
{
if (IoCManager.Resolve<IEntityManager>().HasComponent<AccessComponent>(wornItem.Owner))
if (_entityManager.HasComponent<AccessComponent>(wornItem.Owner))
{
UpgradeId(wornItem.Owner);
}
else if (IoCManager.Resolve<IEntityManager>().TryGetComponent(wornItem.Owner, out PDAComponent? pda))
else if (_entityManager.TryGetComponent(wornItem.Owner, out PDAComponent? pda))
{
if (pda.ContainedID == null)
{
var newID = CreateFreshId();
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(pda.Owner, out ItemSlotsComponent? itemSlots))
if (_entityManager.TryGetComponent(pda.Owner, out ItemSlotsComponent? itemSlots))
{
_entityManager.EntitySysManager.GetEntitySystem<ItemSlotsSystem>().
TryInsert(wornItem.Owner, pda.IdSlot, newID);
@@ -148,12 +148,12 @@ namespace Content.Server.Sandbox
}
}
}
else if (IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(player.AttachedEntity, out var hands))
else if (_entityManager.TryGetComponent<HandsComponent?>(player.AttachedEntity.Value, out var hands))
{
var card = CreateFreshId();
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(player.AttachedEntity, out inv) || !inv.Equip(Slots.IDCARD, card))
if (!_entityManager.TryGetComponent(player.AttachedEntity.Value, out inv) || !inv.Equip(Slots.IDCARD, card))
{
hands.PutInHandOrDrop(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(card));
hands.PutInHandOrDrop(_entityManager.GetComponent<ItemComponent>(card));
}
}
@@ -162,18 +162,18 @@ namespace Content.Server.Sandbox
var accessSystem = EntitySystem.Get<AccessSystem>();
accessSystem.TrySetTags(id, allAccess);
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(id, out SpriteComponent? sprite))
if (_entityManager.TryGetComponent(id, out SpriteComponent? sprite))
{
sprite.LayerSetState(0, "gold");
}
}
EntityUidCreateFreshId()
EntityUid CreateFreshId()
{
var card = _entityManager.SpawnEntity("CaptainIDCard", IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.AttachedEntity).Coordinates);
var card = _entityManager.SpawnEntity("CaptainIDCard", _entityManager.GetComponent<TransformComponent>(player.AttachedEntity.Value).Coordinates);
UpgradeId(card);
IoCManager.Resolve<IEntityManager>().GetComponent<IdCardComponent>(card).FullName = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(player.AttachedEntity).EntityName;
_entityManager.GetComponent<IdCardComponent>(card).FullName = _entityManager.GetComponent<MetaDataComponent>(player.AttachedEntity.Value).EntityName;
return card;
}
}