# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Shaddap1 <106589956+Shaddap1@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 lanse12 <cloudability.ez@gmail.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2025 Aidenkrz <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2025 Aineias1 <dmitri.s.kiselev@gmail.com>
# SPDX-FileCopyrightText: 2025 August Sun <45527070+august-sun@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 ExponentialWizard <38435756+ExponentialWizard@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 FaDeOkno <143940725+FaDeOkno@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 McBosserson <148172569+McBosserson@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Milon <plmilonpl@gmail.com>
# SPDX-FileCopyrightText: 2025 Piras314 <p1r4s@proton.me>
# SPDX-FileCopyrightText: 2025 Rouden <149893554+Roudenn@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 TheBorzoiMustConsume <197824988+TheBorzoiMustConsume@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Unlumination <144041835+Unlumy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 august-sun <45527070+august.sun@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2025 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 gluesniffler <linebarrelerenthusiast@gmail.com>
# SPDX-FileCopyrightText: 2025 thebiggestbruh <marcus2008stoke@gmail.com>
# SPDX-FileCopyrightText: 2025 username <113782077+whateverusername0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 whateverusername0 <whateveremail>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: BaseMobAsteroid
  parent:
  - BaseMob
  - MobDamageable
  - MobAtmosExposed
  - MobCombat
  abstract: true
  components:
  - type: Reactive
    groups:
      Flammable: [Touch]
      Extinguish: [Touch]
      Acidic: [Touch, Ingestion]
  - type: Body
    prototype: Animal
  - type: Climbing
  - type: NameIdentifier
    group: GenericNumber
  - type: StatusEffects
    allowed:
    - SlowedDown
    - Stutter
    - Stun
    - Electrocution
    - TemporaryBlindness
    - RadiationProtection
    - Adrenaline
  - type: StandingState
  - type: Tag
    tags:
    - DoorBumpOpener

- type: entity
  id: MobGoliath
  parent: [ BaseMobAsteroid, MobBloodstream ]
  name: goliath
  description: A massive beast that uses long tentacles to ensnare its prey, threatening them is not advised under any conditions.
  components:
  - type: Body # Shitmed Change
    prototype: Goliath
  - type: SurgeryTarget # Shitmed
  - type: UserInterface # Shitmed
    interfaces:
      enum.SurgeryUIKey.Key:
        type: SurgeryBui
  - type: Sprite
    sprite: Mobs/Aliens/Asteroid/goliath.rsi
    layers:
    - map: ["enum.DamageStateVisualLayers.Base"]
      state: goliath
  - type: DamageStateVisuals
    states:
      Alive:
        Base: goliath
      Dead:
        Base: goliath_dead
  - type: MovementSpeedModifier
    baseWalkSpeed : 1.5 # Goob - accounts for decreased range, more likely to catch up to you when stunned by tendrils
    baseSprintSpeed : 1.5
  - type: Bloodstream
    bloodMaxVolume: 350
    chemicalMaxVolume: 0
  - type: MobThresholds
    thresholds:
      0: Alive
      350: Dead # Goob - 9 PKA shots, 4 crusher destabilised hits
  - type: MeleeWeapon
    soundHit:
      path: "/Audio/Weapons/smash.ogg"
    angle: 0
    attackRate: 0.40
    animation: WeaponArcPunch
    damage:
      types:
        Blunt: 35
        Slash: 15
    range: 1.12 # Goob - Allows kinetic crushers to fight them without taking guaranteed damage.
  - type: NpcFactionMember
    factions:
    - Lavafauna
  - type: HTN
    constantlyReplan: false
    rootTask:
      task: GoliathCompound
    blackboard:
      VisionRadius: !type:Single
        6
      AggroVisionRadius: !type:Single
        7
      NavSmash: !type:Bool
        true
  - type: NPCUseActionOnTarget
    actionId: ActionGoliathTentacle
  - type: Tag
    tags:
    - CannotSuicide
    - Goliath
    - FootstepSound
  - type: NoSlip
  - type: Butcherable
    spawned:
    - id: FoodMeatGoliath
      amount: 3
    - id: MaterialGoliathHide1
      amount: 1
  - type: Fauna # Lavaland Change

