# SPDX-FileCopyrightText: 2023 brainfood1183 <113240905+brainfood1183@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 qwerltaz <69696513+qwerltaz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Tayrtahn <tayrtahn@gmail.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: StationMapBroken
  name: station map
  description: A virtual map of the surrounding station.
  suffix: Wall broken
  placement:
    mode: SnapgridCenter
  components:
    - type: InteractionOutline
    - type: Clickable
    - type: Transform
      anchored: true
    - type: Sprite
      sprite: Structures/Machines/station_map.rsi
      drawdepth: WallMountedItems
      layers:
        - state: station_map_broken
    - type: Damageable
      damageContainer: StructuralInorganic
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 100
          behaviors:
            - !type:PlaySoundBehavior
              sound:
                collection: GlassBreak
            - !type:DoActsBehavior
              acts: [ "Destruction" ]

- type: entity
  id: StationMap
  name: station map
  parent: BaseComputer
  description: A virtual map of the surrounding station.
  suffix: Wall
  placement:
    mode: SnapgridCenter
  components:
    - type: StationMap
    - type: Transform
      anchored: true
    - type: Sprite
      sprite: Structures/Machines/station_map.rsi
      layers:
      - map: ["computerLayerBody"]
        state: station_map0
      - map: ["computerLayerScreen"]
        state: unshaded
    - type: Icon
      sprite: Structures/Machines/station_map.rsi
      state: station_map0
    - type: ContainerFill
      containers:
        board: [ StationMapCircuitboard ]
    - type: ContainerContainer
      containers:
        board: !type:Container
    - type: ApcPowerReceiver
      powerLoad: 200
    - type: WallMount
      arc: 360
    - type: ExtensionCableReceiver
    - type: Construction
      graph: StationMap
      node: station_map
    - type: ActivatableUIRequiresPower
    - type: ActivatableUI
      key: enum.StationMapUiKey.Key
    - type: Destructible
      thresholds:
        - trigger: # Excess damage, don't spawn entities
            !type:DamageTrigger
            damage: 200
          behaviors:
            - !type:PlaySoundBehavior
              sound:
                collection: GlassBreak
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
        - trigger:
            !type:DamageTrigger
            damage: 100
          behaviors:
            - !type:PlaySoundBehavior
              sound:
                collection: GlassBreak
            - !type:SpawnEntitiesBehavior
              spawn:
                StationMapBroken:
                  min: 1
                  max: 1
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
    - type: UserInterface
      interfaces:
        enum.StationMapUiKey.Key:
          type: StationMapBoundUserInterface

- type: entity
  id: StationMapAssembly
  name: station map assembly
  description: A station map assembly.
  components:
  - type: WallMount
  - type: Clickable
  - type: InteractionOutline
  - type: Sprite
    sprite: Structures/Machines/station_map.rsi
    layers:
    - state: station_map_frame1
      map: [ "enum.ConstructionVisuals.Layer" ]
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.ConstructionVisuals.Key:
        enum.ConstructionVisuals.Layer:
          assembly: { state: station_map_frame0 }
          wired: { state: station_map_frame1 }
          electronics: { state: station_map_frame2 }
  - type: Construction
    graph: StationMap
    node: assembly
  - type: Transform
    anchored: true
  placement:
    mode: SnapgridCenter
    snap:
    - Wallmount