From d6988db52aacecf7675dcdc11fb1edeaa3cc87c2 Mon Sep 17 00:00:00 2001 From: Christer2222 <25958019+Christer2222@users.noreply.github.com> Date: Fri, 7 Nov 2025 17:59:55 +0100 Subject: [PATCH] Adds a 'low details' mode to plant analyzers (#30793) * adds low details mode to plant analyzer * added water and nutrition to low details * lint * grammar * autodoc --- code/modules/hydroponics/hydroitemdefines.dm | 15 +++++++++ code/modules/hydroponics/hydroponics_tray.dm | 17 +++++----- code/modules/hydroponics/seeds.dm | 33 ++++++++++---------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/code/modules/hydroponics/hydroitemdefines.dm b/code/modules/hydroponics/hydroitemdefines.dm index b16c38cf817..d88f8568ac0 100644 --- a/code/modules/hydroponics/hydroitemdefines.dm +++ b/code/modules/hydroponics/hydroitemdefines.dm @@ -9,6 +9,21 @@ slot_flags = ITEM_SLOT_BELT origin_tech = "magnets=2;biotech=2" materials = list(MAT_METAL = 210, MAT_GLASS = 40) + new_attack_chain = TRUE + + /// Shows plant stats when true, shows only basic info when set to false + var/high_details_mode = TRUE + +/obj/item/plant_analyzer/activate_self(mob/user) + if(..()) + return + + if(high_details_mode) + high_details_mode = FALSE + to_chat(user, "You switch [src] into low detail mode.") + else + high_details_mode = TRUE + to_chat(user, "You switch [src] into high detail mode.") /obj/item/plant_analyzer/pre_attack(atom/target, mob/user, params) if(!istype(target, /obj/item)) diff --git a/code/modules/hydroponics/hydroponics_tray.dm b/code/modules/hydroponics/hydroponics_tray.dm index d2b94ba4051..b08dbadebdd 100644 --- a/code/modules/hydroponics/hydroponics_tray.dm +++ b/code/modules/hydroponics/hydroponics_tray.dm @@ -847,7 +847,8 @@ return ITEM_INTERACT_COMPLETE else if(istype(used, /obj/item/plant_analyzer)) - send_plant_details(user) + var/obj/item/plant_analyzer/p = used + send_plant_details(user, p.high_details_mode) return ITEM_INTERACT_COMPLETE else if(istype(used, /obj/item/cultivator)) @@ -1071,20 +1072,22 @@ reagent_source.update_icon() -/obj/machinery/hydroponics/proc/send_plant_details(mob/user) +/obj/machinery/hydroponics/proc/send_plant_details(mob/user, high_details_mode) if(myseed) to_chat(user, "*** [myseed.plantname] ***") to_chat(user, "- Plant Age: [age]") var/next_harvest = (age <= myseed.maturation ? myseed.maturation : lastproduce) + myseed.production to_chat(user, "- Next Harvest At: [next_harvest]") - var/list/text_string = myseed.get_analyzer_text() + var/list/text_string = myseed.get_analyzer_text(TRUE, high_details_mode) if(text_string) to_chat(user, text_string) else to_chat(user, "No plant found.") - to_chat(user, "- Weed level: [weedlevel] / 10") - to_chat(user, "- Pest level: [pestlevel] / 10") - to_chat(user, "- Toxicity level: [toxic] / 100") + if(high_details_mode) + to_chat(user, "- Weed level: [weedlevel] / 10") + to_chat(user, "- Pest level: [pestlevel] / 10") + to_chat(user, "- Toxicity level: [toxic] / 100") + to_chat(user, "- Water level: [waterlevel] / [maxwater]") to_chat(user, "- Nutrition level: [nutrilevel] / [maxnutri]") if(self_sustaining) @@ -1114,7 +1117,7 @@ if(!istype(user)) // Make sure user is actually an observer. Revenents also use attack_ghost, but do not have the toggle plant analyzer var. return if(user.ghost_flags & GHOST_PLANT_ANALYZER) - send_plant_details(user) + send_plant_details(user, TRUE) /obj/machinery/hydroponics/rad_act(atom/source, amount, emission_type) if(!myseed) diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm index 6081c266c37..4b5e820d986 100644 --- a/code/modules/hydroponics/seeds.dm +++ b/code/modules/hydroponics/seeds.dm @@ -351,7 +351,7 @@ C.value = weed_chance -/obj/item/seeds/proc/get_analyzer_text(show_detail = TRUE) // In case seeds have something special to tell to the analyzer +/obj/item/seeds/proc/get_analyzer_text(show_detail = TRUE, high_details_mode = TRUE) // In case seeds have something special to tell to the analyzer var/list/text = list() if(show_detail) if(!get_gene(/datum/plant_gene/trait/plant_type/weed_hardy) && !get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism) && !get_gene(/datum/plant_gene/trait/plant_type/alien_properties)) @@ -362,21 +362,22 @@ text += "- Plant type: Mushroom. Can grow in dry soil." if(get_gene(/datum/plant_gene/trait/plant_type/alien_properties)) text += "- Plant type: UNKNOWN " - if(potency != -1) - text += "- Potency: [potency]" - if(yield != -1) - var/obj/machinery/hydroponics/tray = loc - if(istype(tray) && tray.yield_beamed) - text += "- Yield: [yield] (+1-3 from somatoray)" - else - text += "- Yield: [yield]" - text += "- Maturation speed: [maturation]" - if(yield != -1) - text += "- Production speed: [production]" - text += "- Endurance: [endurance]" - text += "- Lifespan: [lifespan]" - text += "- Weed Growth Rate: [weed_rate]" - text += "- Weed Vulnerability: [weed_chance]" + if(high_details_mode) + if(potency != -1) + text += "- Potency: [potency]" + if(yield != -1) + var/obj/machinery/hydroponics/tray = loc + if(istype(tray) && tray.yield_beamed) + text += "- Yield: [yield] (+1-3 from somatoray)" + else + text += "- Yield: [yield]" + text += "- Maturation speed: [maturation]" + if(yield != -1) + text += "- Production speed: [production]" + text += "- Endurance: [endurance]" + text += "- Lifespan: [lifespan]" + text += "- Weed Growth Rate: [weed_rate]" + text += "- Weed Vulnerability: [weed_chance]" if(!show_detail) return text.Join("
") if(rarity)