# SPDX-FileCopyrightText: 2021 Kara D <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2021 Moony <moonheart08@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Jessica M <jessica@jessicamaybe.com>
# SPDX-FileCopyrightText: 2022 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2023 Alekshhh <44923899+Alekshhh@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Duke <112821543+DukeVanity@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Tom Leys <tom@crump-leys.com>
# SPDX-FileCopyrightText: 2023 Vordenburg <114301317+Vordenburg@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2023 liltenhead <104418166+liltenhead@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ed <96445749+TheShuEd@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2024 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2024 Tayrtahn <tayrtahn@gmail.com>
# SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 DeusMaldPr <dusanduski@gmail.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 NazrinNya <137837419+NazrinNya@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 SX-7 <sn1.test.preria.2002@gmail.com>
# SPDX-FileCopyrightText: 2025 Victor Shen <71985089+Vexerot@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 slarticodefast <161409025+slarticodefast@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: BaseKudzu
  abstract: true
  placement:
    mode: SnapgridCenter
    snap:
      - Wall
  components:
    - type: Appearance
    - type: Transform
      anchored: true
    - type: Physics
    - type: Kudzu
    - type: GrowingKudzu
    - type: ActiveEdgeSpreader
    - type: EdgeSpreader
      id: Kudzu
    - type: SpeedModifierContacts
      affectAirborne: true

- type: entity
  id: Kudzu
  name: kudzu
  parent: BaseKudzu
  description: A rapidly growing, dangerous plant. WHY ARE YOU STOPPING TO LOOK AT IT?!
  components:
    - type: MeleeSound
      soundGroups:
        Brute:
          path:
            "/Audio/Weapons/slash.ogg"
    - type: Sprite
      sprite: Objects/Misc/kudzu.rsi
      state: kudzu_11
      drawdepth: Overdoors
    - type: KudzuVisuals
    - type: Clickable
    - type: Fixtures
      fixtures:
        fix1:
          hard: false
          density: 7
          shape:
            !type:PhysShapeAabb
            bounds: "-0.5,-0.5,0.5,0.5"
          layer:
          - MidImpassable
    - type: Damageable
      damageModifierSet: Wood
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 10
        behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - type: Temperature
      heatDamage:
        types:
          Heat: 5
      coldDamage: {}
      coldDamageThreshold: 0
    - type: Flammable
      fireSpread: true #If you walk into incredibly dense, flaming vines, you can expect to burn.
      damage:
        types:
          Heat: 1.5
    - type: Reactive
      groups:
        Flammable: [Touch]
        Extinguish: [Touch]
      reactions:
      - reagents: [WeedKiller, PlantBGone]
        methods: [Touch]
        effects:
        - !type:HealthChange
          scaleByQuantity: true
          damage:
            types:
              Heat: 0.5
    - type: AtmosExposed
    - type: Kudzu
      growthTickChance: 0.3
      spreadChance: 0.2
    - type: SpeedModifierContacts
      walkSpeedModifier: 0.2
      sprintSpeedModifier: 0.2
      ignoreWhitelist:
        components:
        - IgnoreKudzu
    - type: Food
      requiredStomachs: 2 # ruminants have 4 stomachs but i dont care to give them literally 4 stomachs. 2 is good
      delay: 0.5
    - type: FlavorProfile
      flavors:
      - fiber
    - type: SolutionContainerManager
      solutions:
        food:
          reagents:
          - ReagentId: Nutriment
            Quantity: 2

- type: entity
  id: WeakKudzu
  parent: Kudzu
  suffix: Weak
  components:
    - type: Kudzu
      spreadChance: 0.1

- type: entity
  id: KudzuFlowerFriendly
  name: floral carpet
  suffix: Friendly, Floral Anomaly
  description: A colorful carpet of flowers sprawling in every direction. You're not sure whether to take it down or leave it up.
  parent: Kudzu
  components:
    - type: Sprite
      drawdepth: HighFloorObjects
      sprite: Objects/Misc/kudzuflower.rsi
      state: kudzu_11
    - type: Kudzu
      spriteVariants: 5
      spreadChance: 0.01
    - type: SpeedModifierContacts
      walkSpeedModifier: 0.8
      sprintSpeedModifier: 0.8
      ignoreWhitelist:
        components:
        - IgnoreKudzu
    - type: RandomSpawner
      deleteSpawnerAfterSpawn: false
      rareChance: 0.15
      offset: 0.2
      chance: 0.05
      prototypes:
      - LightTree #TODO: transform into EntityTable with weight
      - LightTree
      - LightTree
      - LightTree
      - LightTree
      - LightTree
      - CrystalCyan
      rarePrototypes:
      - AnomalyFloraBulb

