# Metal Barricade Tree


- type: entity
  parent: CMBarricadeBase
  id: CMBarricadeMetal
  name: metal barricade
  description: A sturdy and easily assembled barricade made of metal plates, often used for quick fortifications. Use a blowtorch to repair.
  components:
  - type: Climbable
  - type: Anchorable
  - type: MeleeSound
    soundGroups:
      Brute:
        path:
          "/Audio/_RMC14/Structures/metalhit.ogg"
  - type: Sprite
    sprite: _RMC14/Structures/Walls/Barricades/barricade.rsi
    layers:
    - state: metal
    - map: [ "acided" ]
    drawdepth: WallTops
  - type: InteractionPopup
    interactSuccessString: fence-rattle-success
    messagePerceivedByOthers: fence-rattle-success
    interactSuccessSound:
      collection: FenceRattle
  - type: RMCRepairable
    heal: 200
    skill: RMCSkillConstruction
    delay: 10
    fuelUsed: 2
    repairableDamageLimit: 340
  - type: NailgunRepairable
    # cm13 max_health%: 0.3, 0.45
    repairMetal: 135
    repairPlasteel: 200
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 450
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          CMSheetMetal1:
            min: 2
            max: 2
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: DamageVisuals
    thresholds: [4, 8, 12]
    damageDivisor: 25
    trackAllDamage: true
    damageOverlay:
      sprite: _RMC14/Structures/Walls/Barricades/metal_barricade_cracks.rsi
  - type: Barbed
    thornsDamage:
      types:
        Slash: 10
  - type: Construction
    graph: BarricadeMetalGraph
    node: nodeMetal
  - type: RMCConstructionUpgradeTarget
    upgrades: ["RMCExplosiveUpgrade", "RMCBiohazardUpgrade", "RMCBruteUpgrade"]
  - type: Tag
    tags:
    - RMCMetalBarricade

- type: Tag
  id: RMCMetalBarricade

- type: entity
  parent: CMBarricadeMetal
  id: RMCBarricadeMetalAltDrawdepth
  suffix: Layers over Platforms
  components:
    - type: Sprite
      drawdepth: SmallObjects

# Metal Barricade Upgrades
- type: entity
  parent: CMBarricadeMetal
  id: CMBarricadeBurn
  suffix: Biohazard
  components:
    - type: Sprite
      sprite: _RMC14/Structures/Walls/Barricades/barricade.rsi
      layers:
      - state: metal
      - state: burn_upgrade
      - map: [ "acided" ]
    - type: Damageable
      damageContainer: Inorganic
      damageModifierSet: CMBurnBarricade
    - type: DamageVisuals
      thresholds: [4, 8, 12]
      damageDivisor: 25
      trackAllDamage: true
      damageOverlay:
        sprite: _RMC14/Structures/Walls/Barricades/burn_barricade_cracks.rsi
    - type: RMCConstructionUpgradeTarget
      upgrades: null
    - type: Flammable
      damage:
        types:
          Heat: 1.5

- type: entity
  parent: CMBarricadeMetal
  id: CMBarricadeBrute
  suffix: Reinforced
  components:
    - type: Sprite
      sprite: _RMC14/Structures/Walls/Barricades/barricade.rsi
      layers:
      - state: metal
      - state: brute_upgrade
      - map: [ "acided" ]
    - type: Damageable
      damageContainer: Inorganic
      damageModifierSet: CMBruteBarricade
    - type: DamageVisuals
      thresholds: [4, 8, 12]
      damageDivisor: 25
      trackAllDamage: true
      damageOverlay:
        sprite: _RMC14/Structures/Walls/Barricades/brute_barricade_cracks.rsi
    - type: RMCConstructionUpgradeTarget
      upgrades: null

- type: entity
  parent: CMBarricadeMetal
  id: CMBarricadeExplosive
  suffix: Composite
  components:
    - type: Sprite
      sprite: _RMC14/Structures/Walls/Barricades/barricade.rsi
      layers:
      - state: metal
      - state: explosive_upgrade
      - map: [ "acided" ]
    - type: ExplosionResistance
      damageCoefficient: 0.5
    - type: DamageVisuals
      thresholds: [4, 8, 12]
      damageDivisor: 25
      trackAllDamage: true
      damageOverlay:
        sprite: _RMC14/Structures/Walls/Barricades/explosive_barricade_cracks.rsi
    - type: RMCConstructionUpgradeTarget
      upgrades: null
    - type: Flammable
      damage:
        types:
          Heat: 1

