From 2f6f5215f0f1b4553fe4e9867103745be88cdb5d Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 6 Mar 2021 01:56:30 +0100 Subject: [PATCH] [MIRROR] Improves the chemical analyser to give you details on impurity and gives an % output in line with other purity descriptions (#3907) * Improves the chemical analyser to give you details on impurity and gives an % output in line with other purity descriptions (#57437) * Improves the chemical analyser to give you details on impurity and gives an % output in line with other purity descriptions Co-authored-by: Thalpy <33956696+Thalpy@users.noreply.github.com> --- code/modules/reagents/chemistry/items.dm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/code/modules/reagents/chemistry/items.dm b/code/modules/reagents/chemistry/items.dm index fc056f524a7..25e132f1d8f 100644 --- a/code/modules/reagents/chemistry/items.dm +++ b/code/modules/reagents/chemistry/items.dm @@ -124,11 +124,20 @@ out_message += "Total volume: [round(cont.volume, 0.01)] Current temperature: [round(cont.reagents.chem_temp, 0.1)]K Total pH: [round(cont.reagents.ph, 0.01)]\n" out_message += "Chemicals found in the beaker:\n" if(cont.reagents.is_reacting) - out_message += "A reaction appears to be occuring currently.\n" - for(var/datum/reagent/R in cont.reagents.reagent_list) - out_message += "[round(R.volume, 0.01)]u of [R.name], Purity: [round(R.purity, 0.01)], [(scanmode?"[(R.overdose_threshold?"Overdose: [R.overdose_threshold]u, ":"")]Base pH: [initial(R.ph)], Current pH: [R.ph].":"Current pH: [R.ph].")]\n" + out_message += "A reaction appears to be occuring currently.\n" + for(var/datum/reagent/reagent in cont.reagents.reagent_list) + if(reagent.purity < 1) //If the reagent is impure + if(reagent.purity < reagent.inverse_chem_val && reagent.inverse_chem) //Below level and has an inverse + var/datum/reagent/inverse_reagent = GLOB.chemical_reagents_list[reagent.inverse_chem] + out_message += "Inverted reagent detected: [round(reagent.volume, 0.01)]u of [inverse_reagent.name], Purity: [round(1 - reagent.purity, 0.01)*100]%, [(scanmode?"[(inverse_reagent.overdose_threshold?"Overdose: [inverse_reagent.overdose_threshold]u, ":"")]Base pH: [initial(inverse_reagent.ph)], Current pH: [reagent.ph].":"Current pH: [reagent.ph].")]\n" + else if(reagent.impure_chem) //Otherwise has an impure + var/datum/reagent/impure_reagent = GLOB.chemical_reagents_list[reagent.impure_chem] + out_message += "[round(reagent.volume, 0.01)]u of [reagent.name], Purity: [round(reagent.purity, 0.01)*100]%, [(scanmode?"[(reagent.overdose_threshold?"Overdose: [reagent.overdose_threshold]u, ":"")]Base pH: [initial(reagent.ph)], Current pH: [reagent.ph].":"Current pH: [reagent.ph].")]\n" + out_message += "Impurities detected: [round(reagent.volume - (reagent.volume * reagent.purity), 0.01)]u of [impure_reagent.name], [(scanmode?"[(reagent.overdose_threshold?"Overdose: [reagent.overdose_threshold]u, ":"")]":"")]\n" + else + out_message += "[round(reagent.volume, 0.01)]u of [reagent.name], Purity: [round(reagent.purity, 0.01)*100]%, [(scanmode?"[(reagent.overdose_threshold?"Overdose: [reagent.overdose_threshold]u, ":"")]Base pH: [initial(reagent.ph)], Current pH: [reagent.ph].":"Current pH: [reagent.ph].")]\n" if(scanmode) - out_message += "Analysis: [R.description]\n" + out_message += "Analysis: [reagent.description]\n" to_chat(user, "[out_message.Join()]") desc = "An electrode attached to a small circuit box that will display details of a solution. Can be toggled to provide a description of each of the reagents. The screen currently displays detected vol: [round(cont.volume, 0.01)] detected pH:[round(cont.reagents.ph, 0.1)]."