using Content.Server.AI.Components;
using Content.Server.AI.LoadBalancer;
using Content.Server.AI.Utility.Actions;
using Content.Server.AI.WorldState;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
using System.Threading;
using Content.Server.AI.EntitySystems;
namespace Content.Server.AI.Utility.AiLogic
{
[RegisterComponent, Access(typeof(NPCSystem))]
[ComponentReference(typeof(NPCComponent))]
public sealed class UtilityNPCComponent : NPCComponent
{
public Blackboard Blackboard => _blackboard;
public Blackboard _blackboard = default!;
///
/// The sum of all BehaviorSets gives us what actions the AI can take
///
[DataField("behaviorSets", customTypeSerializer:typeof(PrototypeIdHashSetSerializer))]
public HashSet BehaviorSets { get; } = new();
public List AvailableActions { get; set; } = new();
///
/// The currently running action; most importantly are the operators.
///
public UtilityAction? CurrentAction { get; set; }
///
/// How frequently we can re-plan. If an AI's in combat you could decrease the cooldown,
/// or if there's no players nearby increase it.
///
public float PlanCooldown { get; } = 0.5f;
public float _planCooldownRemaining;
///
/// If we've requested a plan then wait patiently for the action
///
public AiActionRequestJob? _actionRequest;
public CancellationTokenSource? _actionCancellation;
}
}