Inline TryGetComponent completely, for real
This commit is contained in:
@@ -50,7 +50,7 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
|
||||
var target = entityManager.GetEntity(eUid);
|
||||
if (!target.TryGetComponent(out MindComponent? mindComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(target.Uid, out MindComponent? mindComponent))
|
||||
{
|
||||
shell.WriteLine(Loc.GetString("shell-entity-is-not-mob"));
|
||||
return;
|
||||
|
||||
@@ -59,17 +59,17 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
EntitySystem.Get<StatusEffectsSystem>().TryRemoveAllStatusEffects(target.Uid);
|
||||
|
||||
if (target.TryGetComponent(out FlammableComponent? flammable))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(target.Uid, out FlammableComponent? flammable))
|
||||
{
|
||||
EntitySystem.Get<FlammableSystem>().Extinguish(target.Uid, flammable);
|
||||
}
|
||||
|
||||
if (target.TryGetComponent(out DamageableComponent? damageable))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(target.Uid, out DamageableComponent? damageable))
|
||||
{
|
||||
EntitySystem.Get<DamageableSystem>().SetAllDamage(damageable, 0);
|
||||
}
|
||||
|
||||
if (target.TryGetComponent(out CreamPiedComponent? creamPied))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(target.Uid, out CreamPiedComponent? creamPied))
|
||||
{
|
||||
EntitySystem.Get<CreamPieSystem>().SetCreamPied(target.Uid, creamPied, false);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
var target = entityManager.GetEntity(eUid);
|
||||
|
||||
if (!target.TryGetComponent<InventoryComponent>(out var inventoryComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<InventoryComponent?>(target.Uid, out var inventoryComponent))
|
||||
{
|
||||
shell.WriteLine(Loc.GetString("shell-target-entity-does-not-have-message",("missing", "inventory")));
|
||||
return;
|
||||
@@ -82,7 +82,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
HumanoidCharacterProfile? profile = null;
|
||||
// Check if we are setting the outfit of a player to respect the preferences
|
||||
if (target.TryGetComponent<ActorComponent>(out var actorComponent))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<ActorComponent?>(target.Uid, out var actorComponent))
|
||||
{
|
||||
var userId = actorComponent.PlayerSession.UserId;
|
||||
var preferencesManager = IoCManager.Resolve<IServerPreferencesManager>();
|
||||
@@ -100,7 +100,7 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
var equipmentEntity = entityManager.SpawnEntity(gearStr, target.Transform.Coordinates);
|
||||
if (slot == EquipmentSlotDefines.Slots.IDCARD &&
|
||||
equipmentEntity.TryGetComponent<PDAComponent>(out var pdaComponent) &&
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent<PDAComponent?>(equipmentEntity.Uid, out var pdaComponent) &&
|
||||
pdaComponent.ContainedID != null)
|
||||
{
|
||||
pdaComponent.ContainedID.FullName = target.Name;
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Content.Server.Administration.Commands
|
||||
if (found.GetGridId(entMan) != GridId.Invalid)
|
||||
{
|
||||
player.AttachedEntity.Transform.Coordinates = found;
|
||||
if (player.AttachedEntity.TryGetComponent(out IPhysBody? physics))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(player.AttachedEntity.Uid, out IPhysBody? physics))
|
||||
{
|
||||
physics.LinearVelocity = Vector2.Zero;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user