- type: entity
  id: BaseShutter
  parent: BaseStructure
  name: shutter
  abstract: true
  description: One shudders to think about what might be behind this shutter.
  placement:
    mode: SnapgridCenter
  components:
  - type: RequiresSkill
    basicSkills:
      Engineering: 2
  - type: Anchorable
    flags:
    - Anchorable
  - type: Rotatable
  - type: StationAiWhitelist
  - type: Sprite
    sprite: Structures/Doors/Shutters/shutters.rsi
    drawdepth: BlastDoors
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
    - state: welded
      map: ["enum.WeldableLayers.BaseWelded"]
  - type: AnimationPlayer
  - type: Physics
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.49,-0.49,0.49,0.49" # don't want this colliding with walls or they won't close
        density: 100
        mask:
        - FullTileMask
        layer:
        - AirlockLayer
  - type: ContainerFill
    containers:
      board: [ DoorElectronics ]
  - type: ContainerContainer
    containers:
      board: !type:Container
  - type: NavMapDoor
  - type: Tag
    tags:
    - ForceNoFixRotations # Don't want the fixrotations command to target these
  - type: Door
    openDrawDepth: BlastDoors
    closedDrawDepth: BlastDoors
    bumpOpen: false
    clickOpen: false
    closeTimeOne: 0.2
    closeTimeTwo: 1.2
    openTimeOne: 1.2
    openTimeTwo: 0.2
    openingAnimationTime: 1.4
    closingAnimationTime: 1.4
    crushDamage:
      types:
        Blunt: 5 # getting shutters closed on you probably doesn't hurt that much
    openSound:
      path: /Audio/Machines/shutter.ogg
    closeSound:
      path: /Audio/Machines/shutter.ogg
  - type: Weldable
    time: 3
  - type: Appearance
  - type: UserInterface
    interfaces:
      enum.WiresUiKey.Key:
        type: WiresBoundUserInterface
  - type: Airtight
  - type: RadiationBlocker
    resistance: 2
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: StructuralMetallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 500
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: DoorSignalControl
  - type: DeviceNetwork
    deviceNetId: Wireless
    receiveFrequencyId: BasicDevice
  - type: WirelessNetworkConnection
    range: 200
  - type: DeviceLinkSink
    ports:
      - Open
      - Close
      - Toggle
  - type: DeviceLinkSource
    ports:
    - DoorStatus
    lastSignals:
      DoorStatus: false
  - type: InteractionPopup
    interactSuccessString: shutter-rattle
    messagePerceivedByOthers: shutter-rattle
    interactSuccessSound:
      collection: FenceRattle
  - type: BlockWeather

- type: entity
  id: ShuttersNormal
  parent: [BaseDeltaPressureGlass, BaseShutter]
  components:
  - type: Occluder
  - type: Construction
    graph: Shutters
    node: Shutters
    containers:
    - board

- type: entity
  id: ShuttersNormalOpen
  parent: ShuttersNormal
  suffix: Open
  components:
  - type: Door
    state: Open
  - type: Physics
    canCollide: false
  - type: Occluder
    enabled: false
  - type: Airtight
    airBlocked: false
  - type: RadiationBlocker
    enabled: false

- type: entity
  id: ShuttersRadiation
  parent: [BaseDeltaPressureGlass, BaseShutter]
  name: radiation shutters
  description: Why did they make these shutters radioactive?
  components:
  - type: Sprite
    sprite: Structures/Doors/Shutters/shutters_radiation.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
    - state: welded
      map: ["enum.WeldableLayers.BaseWelded"]
  - type: Occluder
  - type: Construction
    graph: Shutters
    node: ShuttersRadiation
    containers:
    - board
  - type: RadiationBlocker
    resistance: 4

- type: entity
  id: ShuttersRadiationOpen
  parent: ShuttersRadiation
  suffix: Open
  components:
  - type: Door
    state: Open
  - type: Occluder
    enabled: false
  - type: Physics
    canCollide: false
  - type: Airtight
    airBlocked: false
  - type: RadiationBlocker
    enabled: false

- type: entity
  id: ShuttersWindow
  parent: [BaseDeltaPressureGlass, BaseShutter]
  name: window shutters
  description: The Best (TM) place to see your friends explode!
  components:
  - type: Sprite
    sprite: Structures/Doors/Shutters/shutters_window.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
    - state: welded
      map: ["enum.WeldableLayers.BaseWelded"]
  - type: Construction
    graph: Shutters
    node: ShuttersWindow
    containers:
    - board
  - type: RadiationBlocker
    resistance: 1

- type: entity
  id: ShuttersWindowOpen
  parent: ShuttersWindow
  suffix: Open
  components:
  - type: Door
    state: Open
  - type: Physics
    canCollide: false
  - type: Airtight
    airBlocked: false
  - type: RadiationBlocker
    enabled: false

# Frame for construction
- type: entity
  id: ShuttersFrame
  parent: BaseStructureDynamic
  name: shutter frame
  description: A frame for constructing a shutter.
  components:
  - type: Sprite
    sprite: Structures/Doors/Shutters/shutters.rsi
    state: frame
  - type: Construction
    graph: Shutters
    node: frame1
    containers:
    - board
  - type: InteractionOutline
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Metallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 500
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: Physics
    bodyType: Dynamic
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.45"
        density: 55
        mask:
        - Impassable
        - HighImpassable
        layer:
        - HighImpassable
  - type: Transform
    noRot: false
