- type: entity
  id: Grille
  parent: BaseStructure
  name: grille
  description: A flimsy framework of iron rods.
  components:
    - type: MeleeSound
      soundGroups:
        Brute:
          path:
            "/Audio/Weapons/grille_hit.ogg"
    - type: RCDDeconstructable
      cost: 6
      delay: 4
      fx: EffectRCDDeconstruct4
    - type: CanBuildWindowOnTop
    - type: Sprite
      drawdepth: Walls
      sprite: Structures/Walls/grille.rsi
      layers:
        - state: grille
        - state: electrified
          sprite: Effects/electricity.rsi
          map: ["enum.ElectrifiedLayers.Sparks"]
          shader: unshaded
          visible: false
    - type: Icon
      sprite: Structures/Walls/grille.rsi
      state: grille
    - type: Construction
      graph: Grille
      node: grille
      deconstructionTarget: start
    - type: Damageable
      damageContainer: StructuralInorganic
      damageModifierSet: PerforatedMetallic
    - type: Electrified
      requirePower: true
      noWindowInTile: true
      highVoltageNode: high
      mediumVoltageNode: medium
      lowVoltageNode: low
    - type: NodeContainer
      nodes:
        high:
          !type:CableDeviceNode
          nodeGroupID: HVPower
        medium:
          !type:CableDeviceNode
          nodeGroupID: MVPower
        low:
          !type:CableDeviceNode
          nodeGroupID: Apc
    - type: Physics
      bodyType: Static
    - type: Fixtures
      fixtures:
        fix1:
          shape:
            !type:PhysShapeAabb
            bounds: "-0.5,-0.5,0.5,0.5"
          layer:
          - GlassLayer
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 130 #excess damage (nuke?). avoid computational cost of spawning entities.
          behaviors:
            - !type:DoActsBehavior
              acts: ["Destruction"]
        - trigger:
            !type:DamageTrigger
            damage: 100
          behaviors:
            - !type:ChangeConstructionNodeBehavior
              node: grilleBroken
            - !type:DoActsBehavior
              acts: ["Breakage"]
    - type: Appearance
    - type: GenericVisualizer
      visuals:
        enum.ElectrifiedVisuals.ShowSparks:
          enum.ElectrifiedLayers.Sparks:
            True: { visible: True }
            False: { visible: False }
    - type: AnimationPlayer
    # Mono
    - type: ShipRepairable
      repairTime: 2
      repairCost: 2

- type: entity
  id: ClockworkGrille
  parent: Grille
  name: clockwork grille
  description: A flimsy framework of iron rods assembled in traditional Ratvarian fashion.
  components:
  - type: Sprite
    drawdepth: Walls
    sprite: Structures/Walls/clockwork_grille.rsi
    state: ratvargrille
    layers:
      - state: ratvargrille
  - type: Icon
    sprite: Structures/Walls/clockwork_grille.rsi
    state: ratvargrille
  - type: Construction
    graph: ClockGrille
    node: clockGrille
    deconstructionTarget: start

- type: entity
  id: GrilleBroken
  parent: BaseStructure
  name: grille
  description: A flimsy framework of iron rods. It has seen better days.
  components:
  - type: Sprite
    drawdepth: Walls
    sprite: Structures/Walls/grille.rsi
    state: grille_broken
  - type: Icon
    sprite: Structures/Walls/grille.rsi
    state: grille_broken
  - type: RCDDeconstructable
    cost: 6
    delay: 4
    fx: EffectRCDDeconstruct4
  - type: Construction
    graph: Grille
    node: grilleBroken
    deconstructionTarget: start
  - type: Fixtures # overwrite BaseStructure parent.
  - type: Physics
    bodyType: Static
    canCollide: false
  - type: Tag
    tags:
    - ForceNoFixRotations
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: FlimsyMetallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 10
      behaviors:
      - !type:ChangeConstructionNodeBehavior
        node: start
      - !type:DoActsBehavior
        acts: ["Destruction"]

- type: entity
  id: ClockworkGrilleBroken
  parent: GrilleBroken
  name: clockwork grille
  description: A flimsy framework of iron rods assembled in traditional Ratvarian fashion. It has seen better days.
  components:
  - type: Sprite
    drawdepth: Walls
    sprite: Structures/Walls/clockwork_grille.rsi
    state: brokenratvargrille
  - type: Icon
    sprite: Structures/Walls/clockwork_grille.rsi
    state: brokenratvargrille
  - type: Construction
    graph: ClockGrille
    node: clockGrilleBroken

- type: entity
  id: GrilleDiagonal
  parent: Grille
  name: diagonal grille
  components:
  - type: Sprite
    drawdepth: Walls
    sprite: Structures/Walls/grille.rsi
    layers:
    - state: grille_diagonal
    - state: electrified_diagonal
      sprite: Effects/electricity.rsi
      map: ["enum.ElectrifiedLayers.Sparks"]
      shader: unshaded
      visible: false
  - type: Icon
    sprite: Structures/Walls/grille.rsi
    state: grille_diagonal
  - type: Tag
    tags:
    - Diagonal
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PolygonShape
            vertices:
            - "-0.5,-0.5"
            - "0.5,0.5"
            - "0.5,-0.5"
        # mask: # Frontier
        # - FullTileMask # Frontier
        layer:
        - GlassLayer # Frontier: WallLayer<GlassLayer
  - type: Construction
    graph: GrilleDiagonal
    node: grilleDiagonal

- type: entity
  id: ClockworkGrilleDiagonal
  parent: ClockworkGrille
  name: diagonal clockwork grille
  components:
  - type: Sprite
    drawdepth: Walls
    sprite: Structures/Walls/clockwork_grille.rsi
    layers:
    - state: ratvargrille_diagonal
    - state: electrified_diagonal
      sprite: Effects/electricity.rsi
      map: ["enum.ElectrifiedLayers.Sparks"]
      shader: unshaded
      visible: false
  - type: Icon
    sprite: Structures/Walls/clockwork_grille.rsi
    state: ratvargrille_diagonal
  - type: Tag
    tags:
    - Diagonal
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PolygonShape
            vertices:
            - "-0.5,-0.5"
            - "0.5,0.5"
            - "0.5,-0.5"
        # mask: # Frontier
        # - FullTileMask # Frontier
        layer:
        - GlassLayer # Frontier: WallLayer<GlassLayer
  - type: Construction
    graph: GrilleDiagonal
    node: clockworkGrilleDiagonal

