From 075b2d3ccffede25d133a5c223e25ae9cf1e70aa Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Tue, 31 Jan 2023 03:07:43 +0100 Subject: [PATCH] [MIRROR] Shuffles around the reagent scan readout to display as empty when only invisible reagents are present [MDB IGNORE] (#19033) Shuffles around the reagent scan readout to display as empty when only invisible reagents are present (#72915) ## About The Pull Request Formerly, the reagent scan would provide a header based on whether or not reagents are present in a person's blood/stomach. This works, until you get cases where a user only has invisible reagents in their system, in which case the "Subject contains the following reagents" header would appear, but no chemical readouts would be present. The blood/stomach reagent readouts on the scanner now put their contents into a separate list, before adding it to the master readout list. This alternate list is checked for length, rather than whether or not the user has any reagents in their system at all, to determine what readout header to give. If there are no reagent readouts to provide, the scanner will report as if there is nothing present. In summary: If you have only invisible reagents in your system, the health scanner will provide the same readout as if you had nothing in you at all. ## Why It's Good For The Game Closes #72311. ## Changelog :cl: Rhials fix: The chemical scanner will now properly display that "no" reagents are present in a subject when only invisible reagents are present. /:cl: Co-authored-by: Rhials --- .../items/devices/scanners/health_analyzer.dm | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/code/game/objects/items/devices/scanners/health_analyzer.dm b/code/game/objects/items/devices/scanners/health_analyzer.dm index 1230fb23db7..0f87ed0627d 100644 --- a/code/game/objects/items/devices/scanners/health_analyzer.dm +++ b/code/game/objects/items/devices/scanners/health_analyzer.dm @@ -395,36 +395,44 @@ return if(istype(target) && target.reagents) - var/render_list = list() + var/list/render_list = list() //The master list of readouts, including reagents in the blood/stomach, addictions, quirks, etc. + var/list/render_block = list() //A second block of readout strings. If this ends up empty after checking stomach/blood contents, we give the "empty" header. // Blood reagents if(target.reagents.reagent_list.len) - render_list += "Subject contains the following reagents in their blood:\n" for(var/r in target.reagents.reagent_list) var/datum/reagent/reagent = r if(reagent.chemical_flags & REAGENT_INVISIBLE) //Don't show hidden chems on scanners continue - render_list += "[round(reagent.volume, 0.001)] units of [reagent.name][reagent.overdosed ? " - [span_boldannounce("OVERDOSING")]" : "."]\n" - else + render_block += "[round(reagent.volume, 0.001)] units of [reagent.name][reagent.overdosed ? " - [span_boldannounce("OVERDOSING")]" : "."]\n" + + if(!length(render_block)) //If no VISIBLY DISPLAYED reagents are present, we report as if there is nothing. render_list += "Subject contains no reagents in their blood.\n" + else + render_list += "Subject contains the following reagents in their blood:\n" + render_list += render_block //Otherwise, we add the header, reagent readouts, and clear the readout block for use on the stomach. + render_block.Cut() // Stomach reagents var/obj/item/organ/internal/stomach/belly = target.getorganslot(ORGAN_SLOT_STOMACH) if(belly) if(belly.reagents.reagent_list.len) - render_list += "Subject contains the following reagents in their stomach:\n" for(var/bile in belly.reagents.reagent_list) var/datum/reagent/bit = bile - if(bit.chemical_flags & REAGENT_INVISIBLE) //Don't show hidden chems on scanners + if(bit.chemical_flags & REAGENT_INVISIBLE) continue if(!belly.food_reagents[bit.type]) - render_list += "[round(bit.volume, 0.001)] units of [bit.name][bit.overdosed ? " - [span_boldannounce("OVERDOSING")]" : "."]\n" + render_block += "[round(bit.volume, 0.001)] units of [bit.name][bit.overdosed ? " - [span_boldannounce("OVERDOSING")]" : "."]\n" else var/bit_vol = bit.volume - belly.food_reagents[bit.type] if(bit_vol > 0) - render_list += "[round(bit_vol, 0.001)] units of [bit.name][bit.overdosed ? " - [span_boldannounce("OVERDOSING")]" : "."]\n" - else + render_block += "[round(bit_vol, 0.001)] units of [bit.name][bit.overdosed ? " - [span_boldannounce("OVERDOSING")]" : "."]\n" + + if(!length(render_block)) render_list += "Subject contains no reagents in their stomach.\n" + else + render_list += "Subject contains the following reagents in their stomach:\n" + render_list += render_block // Addictions if(LAZYLEN(target.mind?.active_addictions))