- type: utilityQuery
  id: NearbyPDTargets
  query:
    - !type:ComponentQuery
      components:
      - type: PDTarget
  considerations:
    - !type:PDTargetIFFCon
      curve: !type:BoolCurve
    - !type:TurretTargetingCon
      curve: !type:BoolCurve
    - !type:TargetDistanceCon
      curve: !type:PresetCurve
        preset: TargetDistance
    - !type:TargetAccessibleCon
      curve: !type:BoolCurve
    - !type:TargetInLOSOrCurrentCon
      curve: !type:BoolCurve

- type: htnCompound
  id: PDTurretCompound
  branches:
    - tasks:
        - !type:HTNPrimitiveTask
          operator: !type:UtilityOperator
            proto: NearbyPDTargets
        - !type:HTNPrimitiveTask
          preconditions:
            - !type:KeyExistsPrecondition
              key: Target
            - !type:TargetInRangePrecondition
              targetKey: Target
              rangeKey: RangedRange
            - !type:TargetInLOSPrecondition
              targetKey: Target
              rangeKey: RangedRange
              opaqueKey: true
          operator: !type:GunOperator
            targetKey: Target
            opaqueKey: true
          services:
            - !type:UtilityService
              id: RangedService
              proto: NearbyPDTargets
              key: Target
    - tasks:
        - !type:HTNCompoundTask
          task: IdleSpinCompound
