diff --git a/code/game/machinery/hydroponics.dm b/code/game/machinery/hydroponics.dm
index 099655c37d9..7c3f955974c 100644
--- a/code/game/machinery/hydroponics.dm
+++ b/code/game/machinery/hydroponics.dm
@@ -119,7 +119,7 @@
/obj/machinery/portable_atmospherics/hydroponics/bullet_act(var/obj/item/projectile/Proj)
//Don't act on seeds like dionaea that shouldn't change.
- if(seed && seed.immutable)
+ if(seed && seed.immutable > 0)
return
//Override for somatoray projectiles.
@@ -169,6 +169,11 @@
// Advance plant age.
if(prob(25)) age += 1 * HYDRO_SPEED_MULTIPLIER
+ //Highly mutable plants have a chance of mutating every tick.
+ if(seed.immutable == -1)
+ var/mut_prob = rand(1,100)
+ if(mut_prob <= 5) mutate(mut_prob == 1 ? 2 : 1)
+
// Maintain tray nutrient and water levels.
if(seed.nutrient_consumption > 0 && nutrilevel > 0 && prob(25))
nutrilevel -= max(0,seed.nutrient_consumption * HYDRO_SPEED_MULTIPLIER)
@@ -196,10 +201,23 @@
// If atmos input is not there, grab from turf.
if(!environment)
if(istype(T))
- environment = T.return_air()
- if(!environment) //We're in a crate or nullspace, bail out.
+ environment = T.air
+ if(!environment)
return
+ // Handle gas consumption.
+ if(seed.consume_gasses && seed.consume_gasses.len)
+ var/missing_gas = 0
+ for(var/gas in seed.consume_gasses)
+ if(environment && environment.gas && environment.gas[gas] && \
+ environment.gas[gas] >= seed.consume_gasses[gas])
+ environment.adjust_gas(gas,-seed.consume_gasses[gas],1)
+ else
+ missing_gas++
+
+ if(missing_gas > 0)
+ health -= missing_gas * HYDRO_SPEED_MULTIPLIER
+
// Process it.
var/pressure = environment.return_pressure()
if(pressure < seed.lowkpa_tolerance || pressure > seed.highkpa_tolerance)
@@ -208,6 +226,13 @@
if(abs(environment.temperature - seed.ideal_heat) > seed.heat_tolerance)
health -= healthmod
+ // Handle gas production.
+ if(seed.exude_gasses && seed.exude_gasses.len)
+ var/datum/gas_mixture/exuded = new
+ for(var/gas in seed.exude_gasses)
+ exuded.adjust_gas(gas,seed.exude_gasses[gas*seed.potency],1) //This will need adjustment since it produces moles.
+ loc.assume_air(exuded)
+
// Handle light requirements.
var/area/A = T.loc
if(A)
@@ -257,13 +282,14 @@
pestlevel = 0
// If enough time (in cycles, not ticks) has passed since the plant was harvested, we're ready to harvest again.
- else if(age > seed.production && (age - lastproduce) > seed.production && (!harvest && !dead))
+ else if(seed.products && seed.products.len && age > seed.production && \
+ (age - lastproduce) > seed.production && (!harvest && !dead))
+
harvest = 1
lastproduce = age
if(prob(5)) // On each tick, there's a 5 percent chance the pest population will increase
pestlevel += 1 * HYDRO_SPEED_MULTIPLIER
-
check_level_sanity()
update_icon()
return
@@ -757,7 +783,30 @@
usr << "[src] is \red filled with weeds!"
if(pestlevel >= 5)
usr << "[src] is \red filled with tiny worms!"
- usr << text ("")
+ if(!istype(src,/obj/machinery/portable_atmospherics/hydroponics/soil))
+
+ var/turf/T = loc
+ var/datum/gas_mixture/environment
+
+ if(closed_system && (connected_port || holding))
+ environment = air_contents
+
+ if(!environment)
+ if(istype(T))
+ environment = T.return_air()
+
+ if(!environment) //We're in a crate or nullspace, bail out.
+ return
+
+ var/area/A = T.loc
+ var/light_available
+ if(A)
+ if(A.lighting_use_dynamic)
+ light_available = max(0,min(10,T.lighting_lumcount)-5)
+ else
+ light_available = 5
+
+ usr << "The tray's sensor suite is reporting a light level of [light_available] lumens and a temperature of [environment.temperature]K."
/obj/machinery/portable_atmospherics/hydroponics/verb/close_lid()
set name = "Toggle Tray Lid"
diff --git a/code/modules/hydroponics/hydro_tools.dm b/code/modules/hydroponics/hydro_tools.dm
index 8a435ef88d4..82e0ca33eee 100644
--- a/code/modules/hydroponics/hydro_tools.dm
+++ b/code/modules/hydroponics/hydro_tools.dm
@@ -71,7 +71,9 @@
if(grown_seed.harvest_repeat)
dat += "This plant can be harvested repeatedly.
"
- if(grown_seed.immutable)
+ if(grown_seed.immutable == -1)
+ dat += "This plant is highly mutable.
"
+ else if(grown_seed.immutable > 0)
dat += "This plant does not possess genetics that are alterable.
"
if(grown_seed.products && grown_seed.products.len)
diff --git a/code/modules/hydroponics/seed_datums.dm b/code/modules/hydroponics/seed_datums.dm
index 1a30949ca3a..fa5af7c78c7 100644
--- a/code/modules/hydroponics/seed_datums.dm
+++ b/code/modules/hydroponics/seed_datums.dm
@@ -83,7 +83,7 @@ proc/populate_seed_list()
var/spread = 0 // 0 limits plant to tray, 1 = creepers, 2 = vines.
var/carnivorous = 0 // 0 = none, 1 = eat pests in tray, 2 = eat living things (when a vine).
var/parasite = 0 // 0 = no, 1 = gain health from weed level.
- var/immutable // If set, plant will never mutate.
+ var/immutable = 0 // If set, plant will never mutate. If -1, plant has a chance of mutating during process().
var/alter_temp // If set, the plant will periodically alter local temp by this amount.
// Cosmetics.
@@ -99,13 +99,13 @@ proc/populate_seed_list()
//Returns a key corresponding to an entry in the global seed list.
/datum/seed/proc/get_mutant_variant()
- if(!mutants || !mutants.len || immutable) return 0
+ if(!mutants || !mutants.len || immutable > 0) return 0
return pick(mutants)
//Mutates the plant overall (randomly).
/datum/seed/proc/mutate(var/degree,var/turf/source_turf)
- if(!degree || immutable) return
+ if(!degree || immutable > 0) return
source_turf.visible_message("\blue \The [display_name] quivers!")
@@ -179,7 +179,7 @@ proc/populate_seed_list()
//Mutates a specific trait/set of traits.
/datum/seed/proc/apply_gene(var/datum/plantgene/gene)
- if(!gene || !gene.values || immutable) return
+ if(!gene || !gene.values || immutable > 0) return
switch(gene.genetype)
@@ -209,11 +209,12 @@ proc/populate_seed_list()
else
chems[rid] = gene.values[2][rid]
- //TODO.
- //if(!exude_gasses) exude_gasses = list()
- //exude_gasses |= gene.values[3]
- //for(var/gas in exude_gasses)
- // exude_gasses[gas] = max(1,round(exude_gasses[gas]/2))
+ var/list/new_gasses = gene.values[3]
+ if(istype(new_gasses))
+ if(!exude_gasses) exude_gasses = list()
+ exude_gasses |= new_gasses
+ for(var/gas in exude_gasses)
+ exude_gasses[gas] = max(1,round(exude_gasses[gas]*0.8))
alter_temp = gene.values[4]
potency = gene.values[5]
@@ -348,7 +349,6 @@ proc/populate_seed_list()
if(!user)
return
- //TODO: check for failing to harvest.
var/got_product
if(!isnull(products) && products.len && yield > 0)
got_product = 1
@@ -389,7 +389,6 @@ proc/populate_seed_list()
handle_living_product(product)
// Make sure the product is inheriting the correct seed type reference.
- // TODO: can this be collapsed into one type check since they share vars?
else if(istype(product,/obj/item/weapon/reagent_containers/food/snacks/grown))
var/obj/item/weapon/reagent_containers/food/snacks/grown/current_product = product
current_product.plantname = name
@@ -403,7 +402,7 @@ proc/populate_seed_list()
// be put into the global datum list until the product is harvested, though.
/datum/seed/proc/diverge(var/modified)
- if(immutable) return
+ if(immutable > 0) return
//Set up some basic information.
var/datum/seed/new_seed = new
@@ -1170,6 +1169,7 @@ proc/populate_seed_list()
yield = -1
potency = -1
growth_stages = 4
+ immutable = -1
/datum/seed/whitebeets
name = "whitebeet"
diff --git a/code/modules/hydroponics/seed_machines.dm b/code/modules/hydroponics/seed_machines.dm
index e1cf0dfaccc..837abe7211a 100644
--- a/code/modules/hydroponics/seed_machines.dm
+++ b/code/modules/hydroponics/seed_machines.dm
@@ -88,7 +88,7 @@
user << "There is already a seed loaded."
var/obj/item/seeds/S =W
- if(S.seed && S.seed.immutable)
+ if(S.seed && S.seed.immutable > 0)
user << "That seed is not compatible with our genetics technology."
else
user.drop_item(W)