- type: entity
  id: KudzuFlowerAngry
  suffix: Angry, Floral Anomaly
  parent: KudzuFlowerFriendly
  components:
    - type: Kudzu
      spreadChance: 0.1
    - type: RandomSpawner
      chance: 0.05
      rarePrototypes:
      - AnomalyFloraBulb
      - AnomalyFloraBulb
      - MobLuminousEntity
      - MobLuminousObject
      - MobLuminousPerson

- type: entity
  id: FleshKudzu
  name: tendons
  parent: BaseKudzu
  description: A rapidly growing cluster of meaty tendons. WHY ARE YOU STOPPING TO LOOK AT IT?!
  placement:
    mode: SnapgridCenter
    snap:
      - Wall
  components:
    - type: MeleeSound
      soundGroups:
        Brute:
          path:
            "/Audio/Weapons/slash.ogg"
    - type: Sprite
      sprite: Objects/Misc/fleshkudzu.rsi
      state: kudzu_11
      drawdepth: Overdoors
    - type: KudzuVisuals
    - type: Clickable
    - type: Fixtures
      fixtures:
        fix1:
          hard: false
          density: 7
          shape:
            !type:PhysShapeAabb
            bounds: "-0.5,-0.5,0.5,0.5"
          layer:
          - MidImpassable
    - type: Damageable
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 40
        behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - type: DamageContacts
      damage:
        types:
          Slash: 1.5
          Piercing: 1.5
      ignoreWhitelist:
        tags:
        - Flesh
    - type: Kudzu
      growthTickChance: 0.1
      spreadChance: 0.2
      # Heals each time it manages to do a growth tick:
      damageRecovery:
        types:
          Slash: -0.5
          Heat: -1.0
          Cold: -1.0
          Blunt: -0.5 # Needs to be balanced (approx 3x) with vacuum damage to stall but not kill Kudzu
    - type: Temperature
      heatDamage:
        types:
          Heat: 10
      coldDamage:
        types:
          Cold: 5 #per second, scales with temperature & other constants
    - type: Barotrauma
      damage:
        types:
          Blunt: 0.10 #per second, scales with pressure and other constants.
    - type: Flammable
      fireSpread: true
      damage:
       types:
         Heat: 1.5
    - type: AtmosExposed
    - type: SpeedModifierContacts
      walkSpeedModifier: 0.3
      sprintSpeedModifier: 0.3
      ignoreWhitelist:
        tags:
        - Flesh
    - type: Food # delightfully devilish !
      delay: 0.5
    - type: SolutionContainerManager
      solutions:
        food:
          reagents:
          - ReagentId: Razorium
            Quantity: 2
          - ReagentId: Protein
            Quantity: 1
    - type: Respirator
      damage:
        types:
          Asphyxiation: 0.25
      damageRecovery:
        types:
          Asphyxiation: -0.25
    - type: Tag
      tags:
      - Meat

- type: entity
  name: dark haze
  id: ShadowKudzu
  parent: [ BaseKudzu, BaseShadow ]
  components:
    - type: Physics
      canCollide: false
    - type: Occluder
    - type: Sprite
      drawdepth: Effects
      sprite: Effects/spookysmoke.rsi
      layers:
      - state: spookysmoke
        color: "#793a80dd"
        map: [base]
    - type: Kudzu
      growthTickChance: 0.2
      spreadChance: 0.99
    - type: RandomSpawner
      deleteSpawnerAfterSpawn: false
      rareChance: 0.05
      offset: 0.2
      chance: 0.45
      prototypes:
      - ShadowBasaltRandom
      rarePrototypes:
      - ShadowPortal
      - ShadowKudzuLootSpawner
    - type: Tag
      tags:
        - HideContextMenu
        - SpookyFog
    - type: OptionsVisualizer
      visuals:
        base:
        - options: Default
          data: { state: spookysmoke }
        - options: ReducedMotion
          data: { state: spookysmoke_static }

- type: entity
  name: haze
  id: ShadowKudzuWeak
  parent: ShadowKudzu
  components:
    - type: Kudzu
      spreadChance: 0 #appears during pulsation. It shouldnt spreading.
