- type: entity
  abstract: true
  id: DisposalUnitBase
  parent: BaseMachinePowered
  description: A pneumatic waste disposal unit.
  placement:
    mode: SnapgridCenter
    snap:
    - Disposal
  components:
  - type: DisposalUnit
    container:
      occludes: true
      showEnts: false
      ents: []
    whitelist:
      components:
      - Item
      - Body
  - type: Climbable
    vaultable: false
  - type: Sprite
    sprite: Structures/Piping/disposal.rsi
    layers:
    - map: [ "enum.DisposalUnitVisualLayers.Base" ]
      state: disposal
    - map: [ "enum.DisposalUnitVisualLayers.OverlayFlushing" ]
      state: disposal
      visible: false
    - map: [ "enum.DisposalUnitVisualLayers.OverlayCharging" ]
      state: dispover-ready
    - map: [ "enum.DisposalUnitVisualLayers.OverlayFull" ]
      state: dispover-full
      visible: false
    - map: [ "enum.DisposalUnitVisualLayers.OverlayEngaged" ]
      state: dispover-handle
      visible: false
  - type: GenericVisualizer
    visuals:
      enum.DisposalUnitVisuals.IsReady:
        enum.DisposalUnitVisualLayers.Base:
          True: { state: disposal }
          False: { state: disposal-charging }
      enum.DisposalUnitVisuals.IsFlushing:
        enum.DisposalUnitVisualLayers.OverlayFlushing:
          True: { visible: true }
          False: { visible: false }
      enum.DisposalUnitVisuals.IsEngaged:
        enum.DisposalUnitVisualLayers.OverlayEngaged:
          True: { visible: true }
          False: { visible: false }
      enum.DisposalUnitVisuals.IsCharging:
        enum.DisposalUnitVisualLayers.OverlayCharging:
          True: { state: dispover-charge, visible: true }
          False: { state: dispover-ready, visible: true }
      enum.DisposalUnitVisuals.IsFull:
        enum.DisposalUnitVisualLayers.OverlayFull:
          True: { visible: true }
          False: { visible: false }
      enum.PowerDeviceVisuals.Powered:
        enum.DisposalUnitVisualLayers.OverlayCharging:
          False: { visible: false }
        enum.DisposalUnitVisualLayers.OverlayFull:
          False: { visible: false }
      enum.AnchorVisuals.Anchored:
        enum.DisposalUnitVisualLayers.Base:
          True: { state: disposal }
          False: { state: condisposal }
        enum.DisposalUnitVisualLayers.OverlayEngaged:
          False: { visible: false }
        enum.DisposalUnitVisualLayers.OverlayCharging:
          False: { visible: false }
        enum.DisposalUnitVisualLayers.OverlayFull:
          False: { visible: false }
  - type: Physics
    bodyType: Static
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.45"
        density: 55
        mask:
        - MachineMask
        layer:
        - MachineLayer
  - type: Destructible
    thresholds:
    - 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:
      DisposalUnitComponent: !type:Container
  - type: StaticPrice
    price: 70
  - type: PowerSwitch
  - type: ApcPowerReceiver
    powerLoad: 5
  - type: PowerState
    idlePowerDraw: 5
    workingPowerDraw: 1000

- 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: ThrowInsertContainer
    containerId: DisposalUnitComponent
    probability: 0.67
  - type: UserInterface
    interfaces:
      enum.DisposalUnitUiKey.Key:
        type: DisposalUnitBoundUserInterface
  - type: Rummageable
    table: !type:NestedSelector
      tableId: RatKingLoot
  - type: RequireProjectileTarget

- type: entity
  id: MailingUnit
  parent: DisposalUnitBase
  name: mailing unit
  description: A pneumatic mail delivery unit.
  components:
  - type: Sprite
    sprite: Structures/Piping/disposal.rsi
    layers:
    - map: [ "enum.DisposalUnitVisualLayers.Base" ]
      state: mailing
    - map: [ "enum.DisposalUnitVisualLayers.OverlayCharging" ]
      state: mailing-charging
      visible: false
    - map: [ "enum.DisposalUnitVisualLayers.OverlayFull" ]
      state: mailing-full
      visible: false
    - map: [ "enum.DisposalUnitVisualLayers.OverlayFlushing" ]
      state: mailing-flush
      visible: false
    - map: [ "enum.DisposalUnitVisualLayers.OverlayEngaged" ]
      state: mailover-handle
  - type: GenericVisualizer
    visuals:
      enum.DisposalUnitVisuals.IsFlushing:
        enum.DisposalUnitVisualLayers.OverlayFlushing:
          True: { visible: true }
          False: { visible: false }
      enum.DisposalUnitVisuals.IsReady:
        enum.DisposalUnitVisualLayers.Base:
          True: { state: mailing }
          False: { state: mailing-charging }
      enum.DisposalUnitVisuals.IsEngaged:
        enum.DisposalUnitVisualLayers.OverlayEngaged:
          True: { state: mailover-handle }
          False: { state: mailover-handle-off }
      enum.DisposalUnitVisuals.IsCharging:
        enum.DisposalUnitVisualLayers.OverlayCharging:
          True: { visible: true }
          False: { visible: false }
      enum.DisposalUnitVisuals.IsFull:
        enum.DisposalUnitVisualLayers.OverlayFull:
          True: { visible: true }
          False: { visible: false }
      enum.PowerDeviceVisuals.Powered:
        enum.DisposalUnitVisualLayers.OverlayCharging:
          False: { visible: false }
        enum.DisposalUnitVisualLayers.OverlayFull:
          False: { visible: false }
      enum.AnchorVisuals.Anchored:
        enum.DisposalUnitVisualLayers.Base:
          True: { state: mailing }
          False: { state: conmailing }
        enum.DisposalUnitVisualLayers.OverlayEngaged:
          False: { visible: false }
        enum.DisposalUnitVisualLayers.OverlayCharging:
          False: { visible: false }
        enum.DisposalUnitVisualLayers.OverlayFull:
          False: { visible: false }
  - type: Construction
    graph: DisposalMachine
    node: mailing_unit
  - type: DisposalUnit
    flushingState: mailing-flush
    whitelist:
      components:
      - Item
    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
