# SPDX-FileCopyrightText: 2022 metalgearsloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Golinth <amh2023@gmail.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: htnCompound
  id: FirebotCompound
  branches:
    - tasks:
        - !type:HTNCompoundTask
          task: DouseFireTargetCompound
    - tasks:
        - !type:HTNCompoundTask
          task: IdleCompound    
          
- type: htnCompound
  id: DouseFireTargetCompound
  branches:
    - tasks:
        - !type:HTNPrimitiveTask
          operator: !type:UtilityOperator
            proto: NearbyOnFire

        - !type:HTNPrimitiveTask
          operator: !type:SpeakOperator
            speech: firebot-fire-detected
            hidden: true  

        - !type:HTNPrimitiveTask
          operator: !type:MoveToOperator
            pathfindInPlanning: true
            removeKeyOnFinish: false
            targetKey: TargetCoordinates
            pathfindKey: TargetPathfind
            rangeKey: InteractRange

        - !type:HTNPrimitiveTask
          operator: !type:SetFloatOperator
            targetKey: WaitTime
            amount: 1

        - !type:HTNPrimitiveTask
          operator: !type:WaitOperator
            key: WaitTime
          preconditions:
            - !type:KeyExistsPrecondition
              key: WaitTime

        - !type:HTNPrimitiveTask
          preconditions:
            - !type:TargetInRangePrecondition
              targetKey: Target
              rangeKey: InteractRange
          operator: !type:InteractWithOperator
            targetKey: Target
          services:
            - !type:UtilityService
              id: FireService
              proto: NearbyOnFire
              key: Target
