follow.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # There are limitations to this ATM. The pathfinder is too slow to check accessibility well
  2. # and reachable only takes in an entity so sometimes the follow idle spot is outside of the follow range
  3. # Follows the specified target.
  4. - type: htnCompound
  5. id: FollowCompound
  6. branches:
  7. # Head to follow target
  8. - tasks:
  9. - !type:HTNPrimitiveTask
  10. preconditions:
  11. - !type:CoordinatesNotInRangePrecondition
  12. targetKey: FollowTarget
  13. rangeKey: FollowRange
  14. operator: !type:MoveToOperator
  15. pathfindInPlanning: true
  16. targetKey: FollowTarget
  17. rangeKey: FollowCloseRange
  18. removeKeyOnFinish: false
  19. # Keep idling near follow target
  20. - tasks:
  21. - !type:HTNPrimitiveTask
  22. preconditions:
  23. - !type:KeyExistsPrecondition
  24. key: IdleTime
  25. - !type:CoordinatesInRangePrecondition
  26. targetKey: FollowTarget
  27. rangeKey: FollowRange
  28. operator: !type:WaitOperator
  29. key: IdleTime
  30. # Pick a new idle spot near the follow target
  31. - tasks:
  32. - !type:HTNPrimitiveTask
  33. operator: !type:PickAccessibleOperator
  34. # originKey: FollowTarget
  35. rangeKey: FollowCloseRange
  36. targetCoordinates: FollowIdleTarget
  37. - !type:HTNPrimitiveTask
  38. operator: !type:MoveToOperator
  39. targetKey: FollowIdleTarget
  40. - !type:HTNPrimitiveTask
  41. operator: !type:RandomOperator
  42. targetKey: IdleTime
  43. minKey: MinimumIdleTime
  44. maxKey: MaximumIdleTime
  45. - !type:HTNPrimitiveTask
  46. preconditions:
  47. - !type:KeyExistsPrecondition
  48. key: IdleTime
  49. - !type:CoordinatesInRangePrecondition
  50. targetKey: FollowTarget
  51. rangeKey: FollowRange
  52. operator: !type:WaitOperator
  53. key: IdleTime