- type: entity
  id: BaseWindoor
  parent: BaseStructure
  abstract: true
  placement:
    mode: SnapgridCenter
  components:
  - type: InteractionOutline
  - type: Physics
  - type: Fixtures
    fixtures:
    - shape:
        !type:PhysShapeAabb
        bounds: "-0.49,-0.49,0.49,-0.3"
      mass: 50
      layer:
      - Impassable
      - MobImpassable
      - VaultImpassable
      - SmallImpassable
      mask:
      - VaultImpassable
  - type: Sprite
    netsync: false
    sprite: Structures/Doors/Windoors/windoor.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
    - state: closed_unlit
      shader: unshaded
      map: ["enum.DoorVisualLayers.BaseUnlit"]
    - state: welded
      map: ["enum.DoorVisualLayers.BaseWelded"]
    - state: bolted_unlit
      shader: unshaded
      map: ["enum.DoorVisualLayers.BaseBolted"]
    - state: emergency_unlit
      shader: unshaded
      map: ["enum.DoorVisualLayers.BaseEmergencyAccess"]
    - state: panel_open
      map: ["enum.WiresVisualLayers.MaintenancePanel"]
  - type: ApcPowerReceiver
  - type: ExtensionCableReceiver
  - type: Damageable
    damageContainer: Inorganic
    damageModifierSet: Glass
  - type: ExaminableDamage
    messages: WindowMessages
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 400
      behaviors: #excess damage (nuke?). avoid computational cost of spawning entities.
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          ShardGlass:
            min: 1
            max: 2
          SheetSteel1:
            min: 2
            max: 4
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: AccessReader
  - type: Airlock
    openPanelVisible: true
    # needed so that windoors will close regardless of whether there are people in it; it doesn't crush after all
    safety: false
  - type: Door
    canCrush: false
    weldable: false
    board: DoorElectronics
    openSound:
      path: /Audio/Machines/windoor_open.ogg
    closeSound:
      path: /Audio/Machines/windoor_open.ogg
    denySound:
      path: /Audio/Machines/airlock_deny.ogg
  - type: Wires
    BoardName: "Windoor Control"
    LayoutId: Windoors
  - type: UserInterface
    interfaces:
    - key: enum.WiresUiKey.Key
      type: WiresBoundUserInterface
  - type: Appearance
    visuals:
      - type: AirlockVisualizer
        animationTime: 0.9
        denyAnimationTime: 0.4
        animatedPanel: false
        openUnlitVisible: true
      - type: WiresVisualizer
  - type: Airtight
    fixVacuum: true
    noAirWhenFullyAirBlocked: false
    airBlockedDirection:
      - South
  - type: Construction
    graph: Windoor
    node: windoor

- type: entity
  id: BaseSecureWindoor
  parent: BaseWindoor
  abstract: true
  components:
  - type: Sprite
    netsync: false
    sprite: Structures/Doors/Windoors/windoor.rsi
    layers:
    - state: secure_underlay
    - state: closed
      map: [ "enum.DoorVisualLayers.Base" ]
    - state: closed_unlit
      shader: unshaded
      map: [ "enum.DoorVisualLayers.BaseUnlit" ]
    - state: welded
      map: [ "enum.DoorVisualLayers.BaseWelded" ]
    - state: bolted_unlit
      shader: unshaded
      map: [ "enum.DoorVisualLayers.BaseBolted" ]
    - state: emergency_unlit
      shader: unshaded
      map: [ "enum.DoorVisualLayers.BaseEmergencyAccess" ]
    - state: panel_open
      map: [ "enum.WiresVisualLayers.MaintenancePanel" ]
      visible: false
  - type: Wires
    LayoutId: Secure Windoors
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 600
      behaviors: #excess damage (nuke?). avoid computational cost of spawning entities.
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 400
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          ShardGlass:
            min: 1
            max: 2
          SheetPlasteel1:
            min: 1
            max: 2
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: Construction
    graph: Windoor
    node: windoorSecure
