# Base
- type: entity
  id: BaseBoltLiquidInjector
  abstract: true
  components:
  - type: SolutionContainerManager
    solutions:
      injector:
        maxVol: 2
  - type: RefillableSolution
    solution: injector
  - type: InjectableSolution
    solution: injector
  - type: SolutionInjectOnEmbed
    transferAmount: 2
    solution: injector
  - type: SolutionTransfer
    maxTransferAmount: 2
  - type: Injector
    injectOnly: false
    ignoreMobs: true
    minTransferAmount: 2
    maxTransferAmount: 2
    transferAmount: 2
    toggleState: Draw
  - type: ExaminableSolution
    solution: injector
  - type: MeleeChemicalInjector
    solution: injector

- type: entity
  id: BaseBoltEmbeddable
  abstract: true
  components:
  - type: EmbeddableProjectile
    sound: /Audio/Weapons/star_hit.ogg
    embedOnThrow: false
    offset: 0.1,0.1
  - type: ThrowingAngle
    angle: 0

- type: entity
  id: BaseBoltProjectile
  parent: BaseItem
  abstract: true
  components:
  - type: LandAtCursor
  - type: Item
    size: Tiny
  - type: Sprite
    sprite: _NF/Objects/Weapons/Guns/Ammunition/Projectiles/crossbow_bolts.rsi
  - type: Fixtures
    fixtures:
      fix1:
        shape: !type:PhysShapeCircle
          radius: 0.2
        density: 5
        mask:
        - ItemMask
        restitution: 0.3
        friction: 0.2
      projectile:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.1,-0.1,0.1,0.1"
        hard: false
        mask:
        - Impassable
        - BulletImpassable
  - type: PhysicalComposition
    materialComposition:
      Steel: 10
  - type: Damageable
    damageContainer: Inorganic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 30
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: GlassBreak
          params:
            volume: -4
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: DamageOnLand
    damage:
      types:
        Blunt: 5
  - type: Ammo
    muzzleFlash: null
  - type: Projectile
    deleteOnCollide: false
    onlyCollideWhenShot: true
    damage:
      types:
        Piercing: 25

- type: entity
  parent: [ BaseBoltProjectile, BaseBoltEmbeddable, BaseBoltLiquidInjector, BaseC1Contraband ]
  id: BaseCrossbowBolt
  abstract: true
  components:
  - type: MeleeWeapon
    attackRate: 1
    damage:
      types:
        Piercing: 4
    angle: 0
    animation: WeaponArcThrust
    soundHit:
      path: /Audio/Weapons/bladeslice.ogg
  - type: Tag
    tags:
    - CrossbowBolt

- type: entity
  parent: BaseCrossbowBolt
  id: BaseCrossbowBoltTrigger
  abstract: true
  components:
  - type: TriggerOnProjectileHit

# Lathe-printable variations
- type: entity
  parent: BaseCrossbowBolt
  id: CrossbowBolt
  name: bolt
  description: One of these was enough to put down King Richard the Lionheart. Should do for a Xeno Queen too.
  components:
  - type: Sprite
    layers:
    - state: tail
      color: "#ff0000"
    - state: rod
      color: "#303030"
    - state: tip
    - state: solution1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false

- type: Tag
  id: CrossbowBoltBroadhead

- type: entity
  parent: BaseCrossbowBolt
  id: CrossbowBoltBroadhead
  name: broadhead bolt
  description: A bolt with three sharp blades that cause massive bleeding in the victim.
  components:
  - type: Tag
    tags:
    - CrossbowBoltBroadhead
  - type: Sprite
    layers:
    - state: tail
      color: "yellow"
    - state: rod
      color: "#303030"
    - state: tip
    - state: solution1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
  - type: Projectile
    damage:
      types:
        Piercing: 5
        Slash: 15

- type: entity
  parent: BaseCrossbowBolt
  id: CrossbowBoltSponge
  name: sponge tip bolt
  description: A sponge-like structure of the bolt tip allows it to hold more liquid at the expense of structural integrity.
  components:
  - type: Sprite
    layers:
    - state: tail
      color: "#d000ff"
    - state: rod
      color: "#00303d"
    - state: tip
      color: "#959595"
    - state: solution1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
  - type: Projectile
    damage:
      types:
        Piercing: 20
    deleteOnCollide: true
  - type: SolutionContainerManager
    solutions:
      injector:
        maxVol: 5
  - type: RefillableSolution
    solution: injector
  - type: InjectableSolution
    solution: injector
  - type: SolutionInjectOnEmbed
    transferAmount: 5
    solution: injector
  - type: SolutionTransfer
    maxTransferAmount: 5
  - type: Injector
    injectOnly: false
    ignoreMobs: true
    minTransferAmount: 5
    maxTransferAmount: 5
    transferAmount: 5
    toggleState: Draw

# Craftable variations
- type: Tag
  id: CrossbowBoltGlassShard

