#TODO: Someone should probably move the ore vein prototypes into their own file, or otherwise split this up in some way. This should not be 1.5k lines long.
# I halved it, but we could still split the planet walls from the asteroid walls. Or prototype generation.

# Anyway
# See WallRock variants for the remappings.

- type: entity
  abstract: true
  parent: BaseWall
  id: BaseAsteroidRock
  components:
  - type: Transform
    noRot: true
  - type: IconSmooth
    key: stone
    additionalKeys:
    - doors
    index: 0
    base: stone
  - type: Icon
    state: full
  - type: Sprite
    drawdepth: Walls
  - type: MiningScannerViewable
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.5,-0.5,0.5,0.5"
        mask:
        - FullTileMask
        layer:
        - WallLayer
        density: 2000

- type: entity
  abstract: true
  parent: StructureHealthBarrierWeak
  id: BaseAsteroidDestructible
  components:
  - type: Damageable
    damageModifierSet: RockMod
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 30
      behaviors:
      - &SoundStoneBreak !type:PlaySoundBehavior
        sound:
          path: /Audio/Effects/break_stone.ogg
          params:
            volume: -6

#region BaseVein

- type: entity
  abstract: true
  parent: BaseStructureHealth
  id: BaseRockGibtonite
  suffix: Gibtonite
  components:
  - type: Sprite
    layers:
    - state: gibtonite_inactive
      sprite: Structures/Walls/stone-ore.rsi
      visible: false
      map: [ "enum.MiningScannerVisualLayers.Overlay", "gib" ]
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.Trigger.TriggerVisuals.VisualState:
        "gib":
          Primed:
            state: gibtonite_active
            shader: unshaded
            visible: true
          Unprimed:
            state: gibtonite_inactive
            visible: false
  - type: TimerTrigger
    examinable: false
    beepInterval: 0.4
    beepSound:
      collection: GlassCrack
  - type: RandomTimerTrigger
    min: 8
    max: 10
  - type: ExplodeOnTrigger
    keysIn:
    - timer
  - type: Explosive
    explosionType: DemolitionCharge
    totalIntensity: 450
    intensitySlope: 2.5
    maxIntensity: 10
    canCreateVacuum: false
  - type: Damageable
    damageModifierSet: RockMod
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 3
      behaviors:
      - !type:TimerStartBehavior
      - !type:PlaySoundBehavior
        sound:
          collection: GlassBreak
    - trigger:
        !type:DamageTrigger
        damage: 500 # you have to really smack it for it to manually detonate. re-examine once defusal exists
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:TriggerBehavior
        keyOut: timer # explode immediately

- type: entity
  abstract: true
  id: BaseVeinCoal
  suffix: Coal
  description: An ore vein rich with coal.
  components:
  - type: OreVein
    oreChance: 1.0
    currentOre: OreCoal
  - type: Sprite
    layers:
    - state: rock_coal
      sprite: Structures/Walls/stone-ore.rsi
      map: [ "enum.MiningScannerVisualLayers.Overlay" ]

- type: entity
  abstract: true
  id: BaseVeinGold
  suffix: Gold
  description: An ore vein rich with gold.
  components:
  - type: OreVein
    oreChance: 1.0
    currentOre: OreGold
  - type: Sprite
    layers:
    - state: rock_gold
      sprite: Structures/Walls/stone-ore.rsi
      map: [ "enum.MiningScannerVisualLayers.Overlay" ]

- type: entity
  abstract: true
  id: BaseVeinDiamond
  suffix: Diamond
  description: An ore vein rich with diamonds.
  components:
  - type: OreVein
    oreChance: 1.0
    currentOre: OreDiamond
  - type: Sprite
    layers:
    - state: rock_diamond
      sprite: Structures/Walls/stone-ore.rsi
      map: [ "enum.MiningScannerVisualLayers.Overlay" ]

- type: entity
  abstract: true
  id: BaseVeinPlasma
  suffix: Plasma
  description: An ore vein rich with plasma.
  components:
  - type: OreVein
    oreChance: 1.0
    currentOre: OrePlasma
  - type: Sprite
    layers:
    - state: rock_phoron
      sprite: Structures/Walls/stone-ore.rsi
      map: [ "enum.MiningScannerVisualLayers.Overlay" ]

