# SPDX-FileCopyrightText: 2022 metalgearsloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: MIT

- type: htnCompound
  id: CleanbotCompound
  branches:
    - tasks:
        - !type:HTNCompoundTask
          task: BufferNearbyPuddlesCompound
    - tasks:
        - !type:HTNCompoundTask
          task: IdleCompound

# Picks a random puddle in range to move to and idle
- type: htnCompound
  id: BufferNearbyPuddlesCompound
  branches:
    - tasks:
        - !type:HTNPrimitiveTask
          operator: !type:UtilityOperator
            proto: NearbyPuddles

        - !type:HTNPrimitiveTask
          operator: !type:MoveToOperator
            pathfindInPlanning: true
            removeKeyOnFinish: false
            targetKey: TargetCoordinates
            pathfindKey: TargetPathfind
            rangeKey: MeleeRange
        - !type:HTNPrimitiveTask
          preconditions:
            - !type:TargetInRangePrecondition
              targetKey: Target
              rangeKey: InteractRange
          operator: !type:InteractWithOperator
            targetKey: Target
          services:
            - !type:UtilityService
              id: PuddleService
              proto: NearbyPuddles
              key: Target