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;
|
|
|
|
|
using Content.Server.AI.Utility.Considerations;
|
|
|
|
|
using Content.Server.AI.Utility.Considerations.Combat.Melee;
|
|
|
|
|
using Content.Server.AI.Utility.Considerations.Inventory;
|
|
|
|
|
using Content.Server.AI.WorldState;
|
|
|
|
|
using Content.Server.AI.WorldState.States;
|
|
|
|
|
using Content.Server.AI.WorldState.States.Combat;
|
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.Combat.Melee
|
|
|
|
|
{
|
|
|
|
|
public sealed class EquipMelee : UtilityAction
|
|
|
|
|
{
|
2021-03-16 15:50:20 +01:00
|
|
|
public IEntity 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)
|
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<WeaponEntityState>().SetValue(Target);
|
|
|
|
|
context.GetState<TargetEntityState>().SetValue(Target);
|
2020-06-18 22:52:44 +10: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<CanPutTargetInInventoryCon>()
|
2020-07-08 09:37:35 +10:00
|
|
|
.BoolCurve(context),
|
|
|
|
|
considerationsManager.Get<MeleeWeaponSpeedCon>()
|
|
|
|
|
.QuadraticCurve(context, 1.0f, 0.5f, 0.0f, 0.0f),
|
|
|
|
|
considerationsManager.Get<MeleeWeaponDamageCon>()
|
|
|
|
|
.QuadraticCurve(context, 1.0f, 0.25f, 0.0f, 0.0f),
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-06-18 22:52:44 +10:00
|
|
|
}
|
|
|
|
|
}
|