- type: entity
  id: Grille
  parent: BaseStructure
  name: grille
  description: A flimsy framework of iron rods.
  components:
    - type: Tag
      tags:
        - RCDDeconstructWhitelist
    - type: CanBuildWindowOnTop
    - type: Sprite
      netsync: false
      drawdepth: Walls
      sprite: Structures/Walls/grille.rsi
      state: grille
    - type: Icon
      sprite: Structures/Walls/grille.rsi
      state: grille
    - type: Construction
      graph: Grille
      node: grille
      deconstructionTarget: start
    - type: Damageable
      damageContainer: Inorganic
      damageModifierSet: FlimsyMetallic
    - type: PowerConsumer
    - 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:
        - shape:
            !type:PhysShapeAabb
            bounds: "-0.5,-0.5,0.5,0.5"
          layer:
            - Impassable
            - MobImpassable
            - VaultImpassable
            - SmallImpassable
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 50 #excess damage (nuke?). avoid computational cost of spawning entities.
          behaviors:
            - !type:DoActsBehavior
              acts: ["Destruction"]
        - trigger:
            !type:DamageTrigger
            damage: 20
          behaviors:
            - !type:ChangeConstructionNodeBehavior
              node: grilleBroken
            - !type:DoActsBehavior
              acts: ["Breakage"]

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