# Turnstile (not sure how to make a one-way door so for now it is a glorified fence)
- type: entity
  parent: CMBarricadeBase
  id: CMBarricadeTurnstile
  name: turnstile
  description: A railing to prevent marines from stepping out of line.
  components:
    - type: Anchorable
    - type: Sprite
      sprite: _RMC14/Structures/Walls/Barricades/barricade.rsi
      layers:
      - state: turnstile
      - map: [ "acided" ]
    - type: Damageable
      damageContainer: Inorganic
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 100
        behaviors:
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - type: Construction
      graph: BarricadeTurnstileGraph
      node: nodeTurnstile

- type: entity
  parent: CMBarricadeTurnstile
  id: CMBarricadeTurnstileMed
  name: turnstile
  description: A railing to prevent marines from stepping out of line. This one is designed specifically for medical.
  components:
    - type: Sprite
      sprite: _RMC14/Structures/Walls/Barricades/barricade.rsi
      layers:
      - state: turnstile_med
      - map: [ "acided" ]
    - type: Construction
      graph: BarricadeTurnstileGraph
      node: nodeTurnstile

# Handrails
- type: entity
  parent: CMBarricadeBase
  id: RMCBarricadeHandrail
  name: handrail
  description: A railing, for your hands. Woooow.
  components:
    - type: VehicleSmashable
    - type: Anchorable
    - type: Sprite
      drawdepth: WallTops
      sprite: _RMC14/Structures/Walls/Barricades/barricade.rsi
      layers:
      - state: handrail_a_0
      - map: [ "acided" ]
    - type: Physics
    - type: RMCRepairable
      heal: 200
      skill: RMCSkillConstruction
      delay: 10
      fuelUsed: 2
    - type: Damageable
      damageContainer: StructuralMarine
      damageModifierSet: StructuralMarine
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 30
        behaviors:
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - type: Climbable
    - type: Construction
      graph: BarricadeHandrailGraph
      node: nodeHandrail
    - type: XenoCrusherChargable
      instantDestroy: true
      passOnDestroy: true

- type: entity
  parent: RMCBarricadeHandrail
  id: RMCBarricadeHandrailAlt
  components:
    - type: Sprite
      layers:
      - state: handrail_b_0
      - map: [ "acided" ]
    - type: Construction
      graph: BarricadeHandrailGraph
      node: nodeHandrail

- type: entity
  parent: RMCBarricadeHandrailAlt
  id: RMCBarricadeHandrailAltDrawdepth
  suffix: Layers over Platforms
  components:
    - type: Sprite
      drawdepth: SmallObjects

- type: entity
  parent: RMCBarricadeHandrail
  id: RMCBarricadeHandrailMed
  components:
    - type: Sprite
      layers:
      - state: handrail_med
      - map: [ "acided" ]
    - type: Construction
      graph: BarricadeHandrailGraph
      node: nodeHandrail

- type: entity
  parent: RMCBarricadeHandrail
  id: RMCBarricadeHandrailStrata
  components:
    - type: Sprite
      layers:
      - state: handrail_strata
      - map: [ "acided" ]
    - type: Construction
      graph: BarricadeHandrailGraph
      node: nodeHandrail

- type: entity
  parent: RMCBarricadeHandrailStrata
  id: RMCBarricadeHandrailStrataAltDrawdepth
  suffix: Layers over Platforms
  components:
    - type: Sprite
      drawdepth: SmallObjects

- type: entity
  parent: RMCBarricadeHandrail
  id: RMCBarricadeHandrailKutjevo
  components:
    - type: Sprite
      layers:
      - state: hr_kutjevo
      - map: [ "acided" ]
    - type: Construction
      graph: BarricadeHandrailGraph
      node: nodeHandrail

- type: entity
  parent: RMCBarricadeHandrail
  id: RMCBarricadeWireRail
  components:
    - type: Sprite
      layers:
      - state: wire_rail
      - map: [ "acided" ]
    - type: Construction
      graph: BarricadeHandrailGraph
      node: nodeHandrail

- type: entity
  parent: RMCBarricadeWireRail
  id: RMCBarricadeWireRailAltDrawdepth
  suffix: Layers over Platforms
  components:
    - type: Sprite
      drawdepth: SmallObjects

- type: entity
  parent: RMCBarricadeHandrail
  id: RMCBarricadeHybrisa
  components:
    - type: Sprite
      layers:
      - state: handrail_hybrisa
      - map: [ "acided" ]
    - type: Construction
      graph: BarricadeHandrailGraph
      node: nodeHandrail