- type: entity
  abstract: true
  id: BaseVeinQuartz
  suffix: Quartz
  description: An ore vein rich with quartz.
  components:
  - type: OreVein
    oreChance: 1.0
    currentOre: OreSpaceQuartz
  - type: Sprite
    layers:
    - state: rock_quartz
      sprite: Structures/Walls/stone-ore.rsi
      map: [ "enum.MiningScannerVisualLayers.Overlay" ]

- type: entity
  abstract: true
  id: BaseVeinSilver
  suffix: Silver
  description: An ore vein rich with silver.
  components:
  - type: OreVein
    oreChance: 1.0
    currentOre: OreSilver
  - type: Sprite
    layers:
    - state: rock_silver
      sprite: Structures/Walls/stone-ore.rsi
      map: [ "enum.MiningScannerVisualLayers.Overlay" ]

- type: entity
  abstract: true
  id: BaseVeinSteel
  suffix: Steel
  description: An ore vein rich with iron.
  components:
  - type: OreVein
    oreChance: 1.0
    currentOre: OreSteel
  - type: Sprite
    layers:
    - state: rock_tin
      sprite: Structures/Walls/stone-ore.rsi
      map: [ "enum.MiningScannerVisualLayers.Overlay" ]

- type: entity
  abstract: true
  id: BaseVeinUranium
  suffix: Uranium
  description: An ore vein rich with uranium.
  components:
  - type: OreVein
    oreChance: 1.0
    currentOre: OreUranium
  - type: Sprite
    layers:
    - state: rock_uranium
      sprite: Structures/Walls/stone-ore.rsi
      map: [ "enum.MiningScannerVisualLayers.Overlay" ]

- type: entity
  abstract: true
  id: BaseVeinSalt
  suffix: Salt
  description: An ore vein rich with salt.
  components:
  - type: OreVein
    oreChance: 1.0
    currentOre: OreSalt
  - type: Sprite
    layers:
    - state: rock_salt
      sprite: Structures/Walls/stone-ore.rsi
      map: [ "enum.MiningScannerVisualLayers.Overlay" ]

- type: entity
  abstract: true
  id: BaseVeinArtifactFragment
  suffix: Artifact Fragment
  description: A vein rich with strange artifacts.
  components:
  - type: OreVein
    oreChance: 1.0
    currentOre: OreArtifactFragment
  - type: Sprite
    layers:
    - state: rock_artifact_fragment
      sprite: Structures/Walls/stone-ore.rsi
      map: [ "enum.MiningScannerVisualLayers.Overlay" ]

- type: entity
  abstract: true
  id: BaseVeinRandom
  suffix: 33% Random Ores
  description: A vein rich with strange artifacts.
  components:
  - type: OreVein
    oreChance: 0.33
    oreRarityPrototypeId: RandomOreDistributionStandard

#endregion
#region Asteroid Rock

# Visuals separated from the base rock to fix destruction conflicts with gibtonite
- type: entity
  abstract: true
  id: BaseAsteroidRockVisuals
  name: asteroid rock
  description: A rocky asteroid.
  components:
  - type: Icon
    sprite: Structures/Walls/stone.rsi
    state: full
  - type: Sprite
    sprite: Structures/Walls/stone.rsi

- type: entity
  parent: [ BaseAsteroidRockVisuals, BaseAsteroidRock, BaseAsteroidDestructible ]
  id: AsteroidRock

- type: entity
  parent: [ BaseVeinCoal, AsteroidRock ]
  id: AsteroidRockCoal

- type: entity
  parent: AsteroidRockCoal
  id: AsteroidRockCoalCrab
  suffix: Coal Crab
  components:
  - type: OreVein
    currentOre: OreCoalCrab

- type: entity
  parent: [ BaseVeinGold, AsteroidRock ]
  id: AsteroidRockGold

- type: entity
  parent: AsteroidRockGold
  id: AsteroidRockGoldCrab
  suffix: Gold Crab
  components:
  - type: OreVein
    currentOre: OreGoldCrab

- type: entity
  parent: [ BaseVeinDiamond, AsteroidRock ]
  id: AsteroidRockDiamond

