Files
Krysonism def17fd90a Rare Earths! Advanced soils for botany. (#92513)
## About The Pull Request

This PR adds 4 new types of soil and a holder item; the soil sack, to
contain and transport said soils.

<img width="496" height="378" alt="bild"
src="https://github.com/user-attachments/assets/57f42a9c-c731-4195-91df-b4456ec45e7b"
/>

Two of the new soils + the regular old soil are available in the premium
section of the nutrimax.

All 5 soil types are available from cargo. 

It also adds two new plant traits; soil lover and semiaquatic, that
allows coders to confer maluses to plants growing in trays or soil
respectively.

Potatoes, sweet potatoes, carrots, parsnips, cahn'roots, white and red
beets currently have soil lover, reducing their produced yield by 30%
and their potency randomly between 20-80% if grown hydroponically.

Rice has semiaquatic which increases the amount of weeds gained by 50%
if grown in soil rather than hydroponically.

## Advanced soil types

### Vermaculite
  #### Stats
    Max Nutrients: 20u
    Max Water: 150u 
  
  #### Special Effects
Multigraft: Up to 3 grafts can be cut from a plant planted in
vermaculite.
Graft Medium: Graft cuttiongs can be directly placed into vermaculite to
create a new plant vegetatively.

### Hydrogel Beads
  #### Stats
    Max Nutrients: 15u
    Max Water: 300u
  
  #### Special Effects
Hydroponic + Soil: Both water loving and soil loving plants can grow
without maluses.
    Super Water: Water consumption rate is decreased by 50%

### Korta Coir
  #### Stats
    Max Nutrients: 20u
    Max Water: 100u
  
  #### Special Effects
Fast Mushrooms: Mushrooms mature(and age) 40% faster if planted in this
soil.

### Worm Castings 
  #### Stats
    Max Nutrients = 35u
    Max Water = 200u
  
  #### Special Effects
Slow Release: If the nutrients run out, 1u nitrogen will be
automatically added to the nutient pool.
Worm Habitat: Composting veggies in this soil has a chance to produce an
extra slimy worm.

### Soil Sacks

Use them on the floor to place a soil at that location. 

You can reverse this process by right clicking a soil with a shovel.

The sacks are huge items that deals stamina damage, but have slowdown
when carried.

They can be wielded to remove slowdown, double the damage output and
gain 25% block chance.

They have unique normal and wielded inhands for each sack type.

#### Price List

**Soil**
  Nutrimax: 50 cr
  Cargo: 400 cr /  5 sacks

**Vermaculite**
  Nutrimax: 100 cr
  Cargo: 400 cr / 3 sacks

**Hydrogel**
  Nutrimax: 100 cr
  Cargo: 400 cr / 3 sacks

**Coir**
  Nutrimax: N/A
  Cargo: 600 cr / 3 sacks

**Worm Castings**
  Nutrimax: N/A
  Cargo: 800 cr / 3 sacks

#### Misc Soil Changes

Soil now have a new armour type and are generally much harder to destroy
by shooting or bashing them.

Fixed a bug where weeds would instantly reduce yield to 3 instead of
lowering it by 1-2 per cycle.

## Why It's Good For The Game

I have long been a fan of using soils in botany, they are the cheapest
and easiest way to make new trays and enable many interesting
strategies.

The default soil is fine for what is but it kinda sucks, not only having
low stats but also missing autogrow, a feature botanist have grown
completely addicted and dependent on.

When self sustaining trays were removed and autogrow added, it was
intended as a way to keep a couple of plants alive while you ran out to
do errands or grab a drink.

However, the feature has devolved into basically a shift start self
sustaining for all your trays and standard practice is using it on every
single tray that currently is not trying to mutate.

This has resulted in certain core botany mechanics like water and pests
being made totally irrelevant, shrinking design space a lot.

Rather than just reaching for the stick, I thought it would be fun to
instead offer them a carrot in the form of an expanded toolset of soils
with unique effects that cannot be replicated by trays.

These new soils offer niche benefits that enable advanced botany
gameplay and provides a framwork for deepening plant / tray interactions
in the furture.

## Changelog

🆑
add: Added 4 new types of soil
add: Added soils sacks to the nutrimax
add: Added soil sack crates to cargo.
balance: Soil now has higher armor values.
balance: Rice now gets more weeds if grown in soil.
balance: Carrots, potatoes, beets and their mutations now get reduced
yield and potency if grown hydroponically.
fix: Weed overgrowth no longer instantly sets yield to 3.
/🆑
2025-10-04 05:01:26 +02:00

107 lines
6.3 KiB
Plaintext

/**
* A test to make sure harvesting plants in hydroponics results in the correct number of plants with the correct chemicals inside of it.
*
* We plant a seed into a tray and harvest it with a human.
* This seed is set to have the maximum potency and yield with no instability to prevent mutations.
* Then we check how many products we got from the harvest. For most plants, this should be 10 products, as we have a yield of 10.
* Alternatively, if the plant has a trait that halves the products on harvest, it should result in 5 products.
*
* After we harvest our seed, we check for the plant's nutriments and vitamins.
* Most plants have nutriments, so most plants should result in a number of nutriments.
* Some plants have vitamins and some don't, so we then check the number of vitamins.
* Additionally, the plant may have traits that double the amount of chemicals it can hold. We check the max volume in that case and adjust accordingly.
* Plants may have additional chemicals genes that we don't check.
* Plants may have traits that effect the final product's contents that we don't check.
* Chemicals may react inside of the plant on harvest, which we don't check.
*
* After we check the harvest and the chemicals in the harvest, we go ahead and clean up the harvested products and remove the seed if it has perennial growth.
*
* This test checks both /obj/item/food/grown items and /obj/item/grown items since, despite both being used in hydroponics,
* they aren't the same type so everything that works with one isn't guaranteed to work with the other.
*/
/datum/unit_test/hydroponics_harvest/Run()
var/obj/machinery/hydroponics/soil/testing_soil = allocate(/obj/machinery/hydroponics/soil)
var/obj/item/seeds/planted_food_seed = allocate(/obj/item/seeds/apple) //grown food
var/obj/item/seeds/planted_not_food_seed = allocate(/obj/item/seeds/sunflower) //grown inedible
var/obj/item/seeds/planted_densified_seed = allocate(/obj/item/seeds/redbeet) //grown + densified chemicals
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
testing_soil.forceMove(run_loc_floor_bottom_left)
var/nearby_loc = locate((run_loc_floor_bottom_left.x + 1), run_loc_floor_bottom_left.y, run_loc_floor_bottom_left.z)
human.forceMove(nearby_loc)
var/seeds_loc = locate((run_loc_floor_bottom_left.x + 1), (run_loc_floor_bottom_left.y + 1), run_loc_floor_bottom_left.z)
planted_food_seed.forceMove(seeds_loc)
planted_not_food_seed.forceMove(seeds_loc)
planted_densified_seed.forceMove(seeds_loc)
// Apples should harvest 10 apples with 10u nutrients and 4u vitamins.
test_seed(testing_soil, planted_food_seed, human)
// Sunflowers should harvest 10 sunflowers with 4u nutriment and 0u vitamins. It should also have 8u oil.
test_seed(testing_soil, planted_not_food_seed, human)
// Redbeets should harvest 5 beets (10 / 2) with 10u nutriments (5 x 2) and 10u vitamins (5 x 2) thanks to densified chemicals.
test_seed(testing_soil, planted_densified_seed, human)
/datum/unit_test/hydroponics_harvest/proc/plant_and_update_seed(obj/machinery/hydroponics/tray, obj/item/seeds/seed)
seed.set_yield(10) // Sets the seed yield to 10. This gets clamped to 5 if the plant has traits to half the yield.
seed.set_potency(100) // Sets the seed potency to 100.
seed.set_instability(0) // Sets the seed instability to 0, to prevent mutations.
tray.set_seed(seed)
seed.forceMove(tray)
tray.name = tray.myseed ? "[initial(tray.name)] ([tray.myseed.plantname])" : initial(tray.name)
tray.set_plant_health(seed.endurance)
tray.age = 20
tray.set_plant_status(HYDROTRAY_PLANT_HARVESTABLE)
/datum/unit_test/hydroponics_harvest/proc/test_seed(obj/machinery/hydroponics/tray, obj/item/seeds/seed, mob/living/carbon/user)
tray.reagents.add_reagent(/datum/reagent/plantnutriment/eznutriment, 20)
plant_and_update_seed(tray, seed)
var/saved_name = tray.name // Name gets cleared when some plants are harvested.
if(!tray.myseed)
TEST_FAIL("Hydroponics harvest from [saved_name] had no seed set properly to test.")
if(tray.myseed != seed)
TEST_FAIL("Hydroponics harvest from [saved_name] had [tray.myseed] planted when it was testing [seed].")
var/double_chemicals = seed.get_gene(/datum/plant_gene/trait/maxchem)
var/expected_yield = seed.getYield()
var/max_volume = 100 //For 99% of plants, max volume is 100.
if(double_chemicals)
max_volume *= 2
tray.attack_hand(user)
var/list/obj/item/all_harvested_items = list()
for(var/obj/item/harvested_food in user.drop_location())
all_harvested_items += harvested_food
if(!all_harvested_items.len)
TEST_FAIL("Hydroponics harvest from [saved_name] resulted in 0 harvest.")
TEST_ASSERT_EQUAL(all_harvested_items.len, expected_yield, "Hydroponics harvest from [saved_name] only harvested [all_harvested_items.len] items instead of [expected_yield] items.")
TEST_ASSERT(all_harvested_items[1].reagents, "Hydroponics harvest from [saved_name] had no reagent container.")
TEST_ASSERT_EQUAL(all_harvested_items[1].reagents.maximum_volume, max_volume, "Hydroponics harvest from [saved_name] [double_chemicals ? "did not have its reagent capacity doubled to [max_volume] properly." : "did not have its reagents capped at [max_volume] properly."]")
var/expected_nutriments = seed.reagents_add[/datum/reagent/consumable/nutriment]
var/expected_vitamins = seed.reagents_add[/datum/reagent/consumable/nutriment/vitamin]
var/found_nutriments = all_harvested_items[1].reagents.get_reagent_amount(/datum/reagent/consumable/nutriment)
var/found_vitamins = all_harvested_items[1].reagents.get_reagent_amount(/datum/reagent/consumable/nutriment/vitamin)
QDEL_LIST(all_harvested_items) //We got everything we needed from our harvest, we can clean it up.
TEST_ASSERT_EQUAL(found_nutriments, expected_nutriments * max_volume, "Hydroponics harvest from [saved_name] has a [expected_nutriments] nutriment gene (expecting [expected_nutriments * max_volume]) but only had [found_nutriments] units of nutriment inside.")
TEST_ASSERT_EQUAL(found_vitamins, expected_vitamins * max_volume, "Hydroponics harvest from [saved_name] has a [expected_vitamins] vitamin gene (expecting [expected_vitamins * max_volume]) but only had [found_vitamins] units of vitamins inside.")
if(tray.myseed)
tray.age = 0
tray.set_plant_health(0)
tray.set_seed(null)
tray.name = tray.myseed ? "[initial(tray.name)] ([tray.myseed.plantname])" : initial(tray.name)