# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  name: spear
  parent: [BaseItem, BaseMinorContraband]
  id: Spear
  description: Definition of a Classic. Keeping murder affordable since 200,000 BCE.
  components:
  - type: EmbeddableProjectile
    offset: -0.15,0.0
  - type: ThrowingAngle
    angle: 225
  - type: LandAtCursor
  - type: Tag
    tags:
    - Spear
    - ScurretWearable
  - type: Fixtures
    fixtures:
      fix1:
        shape: !type:PolygonShape
          vertices:
            - -0.08,-0.06 # Goob edit
            - -0.06,-0.08 # Goob edit
            - 0.40,0.30
            - 0.30,0.40
        density: 20
        mask:
        - ItemMask
        restitution: 0.3
        friction: 0.2
  - type: Sharp
  - type: Sprite
    sprite: Objects/Weapons/Melee/spear.rsi
    layers:
    - state: spear
    - state: spear1
      map: ["enum.SolutionContainerLayers.Fill"]
      visible: false
  - type: MeleeWeapon
    canWideSwing: false # Goob
    range: 2.2 # Goob
    attackRate: 0.8 # Goob
    animationRotation: -135 # WWDP
    wideAnimationRotation: -135
    damage:
      types:
        Piercing: 12
    angle: 0
    animation: WeaponArcThrust
    soundHit:
      path: /Audio/Weapons/bladeslice.ogg
  - type: DamageOtherOnHit
    damage:
      types:
        Piercing: 24 # Goob edit
  - type: Item
    size: Large # Goob edit
    shape: # Goob
    - 0,0,8,0
    storedRotation: 45 # Goob
  - type: Clothing
    quickEquip: false
    slots:
    - back
    - suitStorage
  - type: Construction
    graph: Spear
    node: spear
  - type: SolutionContainerManager
    solutions:
      melee:
        maxVol: 5 # Goobstation
  - type: MeleeChemicalInjector
    transferAmount: 1 # Goobstation
    solution: melee
  - type: RefillableSolution
    solution: melee
  - type: InjectableSolution
    solution: melee
  - type: SolutionInjectOnEmbed
    transferAmount: 2
    solution: melee
  - type: SolutionTransfer
    maxTransferAmount: 2
  - type: Wieldable
  - type: IncreaseDamageOnWield
    damage:
      types:
        Piercing: 6 # Goob edit
  # Goobstation - nuh uh
  #- type: Damageable
  #  damageContainer: Inorganic
  #- type: Destructible
  #  thresholds:
  #  - trigger:
  #      !type:DamageTrigger
  #      damage: 40 # Goob edit, excess damage avoids cost of spawning entities.
  #    behaviors:
  #    - !type:DoActsBehavior
  #      acts: [ "Destruction" ]
  #  - trigger:
  #      !type:DamageTrigger
  #      damage: 20
  #    behaviors:
  #    - !type:PlaySoundBehavior
  #      sound:
  #        collection: GlassBreak
  #        params:
  #          volume: -4
  #    - !type:SpawnEntitiesBehavior
  #      spawn:
  #        PartRodMetal1:
  #          min: 1
  #          max: 1
  #    - !type:DoActsBehavior
  #      acts: [ "Destruction" ]
  #- type: DamageOnLand
  #  damage:
  #    types:
  #      Blunt: 5
  - type: UseDelay
  - type: Appearance
  - type: SolutionContainerVisuals
    maxFillLevels: 1
    fillBaseName: spear
    inHandsFillBaseName: -fill-
    inHandsMaxFillLevels: 1
    equippedFillBaseName: -fill-
    equippedMaxFillLevels: 1
  - type: ThrowableBlocked # Goobstation
  - type: UndetectableContraband #Goobstation-Contraband detector
  - type: CosmicTransmutable # DeltaV
    transmutesTo: SpearCosmicCult
    requiredGlyphType: CosmicGlyphBlades


- type: entity
  name: reinforced spear
  parent: Spear
  id: SpearReinforced
  description: A spear with a reinforced glass shard as a tip.
  components:
  - type: Sprite
    sprite: Objects/Weapons/Melee/reinforced_spear.rsi
  - type: MeleeWeapon
    animationRotation: -135 # WWDP
    wideAnimationRotation: -135
    damage:
      types:
        Piercing: 15
  - type: DamageOtherOnHit
    damage:
      types:
        Piercing: 30 # Goob edit
  - type: Construction
    graph: SpearReinforced

- type: entity
  name: plasma spear
  parent: Spear
  id: SpearPlasma
  description: A spear with a plasma shard as a tip.
  components:
  - type: Sprite
    sprite: Objects/Weapons/Melee/plasma_spear.rsi
  - type: MeleeWeapon
    animationRotation: -135 # WWDP
    wideAnimationRotation: -135
    damage:
      types:
        Piercing: 18
  - type: DamageOtherOnHit
    damage:
      types:
        Piercing: 36 # Goob edit
  - type: Construction
    graph: SpearPlasma

- type: entity
  name: uranium spear
  parent: Spear
  id: SpearUranium
  description: A spear with a uranium shard as a tip.
  components:
  - type: Sprite
    sprite: Objects/Weapons/Melee/uranium_spear.rsi
  - type: MeleeWeapon
    animationRotation: -135 # WWDP
    wideAnimationRotation: -135
    damage:
      types:
        Piercing: 10
        Radiation: 8
  - type: DamageOtherOnHit
    damage:
      types:
        Piercing: 24 # Goob edit
        Radiation: 12 # Goob edit
  - type: Construction
    graph: SpearUranium

- type: entity
  name: bone spear
  parent: Spear
  id: SpearBone
  description: A spear made of bones.
  components:
  - type: Sprite
    sprite: Objects/Weapons/Melee/bone_spear.rsi
  - type: Construction
    graph: SpearBone
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 40 # Goob edit, excess damage avoids cost of spawning entities.
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 20
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: GlassBreak
          params:
            volume: -4
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialBones1:
            min: 1
            max: 2
      - !type:DoActsBehavior
        acts: [ "Destruction" ]

- type: entity
  name: sharkminnow tooth spear
  parent: Spear
  id: SpearSharkMinnow
  description: A spear with a sharkminnow tooth as a tip.
  components:
  - type: Sprite
    sprite: Objects/Weapons/Melee/sharkminnow_spear.rsi
  - type: MeleeWeapon
    wideAnimationRotation: -135
    damage:
      types:
        Piercing: 20 #goobedit - buff spear variant, nerf tooth.
  - type: DamageOtherOnHit
    damage:
      types:
        Piercing: 30 #goobedit - buff spear variant, nerf tooth.
  - type: Construction
    graph: SpearSharkMinnow
