AI Reachable system (#1342)

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-07-11 23:09:37 +10:00
committed by GitHub
parent 347b4b2893
commit 51d08e8b05
22 changed files with 1337 additions and 80 deletions

View File

@@ -4,9 +4,11 @@ using Content.Server.AI.Operators;
using Content.Server.AI.Operators.Inventory;
using Content.Server.AI.Operators.Movement;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Containers;
using Content.Server.AI.Utility.Considerations.Movement;
using Content.Server.AI.Utility.Considerations.State;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.AI.WorldState.States.Inventory;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
@@ -31,8 +33,15 @@ namespace Content.Server.AI.Utility.Actions.Idle
new MoveToEntityOperator(Owner, lastStorage),
new CloseLastStorageOperator(Owner),
});
}
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
var lastStorage = context.GetState<LastOpenedStorageState>();
context.GetState<TargetEntityState>().SetValue(lastStorage.GetValue());
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)
{
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();
@@ -43,7 +52,8 @@ namespace Content.Server.AI.Utility.Actions.Idle
.InverseBoolCurve(context),
considerationsManager.Get<DistanceCon>()
.QuadraticCurve(context, 1.0f, 1.0f, 0.02f, 0.0f),
considerationsManager.Get<TargetAccessibleCon>()
.BoolCurve(context),
};
}