Inline HasComponent entirely

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 12:23:18 +01:00
parent 88141ae6b8
commit 0feebbff00
117 changed files with 201 additions and 158 deletions

View File

@@ -6,6 +6,7 @@ using Content.Server.Storage.Components;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.AI.WorldState.States.Clothing
{
@@ -28,7 +29,7 @@ namespace Content.Server.AI.WorldState.States.Clothing
{
if (entity.TryGetContainer(out var container))
{
if (!container.Owner.HasComponent<EntityStorageComponent>())
if (!IoCManager.Resolve<IEntityManager>().HasComponent<EntityStorageComponent>(container.Owner.Uid))
{
continue;
}

View File

@@ -1,5 +1,6 @@
using Content.Server.Storage.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log;
namespace Content.Server.AI.WorldState.States.Inventory
@@ -17,7 +18,7 @@ namespace Content.Server.AI.WorldState.States.Inventory
public override void SetValue(IEntity? value)
{
base.SetValue(value);
if (value != null && !value.HasComponent<EntityStorageComponent>())
if (value != null && !IoCManager.Resolve<IEntityManager>().HasComponent<EntityStorageComponent>(value.Uid))
{
Logger.Warning("Set LastOpenedStorageState for an entity that doesn't have a storage component");
}

View File

@@ -36,7 +36,7 @@ namespace Content.Server.AI.WorldState.States.Mobs
continue;
}
if (player.AttachedEntity != Owner && player.AttachedEntity.HasComponent<DamageableComponent>())
if (player.AttachedEntity != Owner && IoCManager.Resolve<IEntityManager>().HasComponent<DamageableComponent>(player.AttachedEntity.Uid))
{
result.Add(player.AttachedEntity);
}

View File

@@ -6,6 +6,7 @@ using Content.Server.Storage.Components;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.AI.WorldState.States.Nutrition
{
@@ -28,7 +29,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition
{
if (entity.TryGetContainer(out var container))
{
if (!container.Owner.HasComponent<EntityStorageComponent>())
if (!IoCManager.Resolve<IEntityManager>().HasComponent<EntityStorageComponent>(container.Owner.Uid))
{
continue;
}

View File

@@ -6,6 +6,7 @@ using Content.Server.Storage.Components;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.AI.WorldState.States.Nutrition
{
@@ -28,7 +29,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition
{
if (entity.TryGetContainer(out var container))
{
if (!container.Owner.HasComponent<EntityStorageComponent>())
if (!IoCManager.Resolve<IEntityManager>().HasComponent<EntityStorageComponent>(container.Owner.Uid))
{
continue;
}