- type: entity
  parent: BaseAction
  id: ActionGoliathTentacle
  name: "[color=red]Tentacle Slam[/color]"
  description: Use your tentacles to grab and stun a target player!
  components:
  - type: Action
    raiseOnUser: true
    icon:
      sprite: Mobs/Aliens/Asteroid/goliath.rsi
      state: goliath_tentacle_spawn
    iconOn:
      sprite: Mobs/Aliens/Asteroid/goliath.rsi
      state: goliath_tentacle_wiggle
    sound:
      path: "/Audio/Weapons/slash.ogg"
    useDelay: 8
  - type: TargetAction
    range: 10
  - type: WorldTargetAction
    event: !type:GoliathSummonTentacleAction

- type: entity
  id: GoliathTentacle
  name: tentacle
  components:
  - type: Transform
    anchored: True
  - type: Physics
    bodyType: Static
    canCollide: true
  - type: InteractionOutline
  - type: Sprite
    sprite: Mobs/Aliens/Asteroid/goliath.rsi
    layers:
    - state: goliath_tentacle_wiggle
  - type: StunOnContact
    blacklist:
      tags:
      - Goliath
  - type: Fixtures
    fixtures:
      fix:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.45"
        mask:
        - Impassable
        layer:
        - Impassable
        hard: false
  - type: TimedDespawn #do this shit by hand because of fucking course.
    lifetime: 0.4
  - type: SpawnOnDespawn
    prototype: EffectGoliathTentacleRetract

- type: entity
  id: BaseEffectGoliathTentacleSpawn
  categories: [ HideSpawnMenu ]
  name: tentacle
  abstract: true
  components:
  - type: Transform
    anchored: True
  - type: Physics
    bodyType: Static
    canCollide: false
  - type: Sprite
    sprite: Mobs/Aliens/Asteroid/goliath.rsi
  - type: InteractionOutline
  - type: TimedDespawn
    lifetime: 0.7

- type: entity
  id: EffectGoliathTentacleSpawn
  parent: BaseEffectGoliathTentacleSpawn
  categories: [ HideSpawnMenu ]
  name: tentacle
  components:
    - type: Sprite
      state: goliath_tentacle_spawn
    - type: SpawnOnDespawn
      prototype: GoliathTentacle

- type: entity
  id: EffectGoliathTentacleRetract
  parent: BaseEffectGoliathTentacleSpawn
  categories: [ HideSpawnMenu ]
  components:
  - type: Sprite
    state: goliath_tentacle_retract
  - type: EffectVisuals
  - type: AnimationPlayer

- type: entity
  id: MobHivelord
  parent: [ BaseMobAsteroid, FlyingMobBase ]
  name: hivelord
  description: A truly alien creature, it is a mass of unknown organic material, constantly fluctuating. When attacking, pieces of it split off and attack in tandem with the original.
  components:
  - type: WeatherImmune 
  - type: Sprite
    sprite: Mobs/Aliens/Asteroid/hivelord.rsi
    layers:
    - map: ["enum.DamageStateVisualLayers.Base"]
      state: hivelord
  - type: DamageStateVisuals
    states:
      Alive:
        Base: hivelord
      Dead:
        Base: hivelord_dead
  - type: MovementSpeedModifier
    baseWalkSpeed : 2.75
    baseSprintSpeed : 3.0
  - type: MobThresholds
    thresholds:
      0: Alive
      75: Dead
  - type: MeleeWeapon
    damage:
      types:
        Blunt: 0
  - type: Gun
    fireRate: 0.66
    selectedMode: SemiAuto
    showExamineText: false
    availableModes:
    - SemiAuto
    soundGunshot: null
  - type: RechargeBasicEntityAmmo
    showExamineText: false
    rechargeCooldown: 0
    rechargeSound: null
  - type: BasicEntityAmmoProvider
    proto: MobHivelordBrood
    capacity: 1
    count: 1
  - type: NpcFactionMember
    factions:
    - Lavafauna # Goobedit - Lavaland
  - type: HTN
    rootTask:
      task: SimpleRangedHostileCompound
    blackboard:
      VisionRadius: !type:Single
        4
      AggroVisionRadius: !type:Single
        7
      NavSmash: !type:Bool
        true
  - type: Butcherable
    spawned:
    - id: FoodHivelordRemains
  - type: Fauna # Lavaland Change