- type: entity
  parent: CrossbowBolt
  id: CrossbowBoltGlassShard
  name: glass shard bolt
  description: A bolt with a glass shard as a tip.
  components:
  - type: Tag
    tags:
    - CrossbowBoltGlassShard
  - type: Sprite
    layers:
    - state: tail
      color: blue
    - state: rod
      color: "#959595"
    - state: tip
      color: "#65b9e9cc"
    - state: solution1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
  - type: Projectile
    damage:
      types:
        Piercing: 20
  - type: Construction
    graph: CraftCrossbowBoltGlassShard
    node: CraftCrossbowBoltGlassShard

- type: Tag
  id: CrossbowBoltPlasmaGlassShard

- type: entity
  parent: CrossbowBolt
  id: CrossbowBoltPlasmaGlassShard
  name: plasma glass shard bolt
  description: A bolt with a plasma glass shard as a tip.
  components:
  - type: Tag
    tags:
    - CrossbowBoltPlasmaGlassShard
  - type: Sprite
    layers:
    - state: tail
      color: cyan
    - state: rod
      color: "#959595"
    - state: tip
      color: "#cc87da"
    - state: solution1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
  - type: Projectile
    damage:
      types:
        Piercing: 20
  - type: Construction
    graph: CraftCrossbowBoltPlasmaGlassShard
    node: CraftCrossbowBoltPlasmaGlassShard

- type: Tag
  id: CrossbowBoltUraniumGlassShard

- type: entity
  parent: [ BaseC3ContrabandNoValue, CrossbowBolt ]
  id: CrossbowBoltUraniumGlassShard
  name: uranium glass shard bolt
  description: A bolt with a uranium glass shard as a tip. God have mercy on thy victims for you won't.
  components:
  - type: Tag
    tags:
    - CrossbowBoltUraniumGlassShard
  - type: Sprite
    layers:
    - state: tail
      color: yellow
    - state: rod
      color: "#959595"
    - state: tip
      color: "#00f941"
      shader: unshaded
    - state: solution1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
  - type: Projectile
    damage:
      types:
        Piercing: 15
        Radiation: 5
  - type: Construction
    graph: CraftCrossbowBoltUraniumGlassShard
    node: CraftCrossbowBoltUraniumGlassShard

- type: Tag
  id: CrossbowBoltSyringe

- type: entity
  parent: CrossbowBoltSponge
  id: CrossbowBoltSyringe
  name: syringe-bolt
  description: A bolt with a syringe for a tip. Very inefficient.
  components:
  - type: Tag
    tags:
    - CrossbowBoltSyringe
  - type: Sprite
    layers:
    - state: tail
      color: "#71c00b"
    - state: rod
      color: "#dadada"
    - state: tip-syringe
      color: "#2f3748"
    - state: solutionSyringe1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
  - type: SolutionContainerVisuals
    maxFillLevels: 1
    fillBaseName: solutionSyringe
  - type: Projectile
    damage:
      types:
        Piercing: 15
    deleteOnCollide: true
  - type: Construction
    graph: CraftCrossbowBoltSyringe
    node: CraftCrossbowBoltSyringe

- type: Tag
  id: CrossbowBoltPlasteel

- type: entity
  parent: [ BaseC3ContrabandNoValue, CrossbowBolt ]
  id: CrossbowBoltPlasteel
  name: plasteel tipped bolt
  description: A bolt with plasteel tip. Has armor penetrating capabilities.
  components:
  - type: Tag
    tags:
    - CrossbowBoltPlasteel
  - type: Sprite
    layers:
    - state: tail
      color: "#8291a1"
    - state: rod
      color: "#959595"
    - state: tip
      color: "#a7a3a6"
    - state: solution1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
  - type: Projectile
    damage:
      types:
        Piercing: 18
    ignoreResistances: true
  - type: Construction
    graph: CraftCrossbowBoltPlasteel
    node: CraftCrossbowBoltPlasteel

- type: Tag
  id: CrossbowBoltExplosive

- type: entity
  parent: [ BaseC3ContrabandNoValue, BaseCrossbowBoltTrigger ]
  id: CrossbowBoltExplosive
  name: explosive bolt
  description: A bolt with small explosive charge.
  components:
  - type: Tag
    tags:
    - CrossbowBoltExplosive
  - type: Sprite
    layers:
    - state: tail
      color: "orange"
    - state: rod
      color: "#959595"
    - state: charge
      color: "yellow"
    - state: tip
      color: "white"
    - state: solution1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
  - type: Projectile
    damage:
      types:
        Piercing: 15
    deleteOnCollide: true
  - type: ExplodeOnTrigger
  - type: Explosive
    explosionType: Default
    maxIntensity: 1.25
    intensitySlope: 1
    totalIntensity: 2.5
    maxTileBreak: 1
  - type: PointLight
    radius: 1.3
    color: orange
    energy: 0.8
  - type: Construction
    graph: CraftCrossbowBoltExplosive
    node: CraftCrossbowBoltExplosive

