# SPDX-FileCopyrightText: 2022 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2023 Arendian <137322659+Arendian@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 deltanedas <@deltanedas:kde.org>
# 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: MedibotCompound
  branches:
    - tasks:
        - !type:HTNCompoundTask
          task: InjectNearbyCompound
    - tasks:
        - !type:HTNCompoundTask
          task: IdleCompound

- type: htnCompound
  id: InjectNearbyCompound
  branches:
    - tasks:
        # TODO: Kill this shit
        - !type:HTNPrimitiveTask
          operator: !type:PickNearbyInjectableOperator
            targetKey: InjectTarget
            targetMoveKey: TargetCoordinates

        - !type:HTNPrimitiveTask
          operator: !type:SpeakOperator
            speech: medibot-start-inject
            hidden: true

        - !type:HTNPrimitiveTask
          operator: !type:MoveToOperator
            pathfindInPlanning: false

        - !type:HTNPrimitiveTask
          operator: !type:SetFloatOperator
            targetKey: IdleTime
            amount: 3

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

        # TODO: Kill this
        - !type:HTNPrimitiveTask
          operator: !type:MedibotInjectOperator
            targetKey: InjectTarget