- type: entity
  parent: [ BaseVeinPlasma, AsteroidRock ]
  id: AsteroidRockPlasma

- type: entity
  parent: [ BaseVeinQuartz, AsteroidRock ]
  id: AsteroidRockQuartz

- type: entity
  parent: AsteroidRockQuartz
  id: AsteroidRockQuartzCrab
  suffix: Quartz Crab
  components:
  - type: OreVein
    currentOre: OreQuartzCrab

- type: entity
  parent: [ BaseVeinSilver, AsteroidRock ]
  id: AsteroidRockSilver

- type: entity
  parent: AsteroidRockSilver
  id: AsteroidRockSilverCrab
  suffix: Silver Crab
  components:
  - type: OreVein
    currentOre: OreSilverCrab

# Yes I know it drops steel but we may get smelting at some point
- type: entity
  parent: [ BaseVeinSteel, AsteroidRock ]
  id: AsteroidRockTin

- type: entity
  parent: AsteroidRockTin
  id: AsteroidRockTinCrab
  suffix: Iron Crab
  components:
  - type: OreVein
    currentOre: OreIronCrab

- type: entity
  parent: [ BaseVeinUranium, AsteroidRock ]
  id: AsteroidRockUranium

- type: entity
  parent: AsteroidRockUranium
  id: AsteroidRockUraniumCrab
  suffix: Uranium Crab
  components:
  - type: OreVein
    currentOre: OreUraniumCrab

- type: entity
  parent: [ BaseVeinSalt, AsteroidRock ]
  id: AsteroidRockSalt

- type: entity
  parent: [ BaseVeinArtifactFragment, AsteroidRock ]
  id: AsteroidRockArtifactFragment

- type: entity
  parent: [ BaseRockGibtonite, BaseAsteroidRockVisuals, BaseAsteroidRock ]
  id: AsteroidRockGibtonite

- type: entity
  parent: [ BaseVeinRandom, AsteroidRock ]
  id: AsteroidRockMining

#endregion
#region Iron Rock

- type: entity
  abstract: true
  id: BaseIronRockVisuals
  name: ironrock
  description: A rocky asteroid.
  components:
  - type: Icon
    sprite: Structures/Walls/stone-ironrock.rsi
    state: full
  - type: Sprite
    sprite: Structures/Walls/stone-ironrock.rsi

- type: entity
  parent: [ BaseIronRockVisuals, BaseAsteroidRock, BaseAsteroidDestructible ]
  id: IronRock

- type: entity
  parent: [ BaseVeinRandom, IronRock ]
  id: IronRockMining

- type: entity
  parent: [ BaseVeinCoal, IronRock ]
  id: IronRockCoal

- type: entity
  parent: [ BaseVeinGold, IronRock ]
  id: IronRockGold

- type: entity
  parent: [ BaseVeinPlasma, IronRock ]
  id: IronRockPlasma

- type: entity
  parent: [ BaseVeinQuartz, IronRock ]
  id: IronRockQuartz

- type: entity
  parent: [ BaseVeinSilver, IronRock ]
  id: IronRockSilver

- type: entity
  parent: [ BaseVeinSteel, IronRock ]
  id: IronRockIron

- type: entity
  parent: [ BaseVeinUranium, IronRock ]
  id: IronRockUranium

- type: entity
  parent: [ BaseVeinSalt, IronRock ]
  id: IronRockSalt

- type: entity
  parent: [ BaseVeinArtifactFragment, IronRock ]
  id: IronRockArtifactFragment

- type: entity
  parent: [ BaseRockGibtonite, BaseIronRockVisuals, IronRock ]
  id: IronRockGibtonite

- type: entity
  parent: [ BaseVeinDiamond, IronRock ]
  id: IronRockDiamond

#endregion
#region Wall Rock

# Rocks and ore veins
- type: entity
  parent: [ BaseWall, StructureHealthWallWeak ]
  id: WallRock
  name: rock
  suffix: planetmap
  components:
  - type: Transform
    noRot: true
  - type: SoundOnGather
  - type: Gatherable
    toolWhitelist:
      tags:
      - Pickaxe
  - type: Damageable
    damageModifierSet: RockMod
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 150
      behaviors:
      - *SoundStoneBreak
  - type: IconSmooth
    key: stone
    index: 0
    base: stone
  - type: Icon
    sprite: Structures/Walls/stone-dirt.rsi
    state: full
  - type: MiningScannerViewable
  - type: Sprite
    sprite: Structures/Walls/stone-dirt.rsi

