# SPDX-FileCopyrightText: 2020 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 20kdc <asdd2808@gmail.com>
# SPDX-FileCopyrightText: 2021 AJCM-git <60196617+AJCM-git@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Metal Gear Sloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2021 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Ygg01 <y.laughing.man.y@gmail.com>
# SPDX-FileCopyrightText: 2021 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2021 mirrorcult <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Arendian <137322659+Arendian@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Ubaser <134914314+UbaserB@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Aiden <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2024 EmoGarbage404 <retron404@gmail.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2024 Moomoobeef <62638182+Moomoobeef@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aineias1 <142914808+Aineias1@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 SolsticeOfTheWinter <solsticeofthewinter@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  parent: BaseItem
  id: RehydratableItem
  abstract: true
  components:
  - type: Item
    size: Tiny
  - type: SolutionContainerManager
    solutions:
      cube:
        maxVol: 1 # needs room for water
  - type: RefillableSolution
    solution: cube
  - type: Reactive
    reactions:
    - reagents: [Water]
      methods: [Touch, Ingestion, Injection]
      effects:
      - !type:AddToSolutionReaction
        solution: cube
  - type: Rehydratable
  - type: CollisionWake
    enabled: false
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.3,-0.3,0.3,0.3"
        density: 5
        mask:
        - ItemMask
      rehydrate: # needed to react to fire extinguishers
        shape:
          !type:PhysShapeAabb
          bounds: "-0.3,-0.3,0.3,0.3"
        hard: false
        layer:
        - LowImpassable

- type: entity
  parent: RehydratableItem
  id: RehydratableAnimalCube
  description: Just add water!
  abstract: true
  components:
  - type: Sprite
    sprite: Objects/Misc/monkeycube.rsi
    state: cube
  - type: SolutionContainerManager
    solutions:
      cube:
        maxVol: 19 # needs 1u room for water
        reagents: # equals one piece of raw meat, ideally should vary depending on the animal type, but idk how to link this to biomass costs
        - ReagentId: UncookedAnimalProteins
          Quantity: 9
        - ReagentId: Fat
          Quantity: 9
  - type: Food
    solution: cube
  - type: FlavorProfile
    flavors:
    - chewy
    - horrible
    - compressed-meat
  - type: Tag
    tags:
    - Meat

- type: entity
  parent: RehydratableAnimalCube
  id: MonkeyCube
  name: monkey cube
  components:
  - type: Rehydratable
    possibleSpawns:
    - MobMonkey
  - type: Tag
    tags:
    - Meat
    - MonkeyCube

- type: entity
  parent: RehydratableAnimalCube
  id: KoboldCube
  name: kobold cube
  components:
  - type: Rehydratable
    possibleSpawns:
    - MobKobold

- type: entity
  parent: RehydratableAnimalCube
  id: CowCube
  name: cow cube
  components:
  - type: Rehydratable
    possibleSpawns:
    - MobCow

- type: entity
  parent: RehydratableAnimalCube
  id: GoatCube
  name: goat cube
  components:
  - type: Rehydratable
    possibleSpawns:
    - MobGoat

- type: entity
  parent: RehydratableAnimalCube
  id: MothroachCube
  name: mothroach cube
  components:
  - type: Rehydratable
    possibleSpawns:
    - MobMothroach

- type: entity
  parent: RehydratableAnimalCube
  id: MoproachCube
  name: moproach cube
  components:
  - type: Rehydratable
    possibleSpawns:
    - MobMoproach

- type: entity
  parent: RehydratableAnimalCube
  id: MouseCube
  name: mouse cube
  components:
  - type: Rehydratable
    possibleSpawns:
    - MobMouse

- type: entity
  parent: RehydratableAnimalCube
  id: CockroachCube
  name: cockroach cube
  description: Just add wa- OH GOD!
  components:
  - type: Rehydratable
    possibleSpawns:
    - MobCockroach

- type: entity
  parent: RehydratableAnimalCube
  id: SpaceCarpCube
  name: carp cube
  description: Just add water! At your own risk.
  components:
  - type: SolutionContainerManager
    solutions:
      cube:
        maxVol: 24 # needs 1u room for water
        reagents: # equals one piece of raw meat - plus a deadly toxin!
        - ReagentId: UncookedAnimalProteins
          Quantity: 9
        - ReagentId: Fat
          Quantity: 9
        - ReagentId: CarpoToxin
          Quantity: 5
  - type: Rehydratable
    possibleSpawns:
    - MobCarp

- type: entity
  parent: RehydratableAnimalCube
  id: SpaceTickCube
  name: tick cube
  description: Just add water! At your own risk.
  components:
  - type: Rehydratable
    possibleSpawns:
    - MobTick

- type: entity
  parent: RehydratableAnimalCube
  id: AbominationCube
  name: abomination cube
  description: Just add blood!
  components:
  - type: Reactive
    reactions:
    - reagents: [Blood]
      methods: [Touch, Ingestion, Injection]
      effects:
      - !type:AddToSolutionReaction
        solution: cube
  - type: Rehydratable
    catalyst: Blood # blood is fuel
    possibleSpawns:
    - MobAbomination

# It inherits FoodComponent from PlushieCarp, but is de-facto inedible
# PlushieCarp has requiresSpecialDigestion:true, and this one is not whitelisted anywhere, so it behaves like it's not edible
- type: entity
  parent: [PlushieCarp, RehydratableItem, BaseSyndicateContraband]
  id: DehydratedSpaceCarp
  name: dehydrated space carp
  description: Looks like a plush toy carp, but just add water and it becomes a real-life space carp!
  components:
  - type: SolutionContainerManager
    solutions:
      cube:
        maxVol: 1 # needs room for water
  - type: Fixtures # BaseItem from PlushieCarp overrides fixtures, making carp not react to extinguishers
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.3,-0.3,0.3,0.3"
        density: 5
        mask:
        - ItemMask
      rehydrate: # needed to react to fire extinguishers
        shape:
          !type:PhysShapeAabb
          bounds: "-0.3,-0.3,0.3,0.3"
        hard: false
        layer:
        - LowImpassable
  # pet fish before rehydrating and he will be nice to you
  - type: FactionException
  - type: PettableFriend
    successString: petting-success-dehydrated-carp
    failureString: petting-failure-dehydrated-carp
  - type: EmitSoundOnUse
    handle: false # have to make it inedible because this causes petting and chewing trigger together
  - type: Rehydratable
    possibleSpawns:
    - MobCarp
  - type: Tag # overwriting PlushieCarp tags to remove ClothMade and Payload
    tags:
    - PlushieCarp
  - type: GibThisGuy  # Goobstation
    requireBoth: true
    icNames:
    - Audrey White
    ocNames:
    - Rosef

- type: entity
  parent: MonkeyCube
  id: SyndicateSponge
  suffix: Syndicate
  components:
  - type: Rehydratable
    possibleSpawns:
    - MobCarpHolo
    - MobAngryBee
    - MobAdultSlimesYellowAngry
    - MobSpiderSpace
    - MobBearSpace
    - MobPurpleSnake
    - MobKangarooSpace
    - MobTick

- type: entity
  parent: RehydratableItem
  id: MopBucketCube
  name: mop bucket cube
  description: Just add water! And then more water!
  components:
  - type: Sprite
    sprite: Objects/Specific/Janitorial/janitorial.rsi
    state: mopbucket_cube
  - type: Rehydratable
    possibleSpawns:
    - MopBucket
