2020-06-18 22:52:44 +10:00
|
|
|
using Content.Server.AI.WorldState;
|
|
|
|
|
using Content.Server.AI.WorldState.States;
|
|
|
|
|
using Content.Server.AI.WorldState.States.Inventory;
|
2020-08-13 14:40:27 +02:00
|
|
|
using Content.Server.GameObjects.Components.Items.Storage;
|
2020-06-18 22:52:44 +10:00
|
|
|
|
|
|
|
|
namespace Content.Server.AI.Utility.Considerations.Inventory
|
|
|
|
|
{
|
|
|
|
|
public class TargetInOurInventoryCon : Consideration
|
|
|
|
|
{
|
2020-07-08 09:37:35 +10:00
|
|
|
protected override float GetScore(Blackboard context)
|
2020-06-18 22:52:44 +10:00
|
|
|
{
|
|
|
|
|
var target = context.GetState<TargetEntityState>().GetValue();
|
|
|
|
|
|
|
|
|
|
if (target == null || !target.HasComponent<ItemComponent>())
|
|
|
|
|
{
|
|
|
|
|
return 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-08 09:37:35 +10:00
|
|
|
foreach (var item in context.GetState<EnumerableInventoryState>().GetValue())
|
2020-06-18 22:52:44 +10:00
|
|
|
{
|
|
|
|
|
if (item == target)
|
|
|
|
|
{
|
|
|
|
|
return 1.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|