Files
tbd-station-14/Content.Server/NPC/HTN/HTNComponent.cs
metalgearsloth c31c848afd Shooting NPCs and more (#18042)
* Add pirate shooting

* Shooting working

* Basics working

* Refactor time

* More conversion

* Update primitives

* Update yml

* weh

* Building again

* Draft

* weh

* b

* Start shutdown

* Starting to take form

* Code side done

* is it worky

* Fix prototypes

* stuff

* Shitty working

* Juke events working

* Even more cleanup

* RTX

* Fix interaction combat mode and compquery

* GetAmmoCount relays

* Fix rotation speed

* Juke fixes

* fixes

* weh

* The collision avoidance never ends

* Fixes

* Pause support

* framework

* lazy

* Fix idling

* Fix drip

* goobed

* Fix takeover shutdown bug

* Merge fixes

* shitter

* Fix carpos
2023-08-01 19:48:56 -05:00

51 lines
1.5 KiB
C#

using System.Threading;
using Content.Server.NPC.Components;
namespace Content.Server.NPC.HTN;
[RegisterComponent, ComponentReference(typeof(NPCComponent))]
public sealed class HTNComponent : NPCComponent
{
/// <summary>
/// The base task to use for planning
/// </summary>
[ViewVariables(VVAccess.ReadWrite),
DataField("rootTask", required: true)]
public HTNCompoundTask RootTask = default!;
/// <summary>
/// Check any active services for our current plan. This is used to find new targets for example without changing our plan.
/// </summary>
[DataField("checkServices")]
public bool CheckServices = true;
/// <summary>
/// The NPC's current plan.
/// </summary>
[ViewVariables]
public HTNPlan? Plan;
/// <summary>
/// How long to wait after having planned to try planning again.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("planCooldown")]
public float PlanCooldown = 0.45f;
/// <summary>
/// How much longer until we can try re-planning. This will happen even during update in case something changed.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public float PlanAccumulator = 0f;
[ViewVariables]
public HTNPlanJob? PlanningJob = null;
[ViewVariables]
public CancellationTokenSource? PlanningToken = null;
/// <summary>
/// Is this NPC currently planning?
/// </summary>
[ViewVariables] public bool Planning => PlanningJob != null;
}