# SPDX-FileCopyrightText: 2024 BombasterDS <115770678+BombasterDS@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aidenkrz <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2025 RatherUncreative <RatherUncreativeName@proton.me>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: MailTeleporter
  parent: [ BaseMachinePowered, ConstructibleMachine ]
  name: mail teleporter
  description: Teleports mail addressed to the crew of this station.
  components:
  - type: MailTeleporter
  - type: InteractionOutline
  - type: Physics
    bodyType: Static
  - type: Transform
    anchored: true
    noRot: true
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
            bounds: "-0.45,-0.45,0.45,0.00"
        density: 120
        mask:
        - HighImpassable
  - type: Sprite
    sprite: Nyanotrasen/Structures/mailbox.rsi
    layers:
    - state: icon
    - state: unlit
      shader: unshaded
      visible: false
      map: ["enum.PowerDeviceVisualLayers.Powered"]
  - type: Damageable
    damageContainer: Inorganic
    damageModifierSet: Metallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 75
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalGlassBreak
      - !type:ChangeConstructionNodeBehavior
        node: machineFrame
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: ApcPowerReceiver
    powerLoad: 1000 # TODO if we keep this make it spike power draw when teleporting
    powerDisabled: true
  - type: ExtensionCableReceiver
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.PowerDeviceVisuals.Powered:
        enum.PowerDeviceVisualLayers.Powered:
          True: {visible: true}
          False: {visible: false}
  - type: PowerSwitch
  - type: Machine
    board: MailTeleporterMachineCircuitboard