# SPDX-FileCopyrightText: 2020 Exp <theexp111@gmail.com>
# SPDX-FileCopyrightText: 2020 Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 20kdc <asdd2808@gmail.com>
# SPDX-FileCopyrightText: 2021 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <zddm@outlook.es>
# SPDX-FileCopyrightText: 2021 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2021 mirrorcult <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 Peptide90 <78795277+Peptide90@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Doru991 <75124791+Doru991@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Errant <35878406+Errant-4@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 iacore <74560659+iacore@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: constructionGraph
  id: Computer
  start: start
  graph:
    - node: start
      edges:
        - to: frameUnsecured
          completed:
            - !type:SetAnchor
              value: false
          steps:
            - material: Steel
              amount: 5
              doAfter: 2.5

    - node: frameUnsecured
      actions:
      - !type:AppearanceChange
      entity: ComputerFrame
      edges:
        - to: boardUnsecured
          conditions:
            - !type:EntityAnchored {}
          steps:
            - component: ComputerBoard
              store: board
              name: construction-graph-component-any-computer-circuit-board
              icon:
                sprite: "Objects/Misc/module.rsi"
                state: "id_mod"

        - to: start
          completed:
            - !type:SpawnPrototype
              prototype: SheetSteel1
              amount: 5
            - !type:DeleteEntity {}
          steps:
            - tool: Screwing
              doAfter: 2

    - node: boardUnsecured
      actions:
      - !type:AppearanceChange
      edges:
        - to: missingWires
          conditions:
            - !type:EntityAnchored {}
          steps:
            - tool: Screwing

        - to: frameUnsecured
          conditions:
            - !type:EntityAnchored { }
          completed:
            - !type:EmptyAllContainers {}
          steps:
            - tool: Prying

    - node: missingWires
      actions:
      - !type:AppearanceChange
      edges:
        - to: monitorMissing
          conditions:
            - !type:EntityAnchored {}
          steps:
            - material: Cable
              amount: 5

        - to: boardUnsecured
          conditions:
            - !type:EntityAnchored { }
          steps:
            - tool: Screwing

    - node: monitorMissing
      entity: ComputerFrame
      actions:
        - !type:SetAnchor { }
        - !type:AppearanceChange
      edges:
        - to: monitorUnsecured
          conditions:
            - !type:EntityAnchored {}
          steps:
            - material: Glass
              amount: 2

        - to: missingWires
          conditions:
            - !type:EntityAnchored { }
          completed:
            - !type:SpawnPrototype
              prototype: CableApcStack1
              amount: 5
          steps:
            - tool: Cutting

    - node: monitorUnsecured
      actions:
      - !type:AppearanceChange
      entity: ComputerFrame
      edges:
        - to: computer
          conditions:
            - !type:EntityAnchored {}
          steps:
            - tool: Screwing

        - to: monitorMissing
          conditions:
            - !type:EntityAnchored {}
          completed:
            - !type:SpawnPrototype
              prototype: SheetGlass1
              amount: 2
          steps:
            - tool: Prying
              doAfter: 1

    - node: computer
      entity: !type:BoardNodeEntity { container: board }
      edges:
        - to: monitorUnsecured
          completed:
            - !type:RaiseEvent
                event: !type:MachineDeconstructedEvent
          steps:
            - tool: Prying
              doAfter: 1

    - node: monitorBroken
      entity: ComputerBroken
      edges:
        - to: monitorMissing
          conditions:
            - !type:EntityAnchored {}
          completed:
            - !type:SpawnPrototype
              prototype: ShardGlass
              amount: 2
          steps:
            - tool: Prying
              doAfter: 2