Files
tbd-station-14/Content.Server/AI/Utility/Actions/Test/MoveRightAndLeftTen.cs
metalgearsloth 5aefae184c Refactor AI considerations (#1278)
Considerations are now instantiated under a manager and re-used between entities where they pass in their blackboard to get a score back.
Also makes the API a bit nicer to use.
Also some random cleanup.

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
2020-07-08 01:37:35 +02:00

48 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using Content.Server.AI.Operators;
using Content.Server.AI.Operators.Movement;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.WorldState;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
namespace Content.Server.AI.Utility.Actions.Test
{
/// <summary>
/// Used for pathfinding debugging
/// </summary>
public class MoveRightAndLeftTen : UtilityAction
{
public override bool CanOverride => false;
public MoveRightAndLeftTen(IEntity owner) : base(owner) {}
public override void SetupOperators(Blackboard context)
{
var currentPosition = Owner.Transform.GridPosition;
var nextPosition = Owner.Transform.GridPosition.Offset(new Vector2(10.0f, 0.0f));
var originalPosOp = new MoveToGridOperator(Owner, currentPosition, 0.25f);
var newPosOp = new MoveToGridOperator(Owner, nextPosition, 0.25f);
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
newPosOp,
originalPosOp
});
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)
{
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();
return new[]
{
considerationsManager.Get<DummyCon>()
.BoolCurve(context),
};
}
}
}