Show / Hide Table of Contents

Class HTNOperator

Concrete code that gets run for an NPC task.

Inheritance
System.Object
HTNOperator
JukeOperator
MeleeOperator
GunOperator
AltInteractOperator
DropOperator
EquipOperator
InteractWithOperator
SwapToFreeHandOperator
MoveToOperator
NoOperator
PickAccessibleComponentOperator
PickAccessibleOperator
PickRandomRotationOperator
RandomOperator
RotateToTargetOperator
SetFloatOperator
SpeakOperator
MedibotInjectOperator
PickNearbyInjectableOperator
PickPathfindPointOperator
UtilityOperator
WaitOperator
Namespace: Content.Server.NPC.HTN.PrimitiveTasks
Assembly: Content.Server.dll
Syntax
public abstract class HTNOperator : object

Methods

| Improve this Doc View Source

Initialize(IEntitySystemManager)

Called once whenever prototypes reload. Typically used to inject dependencies.

Declaration
public virtual void Initialize(IEntitySystemManager sysManager)
Parameters
Type Name Description
IEntitySystemManager sysManager
| Improve this Doc View Source

Plan(NPCBlackboard, CancellationToken)

Called during planning.

Declaration
public virtual Task<(bool Valid, Dictionary<string, object>? Effects)> Plan(NPCBlackboard blackboard, CancellationToken cancelToken)
Parameters
Type Name Description
NPCBlackboard blackboard

The blackboard for the NPC.

CancellationToken cancelToken
Returns
Type Description
Task<System.ValueTuple<System.Boolean, System.Nullable<Dictionary<System.String, System.Object>>>>

Whether the plan is still valid and the effects to apply to the blackboard. These get re-applied during execution and are up to the operator to use or discard.

| Improve this Doc View Source

PlanShutdown(NPCBlackboard)

Called when the plan has finished running.

Declaration
public virtual void PlanShutdown(NPCBlackboard blackboard)
Parameters
Type Name Description
NPCBlackboard blackboard
| Improve this Doc View Source

Startup(NPCBlackboard)

Called the first time an operator runs.

Declaration
public virtual void Startup(NPCBlackboard blackboard)
Parameters
Type Name Description
NPCBlackboard blackboard
| Improve this Doc View Source

TaskShutdown(NPCBlackboard, HTNOperatorStatus)

Called whenever the operator stops running.

Declaration
public virtual void TaskShutdown(NPCBlackboard blackboard, HTNOperatorStatus status)
Parameters
Type Name Description
NPCBlackboard blackboard
HTNOperatorStatus status
| Improve this Doc View Source

Update(NPCBlackboard, Single)

Called during the NPC's regular updates. If the logic requires coordination between NPCs (e.g. steering or combat) this may be better off using a component and letting an external system handling it.

Declaration
public virtual HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
Parameters
Type Name Description
NPCBlackboard blackboard
System.Single frameTime
Returns
Type Description
HTNOperatorStatus
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