2020-07-08 09:37:35 +10:00
|
|
|
using System;
|
2020-06-18 22:52:44 +10:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Content.Server.AI.Operators;
|
|
|
|
|
using Content.Server.AI.Operators.Inventory;
|
2020-08-22 20:03:24 +10:00
|
|
|
using Content.Server.AI.Operators.Nutrition;
|
2020-06-18 22:52:44 +10:00
|
|
|
using Content.Server.AI.Utility.Considerations;
|
2020-08-12 06:01:55 +10:00
|
|
|
using Content.Server.AI.Utility.Considerations.Inventory;
|
2020-07-08 09:37:35 +10:00
|
|
|
using Content.Server.AI.Utility.Considerations.Nutrition.Food;
|
2020-06-18 22:52:44 +10:00
|
|
|
using Content.Server.AI.WorldState;
|
|
|
|
|
using Content.Server.AI.WorldState.States;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.GameObjects;
|
2020-07-08 09:37:35 +10:00
|
|
|
using Robust.Shared.IoC;
|
2020-06-18 22:52:44 +10:00
|
|
|
|
|
|
|
|
namespace Content.Server.AI.Utility.Actions.Nutrition.Food
|
|
|
|
|
{
|
|
|
|
|
public sealed class UseFoodInInventory : UtilityAction
|
|
|
|
|
{
|
2021-12-05 18:09:01 +01:00
|
|
|
public EntityUid Target { get; set; } = default!;
|
2020-06-18 22:52:44 +10:00
|
|
|
|
|
|
|
|
public override void SetupOperators(Blackboard context)
|
|
|
|
|
{
|
|
|
|
|
ActionOperators = new Queue<AiOperator>(new AiOperator[]
|
|
|
|
|
{
|
2021-02-20 17:37:17 +11:00
|
|
|
new EquipEntityOperator(Owner, Target),
|
|
|
|
|
new UseFoodInInventoryOperator(Owner, Target),
|
2020-06-18 22:52:44 +10:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void UpdateBlackboard(Blackboard context)
|
|
|
|
|
{
|
|
|
|
|
base.UpdateBlackboard(context);
|
2021-02-20 17:37:17 +11:00
|
|
|
context.GetState<TargetEntityState>().SetValue(Target);
|
2020-11-21 14:02:00 +01:00
|
|
|
}
|
|
|
|
|
|
2020-07-08 09:37:35 +10:00
|
|
|
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)
|
|
|
|
|
{
|
|
|
|
|
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();
|
|
|
|
|
|
|
|
|
|
return new[]
|
|
|
|
|
{
|
2020-08-12 06:01:55 +10:00
|
|
|
considerationsManager.Get<TargetInOurInventoryCon>()
|
2020-07-08 09:37:35 +10:00
|
|
|
.BoolCurve(context),
|
|
|
|
|
considerationsManager.Get<FoodValueCon>()
|
|
|
|
|
.QuadraticCurve(context, 1.0f, 0.4f, 0.0f, 0.0f),
|
|
|
|
|
};
|
2020-06-18 22:52:44 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|