# Ore veins
- type: entity
  parent: [ BaseVeinCoal, WallRock ]
  id: WallRockCoal
  components:
  - type: EntityRemap
    mask:
      AsteroidRock: AsteroidRockCoal
      WallRockChromite: WallRockChromiteCoal
      WallRockSand: WallRockSandCoal
      WallRockSnow: WallRockSnowCoal

- type: entity
  parent: [ BaseVeinGold, WallRock ]
  id: WallRockGold
  components:
  - type: EntityRemap
    mask:
      AsteroidRock: AsteroidRockGold
      WallRockChromite: WallRockChromiteGold
      WallRockSand: WallRockSandGold
      WallRockSnow: WallRockSnowGold

- type: entity
  parent: [ BaseVeinDiamond, WallRock ]
  id: WallRockDiamond
  components:
  - type: EntityRemap
    mask:
      AsteroidRock: AsteroidRockDiamond
      WallRockChromite: WallRockChromiteDiamond
      WallRockSand: WallRockSandDiamond
      WallRockSnow: WallRockSnowDiamond

- type: entity
  parent: [ BaseVeinPlasma, WallRock ]
  id: WallRockPlasma
  components:
  - type: EntityRemap
    mask:
      AsteroidRock: AsteroidRockPlasma
      WallRockChromite: WallRockChromitePlasma
      WallRockSand: WallRockSandPlasma
      WallRockSnow: WallRockSnowPlasma

- type: entity
  parent: [ BaseVeinQuartz, WallRock ]
  id: WallRockQuartz
  components:
  - type: EntityRemap
    mask:
      AsteroidRock: AsteroidRockQuartz
      WallRockChromite: WallRockChromiteQuartz
      WallRockSand: WallRockSandQuartz
      WallRockSnow: WallRockSnowQuartz

- type: entity
  parent: [ BaseVeinSilver, WallRock ]
  id: WallRockSilver
  components:
  - type: EntityRemap
    mask:
      AsteroidRock: AsteroidRockSilver
      WallRockChromite: WallRockChromiteSilver
      WallRockSand: WallRockSandSilver
      WallRockSnow: WallRockSnowSilver

- type: entity
  parent: [ BaseVeinSteel, WallRock ]
  id: WallRockTin
  components:
  - type: EntityRemap
    mask:
      AsteroidRock: AsteroidRockTin
      WallRockChromite: WallRockChromiteTin
      WallRockSand: WallRockSandTin
      WallRockSnow: WallRockSnowTin

- type: entity
  parent: [ BaseVeinUranium, WallRock ]
  id: WallRockUranium
  components:
  - type: EntityRemap
    mask:
      AsteroidRock: AsteroidRockUranium
      WallRockChromite: WallRockChromiteUranium
      WallRockSand: WallRockSandUranium
      WallRockSnow: WallRockSnowUranium

- type: entity
  parent: [ BaseVeinArtifactFragment, WallRock ]
  id: WallRockArtifactFragment
  components:
  - type: EntityRemap
    mask:
      AsteroidRock: AsteroidRockArtifactFragment
      WallRockChromite: WallRockChromiteArtifactFragment
      WallRockSand: WallRockSandArtifactFragment
      WallRockSnow: WallRockSnowArtifactFragment

- type: entity
  parent: [ BaseVeinSalt, WallRock ]
  id: WallRockSalt
  components:
  - type: EntityRemap
    mask:
      AsteroidRock: AsteroidRockSalt
      WallRockChromite: WallRockChromiteSalt
      WallRockSand: WallRockSandSalt
      WallRockSnow: WallRockSnowSalt

#endregion
#region Wall Rock (Snow)

- type: entity
  parent: WallRock
  id: WallRockSnow
  name: snowdrift
  components:
  - type: Icon
    sprite: Structures/Walls/stone-snow.rsi
    state: full
  - type: Sprite
    sprite: Structures/Walls/stone-snow.rsi