- type: entity
  parent: RMCBarricadeHandrail
  id: RMCBarricadeHybrisaCenterRoad
  components:
    - type: Sprite
      layers:
      - state: centerroadbarrier2
      - map: [ "acided" ]
    - type: Construction
      graph: BarricadeHandrailGraph
      node: nodeHandrail

- type: entity
  parent: RMCBarricadeHybrisaCenterRoad
  id: RMCBarricadeHybrisaCenterRoadDouble
  suffix: Double
  components:
    - type: Sprite
      offset: 0,-0.15
      layers:
      - state: centerroadbarrier1
      - map: [ "acided" ]


- type: entity
  parent: RMCBarricadeHandrail
  id: RMCBarricadeHybrisaPlasticRoadBarrier
  name: plastic road barrier
  components:
    - type: Sprite
      layers:
      - state: plasticroadbarrierred
      - map: [ "acided" ]
    - type: Construction
      graph: BarricadeHandrailGraph
      node: nodeHandrail

- type: entity
  parent: RMCBarricadeHybrisaPlasticRoadBarrier
  id: RMCBarricadeHybrisaPlasticRoadBarrierBlue
  components:
    - type: Sprite
      layers:
      - state: plasticroadbarrierblue
      - map: [ "acided" ]

- type: entity
  parent: RMCBarricadeHybrisaPlasticRoadBarrier
  id: RMCBarricadeHybrisaPlasticRoadBarrierBlack
  components:
    - type: Sprite
      layers:
      - state: plasticroadbarrierblack
      - map: [ "acided" ]

# Metal Barricade Doors
- type: entity
  parent: CMBarricadeBase
  id: CMBarricadeMetalDoor
  name: folding metal barricade
  description: A folding metal barricade weaker than the non-folding counterpart. Able to be opened and closed at a moment's notice. Repair with a welder.
  components:
  - type: Anchorable
  - type: MeleeSound
    soundGroups:
      Brute:
        path:
          "/Audio/_RMC14/Structures/metalhit.ogg"
  - type: Sprite
    sprite: _RMC14/Structures/Walls/Barricades/barricade.rsi
    layers:
    - state: folding_metal
      map: ["enum.DoorVisualLayers.Base"]
    - map: [ "acided" ]
    drawdepth: WallTops
  - type: RMCRepairable
    heal: 200
    skill: RMCSkillConstruction
    delay: 10
    fuelUsed: 2
    repairableDamageLimit: 300
  - type: NailgunRepairable
    # cm13 max_health%: 0.3, 0.45
    repairMetal: 120
    repairPlasteel: 180
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 400
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          CMSheetMetal1:
            min: 3
            max: 3
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: AnimationPlayer
  - type: GenericVisualizer
    visuals:
      enum.BarbedWireVisualLayers.Wire:
        barbWired:
          UnWired: { state: folding_metal_closed_wire, visible: false }
          WiredClosed: { state: folding_metal_wire, visible: true }
          WiredOpen: { state: folding_metal_closed_wire, visible: true }
      enum.SprayAcidedVisuals.Acided:
        acided:
          True:
            sprite: _RMC14/Effects/xeno_spray_acid.rsi
            state: acid
            visible: true
          False:
            visible: false
  - type: InteractionOutline
  - type: Door
    openSpriteState: folding_metal_closed
    closedSpriteState: folding_metal
    canPry: false
    occludes: false
    changeAirtight: false
    bumpOpen: false
    clickOpen: true
    canCrush: false
    closeTimeOne: 0
    closeTimeTwo: 0
    openTimeOne: 0
    openTimeTwo: 0
    openingAnimationTime: 0
    closingAnimationTime: 0
    # Allow you to close barricades while people are standing on them or multiple are wrenched in the same tile
    performCollisionCheck: false
    openSound:
      path: /Audio/Items/ratchet.ogg
    closeSound:
      path: /Audio/Items/ratchet.ogg
  - type: Barbed
    thornsDamage:
      types:
        Slash: 10
  - type: Construction
    graph: BarricadeMetalDoorGraph
    node: nodeBarricadeMetalDoor
  - type: InteractedBlacklist
    anchoredOnly: true
    blacklist:
      components:
      - Xeno
  - type: UseDelay
    delay: 0.3
  - type: Climbable
  - type: RMCOpenOnlyWhenUnanchored