- type: Tag
  id: CrossbowBoltEMP

- type: entity
  parent: [ BaseC3ContrabandNoValue, BaseCrossbowBoltTrigger ]
  id: CrossbowBoltEMP
  name: EMP bolt
  description: A bolt with small power cell attached to it.
  components:
  - type: Tag
    tags:
    - CrossbowBoltEMP
  - type: Sprite
    layers:
    - state: tail
      color: "white"
    - state: rod
      color: "#959595"
    - state: charge
      color: "white"
    - state: tip-terminal
    - state: solution1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
    - sprite: Effects/sparks.rsi
      state: sparks
      shader: unshaded
      scale: 0.3,0.3
      offset: 0.0,-0.15
  - type: Projectile
    damage:
      types:
        Shock: 5
        Blunt: 10
    deleteOnCollide: true
  - type: StaminaDamageOnCollide
    damage: 20
  - type: EmpOnTrigger
    range: 0.5
    energyConsumption: 2700000
    disableDuration: 10
  - type: PointLight
    radius: 1.3
    color: cyan
    energy: 0.8
  - type: Construction
    graph: CraftCrossbowBoltEMP
    node: CraftCrossbowBoltEMP

- type: Tag
  id: CrossbowBoltIncendiary

- type: entity
  parent: [ BaseC3ContrabandNoValue, BaseCrossbowBolt ]
  id: CrossbowBoltIncendiary
  name: incendiary bolt
  description: A bolt with a flare attached to it.
  components:
  - type: Tag
    tags:
    - CrossbowBoltIncendiary
  - type: Sprite
    layers:
    - state: tail
      color: "#d20000"
    - state: rod
      color: "#959595"
    - state: charge
      color: "#d20000"
    - state: tip
    - state: solution1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
    - sprite: Objects/Misc/flare.rsi
      state: flare_burn
      shader: unshaded
      scale: 0.4,0.4
      offset: 0.0,-0.2
  - type: Projectile
    damage:
      types:
        Piercing: 10
    deleteOnCollide: true
  - type: IgniteOnProjectileHit
    fireStacks: 0.5
  - type: PointLight
    enabled: true
    color: "#ff4300"
    radius: 1.5
    energy: 1.3
  - type: Construction
    graph: CraftCrossbowBoltIncendiary
    node: CraftCrossbowBoltIncendiary

- type: Tag
  id: CrossbowBoltShrapnel

- type: entity
  parent: BaseCrossbowBoltTrigger
  id: CrossbowBoltShrapnel
  name: shrapnel bolt
  description: A bolt with a buckshot shotgun shell attached to it.
  components:
  - type: Tag
    tags:
    - CrossbowBoltShrapnel
  - type: Sprite
    layers:
    - state: tail
      color: "#9b0048"
    - state: rod
      color: "#767676"
    - state: charge
      color: "#801000"
    - state: tip
    - state: solution1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
  - type: Projectile
    damage:
      types:
        Blunt: 5
    deleteOnCollide: true
  - type: SpawnOnTrigger
    proto: CrossbowBoltShrapnelSpread
    mapCoords: true # shouldn't be parented to colliding object
  - type: Construction
    graph: CraftCrossbowBoltShrapnel
    node: CraftCrossbowBoltShrapnel

- type: entity
  id: CrossbowBoltShrapnelSpread
  categories: [ HideSpawnMenu, Spawner ] # Spawner category - this is intended to create other entities
  components:
  - type: ProjectileGrenade
    fillPrototype: PelletShrapnelCrossbow
    capacity: 6
    randomAngle: true # should be unreliable
  - type: TriggerOnSpawn
  - type: ContainerContainer
    containers:
      cluster-payload: !type:Container

- type: entity
  id: PelletShrapnelCrossbow
  name: crossbow shrapnel pellet
  categories: [ HideSpawnMenu ]
  parent: BaseBullet
  components:
  - type: Sprite
    sprite: Objects/Weapons/Guns/Projectiles/projectiles2.rsi
    state: buckshot
  - type: Projectile
    damage:
      types:
        Piercing: 6
  - type: TimedDespawn
    lifetime: 0.25

# Blood cult
- type: entity
  parent:
  - BaseC3CultContrabandNoValue
  - CrossbowBolt
  - ConjuredObject10 # Despawns in 10 seconds
  id: CrossbowBoltBloodDrinker
  name: blood drinker bolt
  description: A razor-sharp bolt with a serrated tip. Unquestionably unethical.
  components:
  - type: Sprite
    layers:
    - state: tail
      color: darkred
    - state: rod
      color: black
    - state: tip
      color: darkred
    - state: solution1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
  - type: Projectile
    damage:
      types:
        Piercing: 5
        Slash: 5
        Bloodloss: 5
