Class HTNOperator
Concrete code that gets run for an NPC task.
Inheritance
System.Object
HTNOperator
Namespace: Content.Server.NPC.HTN.PrimitiveTasks
Assembly: Content.Server.dll
Syntax
public abstract class HTNOperator : object
Methods
| Improve this Doc View SourceInitialize(IEntitySystemManager)
Called once whenever prototypes reload. Typically used to inject dependencies.
Declaration
public virtual void Initialize(IEntitySystemManager sysManager)
Parameters
Type | Name | Description |
---|---|---|
IEntitySystemManager | sysManager |
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. |
PlanShutdown(NPCBlackboard)
Called when the plan has finished running.
Declaration
public virtual void PlanShutdown(NPCBlackboard blackboard)
Parameters
Type | Name | Description |
---|---|---|
NPCBlackboard | blackboard |
Startup(NPCBlackboard)
Called the first time an operator runs.
Declaration
public virtual void Startup(NPCBlackboard blackboard)
Parameters
Type | Name | Description |
---|---|---|
NPCBlackboard | blackboard |
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 |
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 |