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
This commit is contained in:
Christer2222
2025-11-07 17:59:55 +01:00
committed by GitHub
parent e881fca438
commit d6988db52a
3 changed files with 42 additions and 23 deletions
@@ -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, "<span class='notice'>You switch [src] into low detail mode.</span>")
else
high_details_mode = TRUE
to_chat(user, "<span class='notice'>You switch [src] into high detail mode.</span>")
/obj/item/plant_analyzer/pre_attack(atom/target, mob/user, params)
if(!istype(target, /obj/item))
+10 -7
View File
@@ -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, "*** <b>[myseed.plantname]</b> ***")
to_chat(user, "- Plant Age: <span class='notice'>[age]</span>")
var/next_harvest = (age <= myseed.maturation ? myseed.maturation : lastproduce) + myseed.production
to_chat(user, "- Next Harvest At: <span class='notice'>[next_harvest]</span>")
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, "<b>No plant found.</b>")
to_chat(user, "- Weed level: <span class='notice'>[weedlevel] / 10</span>")
to_chat(user, "- Pest level: <span class='notice'>[pestlevel] / 10</span>")
to_chat(user, "- Toxicity level: <span class='notice'>[toxic] / 100</span>")
if(high_details_mode)
to_chat(user, "- Weed level: <span class='notice'>[weedlevel] / 10</span>")
to_chat(user, "- Pest level: <span class='notice'>[pestlevel] / 10</span>")
to_chat(user, "- Toxicity level: <span class='notice'>[toxic] / 100</span>")
to_chat(user, "- Water level: <span class='notice'>[waterlevel] / [maxwater]</span>")
to_chat(user, "- Nutrition level: <span class='notice'>[nutrilevel] / [maxnutri]</span>")
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)
+17 -16
View File
@@ -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: <span class='warning'>UNKNOWN</span> "
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("<br>")
if(rarity)