Files
crystall-punk-14/Content.Server/AI/Utility/Considerations/Combat/Melee/HasMeleeWeaponCon.cs

25 lines
726 B
C#
Raw Normal View History

using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States.Inventory;
2021-06-09 22:19:39 +02:00
using Content.Server.Weapon.Melee.Components;
2021-12-03 12:23:18 +01:00
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.AI.Utility.Considerations.Combat.Melee
{
public sealed class HasMeleeWeaponCon : Consideration
{
protected override float GetScore(Blackboard context)
{
foreach (var item in context.GetState<EnumerableInventoryState>().GetValue())
{
2021-12-03 15:53:09 +01:00
if (IoCManager.Resolve<IEntityManager>().HasComponent<MeleeWeaponComponent>(item))
{
return 1.0f;
}
}
return 0.0f;
}
}
}