- type: entity
  id: MobHivelordBrood
  parent: [ BaseMobAsteroid, FlyingMobBase ]
  name: hivelord brood
  description: A fragment of the original hivelord, rallying behind its original. One isn't much of a threat, but...
  components:
  - type: Sprite
    sprite: Mobs/Aliens/Asteroid/hivelord.rsi
    layers:
    - state: hivelordbrood
  - type: MovementSpeedModifier
    baseWalkSpeed : 3.5
    baseSprintSpeed : 4.0
  - type: MobThresholds
    thresholds:
      0: Alive
      5: Dead
  - type: MeleeWeapon
    soundHit:
      path: /Audio/Weapons/bladeslice.ogg
    angle: 0
    attackRate: 1.0
    range: 0.50
    animation: WeaponArcPunch
    damage:
      types:
        Slash: 6
  - type: Ammo
    muzzleFlash: null
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 5
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: NpcFactionMember
    factions:
    - Lavafauna
  - type: HTN
    rootTask:
      task: SimpleHostileCompound
    blackboard: # highly aggressive
      VisionRadius: !type:Single
        15
      AggroVisionRadius: !type:Single
        15
      NavSmash: !type:Bool
        true
  - type: TimedDespawn
    lifetime: 45

- type: entity
  id: FoodHivelordRemains
  parent: FoodBase
  name: hivelord remains
  description: All that remains of a hivelord, it seems to be what allows it to break pieces of itself off without being hurt... its healing properties will soon become inert if not used quickly. Try not to think about what you're eating.
  components:
  - type: SolutionContainerManager
    solutions:
      food:
        maxVol: 5
        reagents:
        - ReagentId: Rororium
          Quantity: 5
  - type: Sprite
    sprite: Objects/Consumable/Food/rorocore.rsi
    state: boiled
  - type: Item
    size: Normal
  - type: Perishable
    rotAfter: 360 # rot after 6 minutes
    molsPerSecondPerUnitMass: 0
    forceRotProgression: true
  - type: RotInto
    entity: FoodHivelordRemainsInert
    stage: 1
  - type: StaticPrice
    price: 5000
  - type: Tag
    tags:
    - HivelordRemains

- type: entity
  id: FoodHivelordRemainsInert
  parent: BaseItem
  name: inert hivelord remains
  description: All that remains of a hivelord... Now all is truly lost.
  components:
  - type: Sprite
    sprite: Objects/Consumable/Food/rorocore.rsi
    state: boiled
    color: "#664444"
  - type: SpaceGarbage
  - type: Item
    size: Normal
  - type: StaticPrice
    price: 1000
  - type: Tag
    tags:
    - HivelordRemains


- type: entity
  id: MobBasilisk
  parent: [ BaseMobAsteroid, MobBloodstream ]
  name: basilisk
  description: A territorial beast, covered in a thick shell that absorbs energy. Its stare causes victims to freeze from the inside.
  components:
  - type: Sprite
    sprite: Mobs/Aliens/Asteroid/basilisk.rsi
    layers:
    - map: ["enum.DamageStateVisualLayers.Base"]
      state: basilisk
  - type: DamageStateVisuals
    states:
      Alive:
        Base: basilisk
      Dead:
        Base: basilisk_dead
  - type: MovementSpeedModifier
    baseWalkSpeed : 2
    baseSprintSpeed : 3
  - type: MobThresholds
    thresholds:
      0: Alive
      45: Dead
  - type: MeleeWeapon
    angle: 0
    animation: WeaponArcBite
    soundHit:
      path: /Audio/Effects/bite.ogg
    damage:
      types:
        Slash: 7
        Piercing: 5
  - type: Gun
    fireRate: 0.75
    projectileSpeed: 10.0 # When we get predicted guns and projectiles this should be raised to like 15, 15 mis-predicts too much right now unfortunately.
    selectedMode: SemiAuto
    showExamineText: false
    availableModes: [ SemiAuto ]
    soundGunshot: /Audio/Weapons/Guns/Gunshots/syringe_gun.ogg
  - type: RechargeBasicEntityAmmo
    showExamineText: false
    rechargeCooldown: 0
    rechargeSound: null
  - type: BasicEntityAmmoProvider
    proto: BasiliskRay
    capacity: 1
    count: 1
  - type: Bloodstream
    bloodMaxVolume: 200
    chemicalMaxVolume: 0
  - type: NpcFactionMember
    factions:
    - SimpleHostile
  - type: HTN
    rootTask:
      task: BasiliskCompound
    blackboard:
      VisionRadius: !type:Single
        7
      AggroVisionRadius: !type:Single
        12
      NavSmash: !type:Bool
        true
  - type: Reflect
    reflectProb: 1
    reflects:
    - Energy
  - type: Butcherable
    spawned:
    - id: DiamondOre1
      amount: 1
      maxAmount: 3
