From 2eb0776ebed2f814f6a5ba9680c44fe3f16d739f Mon Sep 17 00:00:00 2001 From: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Sun, 15 Mar 2026 07:12:57 -0400 Subject: [PATCH] Chem scanning removes achievements from maint pills (#95397) ## About The Pull Request Chem scanning a maint pill now removes the achievement for eating it. ## Why It's Good For The Game cheater. You can still scour maints for pills with stuff you'd like, but you lose the achievement for doing so. ## Changelog :cl: fix: Chem scanning a maintenance pill removes the achievement value. /:cl: --- code/__DEFINES/dcs/signals/signals_medical.dm | 3 ++ code/modules/detectivework/scanner.dm | 1 + code/modules/reagents/chemistry/items.dm | 1 + .../reagents/reagent_containers/pill.dm | 34 ++++++++++++++++--- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/dcs/signals/signals_medical.dm b/code/__DEFINES/dcs/signals/signals_medical.dm index 7429b6347f3..905118340ec 100644 --- a/code/__DEFINES/dcs/signals/signals_medical.dm +++ b/code/__DEFINES/dcs/signals/signals_medical.dm @@ -26,3 +26,6 @@ #define COMSIG_LIVING_OPERATING_ON "living_operating_on" /// Sent from /mob/living/perform_surgery: (mob/living/surgeon, list/possible_operations) #define COMSIG_ATOM_BEING_OPERATED_ON "atom_being_operated_on" + +/// From /obj/item/ph_meter/interact_with_atom(): (atom/source, mob/user) +#define COMSIG_ON_REAGENT_SCAN "on_reagent_scan" diff --git a/code/modules/detectivework/scanner.dm b/code/modules/detectivework/scanner.dm index 4b60ee1b8e0..a7cebef7bf2 100644 --- a/code/modules/detectivework/scanner.dm +++ b/code/modules/detectivework/scanner.dm @@ -142,6 +142,7 @@ log_entry.add_data_entry(DETSCAN_CATEGORY_FINGERS, atom_fingerprints.Copy()) // Only get reagents from non-mobs. + SEND_SIGNAL(scanned_atom, COMSIG_ON_REAGENT_SCAN, user) for(var/datum/reagent/present_reagent as anything in scanned_atom.reagents?.reagent_list) log_entry.add_data_entry(DETSCAN_CATEGORY_REAGENTS, list(present_reagent.name = present_reagent.volume)) diff --git a/code/modules/reagents/chemistry/items.dm b/code/modules/reagents/chemistry/items.dm index 6f1731c7be1..34da7832d47 100644 --- a/code/modules/reagents/chemistry/items.dm +++ b/code/modules/reagents/chemistry/items.dm @@ -119,6 +119,7 @@ var/obj/item/reagent_containers/cont = interacting_with if(!LAZYLEN(cont.reagents.reagent_list)) return NONE + SEND_SIGNAL(interacting_with, COMSIG_ON_REAGENT_SCAN, user) var/list/out_message = list() to_chat(user, "The chemistry meter beeps and displays:") 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" diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index e2871b3b369..4d19c5b5f18 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -355,9 +355,23 @@ icon_state = "pill21" /// From which randomisation pool to pull reagents from var/random_reagent_flag = REAGENT_SPAWN_RANDOM_PRODUCERS - var/static/list/names = list("maintenance pill", "floor pill", "mystery pill", "suspicious pill", "strange pill", "lucky pill", "ominous pill", "eerie pill") - var/static/list/descs = list("Your feeling is telling you no, but...","Drugs are expensive, you can't afford not to eat any pills that you find."\ - , "Surely, there's no way this could go bad.", "Winners don't do dr- oh what the heck!", "Free pills? At no cost, how could I lose?") + var/static/list/names = list( + "maintenance pill", + "floor pill", + "mystery pill", + "suspicious pill", + "strange pill", + "lucky pill", + "ominous pill", + "eerie pill", + ) + var/static/list/descs = list( + "Your feeling is telling you no, but...", + "Drugs are expensive, you can't afford not to eat any pills that you find.", + "Surely, there's no way this could go bad.", + "Winners don't do dr- oh what the heck!", + "Free pills? At no cost, how could I lose?", + ) /obj/item/reagent_containers/applicator/pill/maintenance/Initialize(mapload) list_reagents = list(get_random_reagent_id(random_reagent_flag) = rand(10,50)) //list_reagents is called before init, because init generates the reagents using list_reagents @@ -368,10 +382,22 @@ /obj/item/reagent_containers/applicator/pill/maintenance/achievement random_reagent_flag = REAGENT_SPAWN_MAINTENANCE_PILL //none of that fake shit + ///Boolean on whether this will count towards your achievement score if you consume it. + var/count_towards_achievement = TRUE + +/obj/item/reagent_containers/applicator/pill/maintenance/achievement/Initialize(mapload) + . = ..() + RegisterSignal(src, COMSIG_ON_REAGENT_SCAN, PROC_REF(on_chemical_scan)) /obj/item/reagent_containers/applicator/pill/maintenance/achievement/on_consumption(mob/consumer, mob/user) . = ..() - consumer.client?.give_award(/datum/award/score/maintenance_pill, consumer) + if(count_towards_achievement) + consumer.client?.give_award(/datum/award/score/maintenance_pill, consumer) + +///called when we are chemically scanned, we no longer grant an achievement. +/obj/item/reagent_containers/applicator/pill/maintenance/achievement/proc/on_chemical_scan(atom/source, mob/user) + SIGNAL_HANDLER + count_towards_achievement = FALSE /obj/item/reagent_containers/applicator/pill/potassiodide name = "potassium iodide pill"