diff --git a/code/modules/hydroponics/hydroitemdefines.dm b/code/modules/hydroponics/hydroitemdefines.dm
index abf6632939..030a8689a9 100644
--- a/code/modules/hydroponics/hydroitemdefines.dm
+++ b/code/modules/hydroponics/hydroitemdefines.dm
@@ -1,15 +1,35 @@
// Plant analyzer
/obj/item/plant_analyzer
name = "plant analyzer"
- desc = "A scanner used to evaluate a plant's various areas of growth."
+ desc = "A scanner used to evaluate a plant's various areas of growth, and genetic traits."
icon = 'icons/obj/device.dmi'
icon_state = "hydro"
- item_state = "analyzer"
+ inhand_icon_state = "analyzer"
+ worn_icon_state = "plantanalyzer"
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
w_class = WEIGHT_CLASS_TINY
slot_flags = ITEM_SLOT_BELT
custom_materials = list(/datum/material/iron=30, /datum/material/glass=20)
+ var/scan_mode = PLANT_SCANMODE_STATS
+
+/obj/item/plant_analyzer/attack_self(mob/user)
+ . = ..()
+ scan_mode = !scan_mode
+ to_chat(user, "You switch [src] to [scan_mode == PLANT_SCANMODE_CHEMICALS ? "scan for chemical reagents and traits" : "scan for plant growth statistics"].")
+
+/obj/item/plant_analyzer/attack(mob/living/M, mob/living/carbon/human/user)
+ //Checks if target is a podman
+ if(ispodperson(M))
+ user.visible_message("[user] analyzes [M]'s vitals.", \
+ "You analyze [M]'s vitals.")
+ if(scan_mode== PLANT_SCANMODE_STATS)
+ healthscan(user, M, advanced = TRUE)
+ else
+ chemscan(user, M)
+ add_fingerprint(user)
+ return
+ return ..()
// *************************************
// Hydroponics Tools
@@ -192,4 +212,4 @@
/obj/item/reagent_containers/glass/bottle/killer/pestkiller
name = "bottle of pest spray"
desc = "Contains a pesticide."
- list_reagents = list(/datum/reagent/toxin/pestkiller = 50)
\ No newline at end of file
+ list_reagents = list(/datum/reagent/toxin/pestkiller = 50)
diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm
index 77f5884347..008fd9a88d 100644
--- a/code/modules/hydroponics/hydroponics.dm
+++ b/code/modules/hydroponics/hydroponics.dm
@@ -16,16 +16,17 @@
var/mutmod = 1 //Nutriment's effect on mutations
var/toxic = 0 //Toxicity in the tray?
var/age = 0 //Current age
- var/dead = 0 //Is it dead?
+ var/dead = FALSE //Is it dead?
var/plant_health //Its health
var/lastproduce = 0 //Last time it was harvested
var/lastcycle = 0 //Used for timing of cycles.
var/cycledelay = 200 //About 10 seconds / cycle
- var/harvest = 0 //Ready to harvest?
+ var/harvest = FALSE //Ready to harvest?
var/obj/item/seeds/myseed = null //The currently planted seed
var/rating = 1
- var/unwrenchable = 1
+ var/unwrenchable = TRUE
var/recent_bee_visit = FALSE //Have we been visited by a bee recently, so bees dont overpollinate one plant
+ var/mob/lastuser //Last user to add reagents to a tray. Mostly for logging.
var/self_sufficiency_req = 20 //Required total dose to make a self-sufficient hydro tray. 1:1 with earthsblood.
var/self_sufficiency_progress = 0
var/self_sustaining = FALSE //If the tray generates nutrients and water on its own
@@ -465,7 +466,8 @@
var/target = myseed ? myseed.plantname : src
var/visi_msg = ""
var/transfer_amount
- if(istype(reagent_source, /obj/item/reagent_containers/food/snacks) || istype(reagent_source, /obj/item/reagent_containers/pill))
+
+ if(istype(reagent_source, /obj/item/reagent_containers/food/snacks) || istype(reagent_source, /obj/item/reagent_containers/pill))
if(istype(reagent_source, /obj/item/reagent_containers/food/snacks))
var/obj/item/reagent_containers/food/snacks/R = reagent_source
if (R.trash)
diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm
index 2a0b19a3a6..92b7fd6149 100644
--- a/code/modules/hydroponics/seeds.dm
+++ b/code/modules/hydroponics/seeds.dm
@@ -63,6 +63,7 @@
genes += new /datum/plant_gene/core/production(production)
if(potency != -1)
genes += new /datum/plant_gene/core/potency(potency)
+ genes += new /datum/plant_gene/core/instability(instability)
for(var/p in genes)
if(ispath(p))
@@ -128,7 +129,7 @@ obj/item/seeds/proc/is_gene_forbidden(typepath)
if(g)
g.mutability_flags &= ~mutability
-/obj/item/seeds/proc/mutate(lifemut = 2, endmut = 5, productmut = 1, yieldmut = 2, potmut = 25, wrmut = 2, wcmut = 5, traitmut = 0)
+/obj/item/seeds/proc/mutate(lifemut = 2, endmut = 5, productmut = 1, yieldmut = 2, potmut = 25, wrmut = 2, wcmut = 5, traitmut = 0, stabmut = 3)
adjust_lifespan(rand(-lifemut,lifemut))
adjust_endurance(rand(-endmut,endmut))
adjust_production(rand(-productmut,productmut))
@@ -174,11 +175,17 @@ obj/item/seeds/proc/is_gene_forbidden(typepath)
/obj/item/seeds/proc/harvest(mob/user)
+ ///Reference to the tray/soil the seeds are planted in.
var/obj/machinery/hydroponics/parent = loc //for ease of access
+ ///Count used for creating the correct amount of results to the harvest.
var/t_amount = 0
+ ///List of plants all harvested from the same batch.
var/list/result = list()
+ ///Tile of the harvester to deposit the growables.
var/output_loc = parent.Adjacent(user) ? user.loc : parent.loc //needed for TK
+ ///Name of the grown products.
var/product_name
+ ///The Number of products produced by the plant, typically the yield. Modified by Densified Chemicals.
var/product_count = getYield()
while(t_amount < product_count)
var/obj/item/reagent_containers/food/snacks/grown/t_prod