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>
This commit is contained in:
metalgearsloth
2020-07-08 09:37:35 +10:00
committed by GitHub
parent c25c1e1094
commit 5aefae184c
64 changed files with 625 additions and 396 deletions

View File

@@ -1,4 +1,3 @@
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.GameObjects;
@@ -7,9 +6,7 @@ namespace Content.Server.AI.Utility.Considerations.Hands
{
public class FreeHandCon : Consideration
{
public FreeHandCon(IResponseCurve curve) : base(curve) {}
public override float GetScore(Blackboard context)
protected override float GetScore(Blackboard context)
{
var owner = context.GetState<SelfState>().GetValue();

View File

@@ -1,4 +1,3 @@
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.GameObjects;
@@ -10,9 +9,7 @@ namespace Content.Server.AI.Utility.Considerations.Hands
/// </summary>
public sealed class TargetInOurHandsCon : Consideration
{
public TargetInOurHandsCon(IResponseCurve curve) : base(curve) {}
public override float GetScore(Blackboard context)
protected override float GetScore(Blackboard context)
{
var owner = context.GetState<SelfState>().GetValue();
var target = context.GetState<TargetEntityState>().GetValue();