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:
@@ -4,6 +4,7 @@ using Content.Server.AI.Utility.Actions.Combat.Melee;
|
||||
using Content.Server.AI.WorldState;
|
||||
using Content.Server.AI.WorldState.States;
|
||||
using Content.Server.AI.WorldState.States.Inventory;
|
||||
using Content.Server.GameObjects.Components.Weapon.Melee;
|
||||
|
||||
namespace Content.Server.AI.Utility.ExpandableActions.Combat.Melee
|
||||
{
|
||||
@@ -15,8 +16,13 @@ namespace Content.Server.AI.Utility.ExpandableActions.Combat.Melee
|
||||
{
|
||||
var owner = context.GetState<SelfState>().GetValue();
|
||||
|
||||
foreach (var entity in context.GetState<InventoryState>().GetValue())
|
||||
foreach (var entity in context.GetState<EnumerableInventoryState>().GetValue())
|
||||
{
|
||||
if (!entity.HasComponent<MeleeWeaponComponent>())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
yield return new EquipMelee(owner, entity, Bonus);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user