- type: entity
  abstract: true
  id: DisposalUnitBase
  parent: BaseMachinePowered
  description: A pneumatic waste disposal unit.
  placement:
    mode: SnapgridCenter
    snap:
    - Disposal
  components:
  - type: Climbable
    vaultable: false
  - type: Sprite
    sprite: Structures/Piping/disposal.rsi
    layers:
    - state: condisposal
      map: [ "enum.DisposalUnitVisualLayers.Unanchored" ]
    - state: disposal
      map: [ "enum.DisposalUnitVisualLayers.Base" ]
    - state: disposal-charging
      map: [ "enum.DisposalUnitVisualLayers.BaseCharging" ]
    - state: disposal-flush
      map: [ "enum.DisposalUnitVisualLayers.OverlayFlush" ]
    - state: dispover-charge
      map: [ "enum.DisposalUnitVisualLayers.OverlayCharging" ]
    - state: dispover-ready
      map: [ "enum.DisposalUnitVisualLayers.OverlayReady" ]
    - state: dispover-full
      map: [ "enum.DisposalUnitVisualLayers.OverlayFull" ]
    - state: dispover-handle
      map: [ "enum.DisposalUnitVisualLayers.OverlayEngaged" ]
  - type: Physics
    bodyType: Static
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.45"
        density: 55
        mask:
        - TableMask
        layer:
        - TableLayer
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
          params:
            volume: -6
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel1:
            min: 1
            max: 1
  - type: Appearance
  - type: UserInterface
    interfaces:
      enum.DisposalUnitUiKey.Key:
        type: DisposalUnitBoundUserInterface
  - type: ContainerContainer
    containers:
      disposals: !type:Container
  - type: StaticPrice
    price: 62 # Frontier: 70<62 - TODO: material value rework
  - type: PowerSwitch
  - type: ApcPowerReceiver # Frontier
    powerLoad: 250 # Allows us to not use the 1000 baseline
  - type: AutomationSlots # Goobstation
    slots:
    - !type:AutomatedContainer
      input: AutomationSlotInput
      output: AutomationSlotInput
      containerId: disposals
      maxItems: 30 # disposals doesn't have a limit this is just so you can't use it as an ME system
    - !type:AutomatedPorts
      sinks:
      - Toggle
      - DisposalFlush
      - DisposalEject
      sources:
      - DisposalReady
  # Mono
  - type: ShipRepairable
    repairTime: 5
    repairCost: 5

- type: entity
  id: DisposalUnit
  parent: DisposalUnitBase
  name: disposal unit
  components:
  - type: Sprite
    sprite: Structures/Piping/disposal.rsi
    snapCardinals: true
  - type: Construction
    graph: DisposalMachine
    node: disposal_unit
  - type: DisposalUnit
  - type: ThrowInsertContainer
    containerId: disposals
  - type: UserInterface
    interfaces:
      enum.DisposalUnitUiKey.Key:
        type: DisposalUnitBoundUserInterface
  - type: RatKingRummageable
  - type: RequireProjectileTarget
  - type: PotentialDeadDrop # Frontier
    hintText: dead-drop-hint-disposals # Frontier

- type: entity
  id: MailingUnit
  parent: DisposalUnitBase
  name: mailing unit
  description: A pneumatic mail delivery unit.
  components:
  - type: Sprite
    sprite: Structures/Piping/disposal.rsi
    snapCardinals: true
    layers:
      - state: conmailing
        map: [ "enum.DisposalUnitVisualLayers.Unanchored" ]
      - state: mailing
        map: [ "enum.DisposalUnitVisualLayers.Base" ]
      - state: mailing-charging
        map: [ "enum.DisposalUnitVisualLayers.BaseCharging" ]
      - state: mailing-flush
        map: [ "enum.DisposalUnitVisualLayers.OverlayFlush" ]
      - state: dispover-charge
        map: [ "enum.DisposalUnitVisualLayers.OverlayCharging" ]
      - state: dispover-ready
        map: [ "enum.DisposalUnitVisualLayers.OverlayReady" ]
      - state: dispover-full
        map: [ "enum.DisposalUnitVisualLayers.OverlayFull" ]
      - state: mailover-handle
        map: [ "enum.DisposalUnitVisualLayers.OverlayEngaged" ]
  - type: Construction
    graph: DisposalMachine
    node: mailing_unit
  - type: DisposalUnit
    whitelist:
      components:
      - Item
      - Goblin # Frontier
    blacklist:
      components:
      - EntityStorage
  - type: MailingUnit
  - type: DeviceNetwork
    deviceNetId: Wired
    receiveFrequencyId: MailingUnit
    transmitFrequencyId: MailingUnit
  - type: WiredNetworkConnection
  - type: Configuration
    config:
      tag:
  - type: Appearance
  - type: UserInterface
    interfaces:
      enum.MailingUnitUiKey.Key:
        type: MailingUnitBoundUserInterface
      enum.ConfigurationUiKey.Key:
        type: ConfigurationBoundUserInterface
