# SPDX-FileCopyrightText: 2020 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 Pieter-Jan Briers <pieterjan.briers@gmail.com>
# SPDX-FileCopyrightText: 2021 20kdc <asdd2808@gmail.com>
# SPDX-FileCopyrightText: 2021 Acruid <shatter66@gmail.com>
# SPDX-FileCopyrightText: 2021 Metal Gear Sloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2021 Paul Ritter <ritter.paul1@googlemail.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: 2022 Emisse <99158783+Emisse@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Jack Fox <35575261+DubiousDoggo@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Mervill <mervills.email@gmail.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2023 0x6273 <0x40@keemail.me>
# SPDX-FileCopyrightText: 2023 AJCM-git <60196617+AJCM-git@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 ElectroJr <leonsfriedrich@gmail.com>
# SPDX-FileCopyrightText: 2023 Julian Giebel <juliangiebel@live.de>
# SPDX-FileCopyrightText: 2023 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2023 Sailor <109166122+Equivocateur@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Visne <39844191+Visne@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2024 Boaz1111 <149967078+Boaz1111@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 beck-thompson <107373427+beck-thompson@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Tayrtahn <tayrtahn@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: Recycler
  parent: BaseMachinePowered
  name: recycler
  description: A large crushing machine used to recycle small items inefficiently. There are lights on the side.
  components:
  - type: AmbientSound
    enabled: false
    volume: -8
    range: 5
    sound:
      # TODO: https://freesound.org/people/derjuli/sounds/448133/ CC-NC-
      path: /Audio/Ambience/Objects/circular_saw.ogg
  - type: Fixtures
    fixtures:
      brrt:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.15,-0.15,0.15,0.15"
        hard: false
        layer:
        - FullTileLayer
      collision:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.49,-0.49,0.49,0.49"
        hard: true
        mask:
        - Impassable
        layer:
        - Opaque
        - BulletImpassable
      conveyor:
        shape: !type:PolygonShape
          vertices:
          - -0.55,-0.55
          - 0.55,-0.55
          - 0.55,0.55
          - -0.55,0.55
        layer:
        - Impassable
        - MidImpassable
        - LowImpassable
        hard: False
  - type: DeviceLinkSink
    ports:
      - Reverse
      - Forward
      - Off
  - type: Transform
    anchored: true
    noRot: false
  - type: Sprite
    drawdepth: Doors
    sprite: Structures/Machines/recycling.rsi
    layers:
    - state: grinder-o0
      map: ["enum.RecyclerVisualLayers.Main"]
  - type: Appearance
  - type: RecyclerVisuals

  - type: CollideMaterialReclaimer
  - type: MaterialReclaimer
    enabled: false
    scaleProcessSpeed: false #instant!
    minimumProcessDuration: 0
    whitelist:
      components:
      - PhysicalComposition
      - MobState
      - SpaceGarbage
      tags:
      - Trash
      - Recyclable
    blacklist:
      components:
      - Material
      - Pda
      - IdCard
      tags:
      - HighRiskItem
    sound:
      path: /Audio/Effects/saw.ogg
      params:
        volume: -3
    cutOffSound: false
  - type: MaterialStorage
    insertOnInteract: false
  - type: Conveyor
  - type: Rotatable
  - type: Repairable
    doAfterDelay: 5
    fuelCost: 25
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:DoActsBehavior
        acts: ["Breakage"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
  - type: InteractionPopup
    successChance: 1.0
    interactSuccessString: petting-success-recycler
    interactFailureString: petting-failure-generic
    interactSuccessSound:
      path: /Audio/Items/drill_hit.ogg
  - type: SpookySpeaker
    speakChance: 0.1
    cooldown: 120
    messageSet: SpookySpeakerMessagesRecycler
  - type: Speech
    speechVerb: Robotic
    speechSounds: SyndieBorg