Skip to content

Commit

Permalink
Self sustaining plants grow without nutrients
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertNanotracen committed Mar 6, 2024
1 parent 50444f7 commit b74024f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 6 additions & 5 deletions code/modules/hydroponics/hydroponics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,13 @@
myseed.forceMove(src)

update_appearance()
if((world.time > (lastcycle + cycledelay) && waterlevel > 10 && reagents.total_volume > 2 && pestlevel < 10 && weedlevel < 10) || bio_boosted)
if((world.time > (lastcycle + cycledelay) && waterlevel > 10 && (reagents.total_volume > 2 || self_sustaining) && pestlevel < 10 && weedlevel < 10) || bio_boosted)
lastcycle = world.time
if(myseed && plant_status != HYDROTRAY_PLANT_DEAD)
// Advance age
age++
var/growth_mult = (1.01 ** -myseed.maturation)
if(!(age > max(myseed.maturation, myseed.production)/* Fuck Corpse Flowers */ && (growth >= myseed.harvest_age * growth_mult) && self_sustaining))
age++

needs_update = TRUE
growth += 3
Expand All @@ -270,9 +272,9 @@
apply_chemicals(lastuser?.resolve())
// Nutrients deplete slowly
if(bio_boosted)
adjust_plant_nutriments((reagents.total_volume * ((nutriment_drain_precent * 0.2) * 0.01)))
adjust_plant_nutriments(max(reagents.total_volume * ((nutriment_drain_precent * 0.2) * 0.01), 0.05))
else
adjust_plant_nutriments((reagents.total_volume * (nutriment_drain_precent * 0.01)))
adjust_plant_nutriments(max(reagents.total_volume * (nutriment_drain_precent * 0.01), 0.05))

/**
* Photosynthesis
Expand Down Expand Up @@ -367,7 +369,6 @@
if(age > (myseed.lifespan - repeated_harvest))
adjust_plant_health(-rand(1,5) / rating)

var/growth_mult = (1.01 ** -myseed.maturation)
// Harvest code
if(growth >= myseed.harvest_age * growth_mult)
//if(myseed.harvest_age < age * max(myseed.production * 0.044, 0.5) && (myseed.harvest_age) < (age - lastproduce) * max(myseed.production * 0.044, 0.5) && (!harvest && !dead))
Expand Down
3 changes: 3 additions & 0 deletions monkestation/code/modules/hydroponics/seeds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
for(var/g in genes)
var/datum/plant_gene/G = g
S.genes += G.Copy()

for(var/datum/plant_gene/trait/traits in S.genes)
traits.on_new_seed(S)
// Copy all the stats
S.set_lifespan(lifespan)
S.set_endurance(endurance)
Expand Down

0 comments on commit b74024f

Please sign in to comment.