- type: entity
  id: Window
  parent: [BaseDeltaPressureGlass, BaseStructure]
  name: window
  description: Don't smudge up the glass down there.
  placement:
    mode: SnapgridCenter
    snap:
    - Window
  components:
  - type: Anchorable
    flags:
    - Anchorable
  - type: Rotatable
  - type: MeleeSound
    soundGroups:
      Brute:
        collection: GlassSmack
  - type: WallMount
    arc: 360 # interact despite grilles
  - type: Tag
    tags:
      - ForceFixRotations
      - Window
  - type: Sprite
    drawdepth: WallTops
    sprite: Structures/Windows/window.rsi
  - type: Icon
    sprite: Structures/Windows/window.rsi
    state: full
  - type: Physics
    bodyType: Static
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb {}
        mask:
        - FullTileMask
        layer:
        - GlassLayer
  - type: Damageable
    damageModifierSet: Glass
  - type: Injurable
    damageContainer: StructuralInorganic
  - type: ExaminableDamage
    messages: WindowMessages
  - type: Repairable
  - type: RCDDeconstructable
    cost: 6
    delay: 4
    fx: EffectRCDDeconstruct4
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 150 #excess damage (nuke?). avoid computational cost of spawning entities.
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: WindowShatter
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 50
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: WindowShatter
      - !type:SpawnEntitiesBehavior
        spawn:
          ShardGlass:
            min: 1
            max: 2
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: Airtight
  - type: IconSmooth
    key: windows
    base: window
  - type: InteractionPopup
    interactSuccessString: comp-window-knock
    messagePerceivedByOthers: comp-window-knock
    interactSuccessSound:
      path: /Audio/Effects/glass_knock.ogg
  - type: Construction
    graph: Window
    node: window
  - type: Appearance
  - type: DamageVisuals
    thresholds: [5, 10, 20]
    damageDivisor: 2
    trackAllDamage: true
    damageOverlay:
      sprite: Structures/Windows/cracks.rsi
  - type: StaticPrice
    price: 100
  - type: BlockWeather

- type: entity
  parent: Window
  id: TintedWindow
  name: tinted window
  components:
  - type: Sprite
    drawdepth: WallTops
    sprite: Structures/Windows/tinted_window.rsi
  - type: Icon
    sprite: Structures/Windows/tinted_window.rsi
  - type: IconSmooth
    base: twindow
  - type: Construction
    graph: Window
    node: tintedWindow
  - type: Occluder
  - type: StaticPrice
    price: 70

- type: entity
  id: WindowRCDResistant
  parent: Window
  abstract: true
  components:
  - type: RCDDeconstructable
    deconstructable: false

- type: entity
  id: WindowDirectional
  parent: [BaseDeltaPressureGlassQuarter, BaseStructure]
  name: directional window
  description: Don't smudge up the glass down there.
  placement:
    mode: SnapgridCenter
    snap:
    - Window
  components:
  - type: WallMount
    arc: 360 # interact despite grilles
  - type: Tag
    tags:
      - Window
  - type: MeleeSound
    soundGroups:
      Brute:
        collection: GlassSmack
  - type: Sprite
    drawdepth: Mobs
    sprite: Structures/Windows/directional.rsi
    state: window
  - type: Icon
    sprite: Structures/Windows/directional.rsi
    state: window
  - type: InteractionPopup
    interactSuccessString: comp-window-knock
    messagePerceivedByOthers: comp-window-knock
    interactSuccessSound:
      path: /Audio/Effects/glass_knock.ogg
  - type: Physics
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.5,-0.5,0.5,-0.28125"
        density: 1500
        mask:
        - FullTileMask
        layer:
        - GlassLayer
  - type: Repairable
  - type: Damageable
    damageModifierSet: Glass
  - type: Injurable
    damageContainer: StructuralInorganic
  - type: ExaminableDamage
    messages: WindowMessages
  - type: RCDDeconstructable
    cost: 4
    delay: 2
    fx: EffectRCDDeconstruct2
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 50 #excess damage (nuke?). avoid computational cost of spawning entities.
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:PlaySoundBehavior
        sound:
          collection: WindowShatter
    - trigger:
        !type:DamageTrigger
        damage: 25
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: WindowShatter
      - !type:SpawnEntitiesBehavior
        spawn:
          ShardGlass:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: Airtight
    noAirWhenFullyAirBlocked: false
    airBlockedDirection:
    - South
  - type: Construction
    graph: WindowDirectional
    node: windowDirectional
  - type: Appearance
  - type: DamageVisuals
    thresholds: [5, 10, 20]
    trackAllDamage: true
    damageOverlay:
      sprite: Structures/Windows/cracks_directional.rsi
  - type: StaticPrice
    price: 15

- type: entity
  id: WindowDirectionalRCDResistant
  parent: WindowDirectional
  abstract: true
  components:
  - type: RCDDeconstructable
    deconstructable: false

- type: entity
  id: WindowFrostedDirectional
  parent: WindowDirectional
  name: directional frosted window
  description: Don't smudge up the glass down there.
  placement:
    mode: SnapgridCenter
    snap:
    - Window
  components:
  - type: Sprite
    sprite: Structures/Windows/directional.rsi
    state: frosted_window
  - type: Icon
    sprite: Structures/Windows/directional.rsi
    state: frosted_window
  - type: StaticPrice
    price: 35

- type: entity
  parent: Window
  id: WindowDiagonal
  suffix: diagonal
  placement:
    mode: SnapgridCenter
    snap:
    - Window
  components:
  - type: Sprite
    drawdepth: WallTops
    sprite: Structures/Windows/window_diagonal.rsi
    state: state0
  - type: Tag
    tags:
    - Diagonal
    - Window
  - type: IconSmooth
    mode: Diagonal
    key: windows
    base: state
  - type: Icon
    sprite: Structures/Windows/window_diagonal.rsi
    state: state0
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PolygonShape
            vertices:
            - "-0.5,-0.5"
            - "0.5,0.5"
            - "0.5,-0.5"
        mask:
        - FullTileMask
        layer:
        - GlassLayer
  - type: Airtight
    noAirWhenFullyAirBlocked: false
    airBlockedDirection:
    - South
    - East
  - type: DamageVisuals
    damageOverlay:
      sprite: Structures/Windows/cracks_diagonal.rsi
  - type: Construction
    graph: WindowDiagonal
    node: windowDiagonal
