1
0

HTNPlan.cs 938 B

12345678910111213141516171819202122232425262728293031323334
  1. using Content.Server.NPC.HTN.PrimitiveTasks;
  2. namespace Content.Server.NPC.HTN;
  3. /// <summary>
  4. /// The current plan for a HTN NPC.
  5. /// </summary>
  6. public sealed class HTNPlan
  7. {
  8. /// <summary>
  9. /// Effects that were applied for each primitive task in the plan.
  10. /// </summary>
  11. public readonly List<Dictionary<string, object>?> Effects;
  12. public readonly List<int> BranchTraversalRecord;
  13. public readonly List<HTNPrimitiveTask> Tasks;
  14. public HTNPrimitiveTask CurrentTask => Tasks[Index];
  15. public HTNOperator CurrentOperator => CurrentTask.Operator;
  16. /// <summary>
  17. /// Where we are up to in the <see cref="Tasks"/>
  18. /// </summary>
  19. public int Index = 0;
  20. public HTNPlan(List<HTNPrimitiveTask> tasks, List<int> branchTraversalRecord, List<Dictionary<string, object>?> effects)
  21. {
  22. Tasks = tasks;
  23. BranchTraversalRecord = branchTraversalRecord;
  24. Effects = effects;
  25. }
  26. }