- type: entity
  parent: [ BaseVeinCoal, WallRockSnow ]
  id: WallRockSnowCoal

- type: entity
  parent: [ BaseVeinGold, WallRockSnow ]
  id: WallRockSnowGold

- type: entity
  parent: [ BaseVeinDiamond, WallRockSnow ]
  id: WallRockSnowDiamond

- type: entity
  parent: [ BaseVeinPlasma, WallRockSnow ]
  id: WallRockSnowPlasma

- type: entity
  parent: [ BaseVeinQuartz, WallRockSnow ]
  id: WallRockSnowQuartz

- type: entity
  parent: [ BaseVeinSilver, WallRockSnow ]
  id: WallRockSnowSilver

- type: entity
  parent: [ BaseVeinSteel, WallRockSnow ]
  id: WallRockSnowTin

- type: entity
  parent: [ BaseVeinUranium, WallRockSnow ]
  id: WallRockSnowUranium

- type: entity
  parent: [ BaseVeinArtifactFragment, WallRockSnow ]
  id: WallRockSnowArtifactFragment

- type: entity
  parent: [ BaseVeinSalt, WallRockSnow ]
  id: WallRockSnowSalt

#endregion
#region Wall Rock (Sand)

- type: entity
  parent: WallRock
  id: WallRockSand
  name: sandstone
  components:
  - type: Icon
    sprite: Structures/Walls/stone-sand.rsi
    state: full
  - type: Sprite
    sprite: Structures/Walls/stone-sand.rsi

- type: entity
  parent: [ BaseVeinCoal, WallRockSand ]
  id: WallRockSandCoal

- type: entity
  parent: [ BaseVeinGold, WallRockSand ]
  id: WallRockSandGold

- type: entity
  parent: [ BaseVeinDiamond, WallRockSand ]
  id: WallRockSandDiamond

- type: entity
  parent: [ BaseVeinPlasma, WallRockSand ]
  id: WallRockSandPlasma

- type: entity
  parent: [ BaseVeinQuartz, WallRockSand ]
  id: WallRockSandQuartz

- type: entity
  parent: [ BaseVeinSilver, WallRockSand ]
  id: WallRockSandSilver

- type: entity
  parent: [ BaseVeinSteel, WallRockSand ]
  id: WallRockSandTin

- type: entity
  parent: [ BaseVeinUranium, WallRockSand ]
  id: WallRockSandUranium

- type: entity
  parent: [ BaseVeinArtifactFragment, WallRockSand ]
  id: WallRockSandArtifactFragment

- type: entity
  parent: [ BaseVeinSalt, WallRockSand ]
  id: WallRockSandSalt

#endregion
#region Wall Rock (Chromite)

- type: entity
  id: WallRockChromite
  name: chromite
  parent: WallRock
  components:
  - type: Icon
    sprite: Structures/Walls/stone-chromite.rsi
    state: full
  - type: Sprite
    sprite: Structures/Walls/stone-chromite.rsi

- type: entity
  parent: [ BaseVeinCoal, WallRockChromite ]
  id: WallRockChromiteCoal

- type: entity
  parent: [ BaseVeinGold, WallRockChromite ]
  id: WallRockChromiteGold

- type: entity
  parent: [ BaseVeinDiamond, WallRockChromite ]
  id: WallRockChromiteDiamond

- type: entity
  parent: [ BaseVeinPlasma, WallRockChromite ]
  id: WallRockChromitePlasma

- type: entity
  parent: [ BaseVeinQuartz, WallRockChromite ]
  id: WallRockChromiteQuartz

- type: entity
  parent: [ BaseVeinSilver, WallRockChromite ]
  id: WallRockChromiteSilver

- type: entity
  parent: [ BaseVeinSteel, WallRockChromite ]
  id: WallRockChromiteTin

- type: entity
  parent: [ BaseVeinUranium, WallRockChromite ]
  id: WallRockChromiteUranium

- type: entity
  parent: [ BaseVeinArtifactFragment, WallRockChromite ]
  id: WallRockChromiteArtifactFragment

- type: entity
  parent: [ BaseVeinSalt, WallRockChromite ]
  id: WallRockChromiteSalt

#endregion
