From fe51ce7f66d64e4cb8d3278464f40a8ca2a772ec Mon Sep 17 00:00:00 2001 From: ATH1909 <42606352+ATH1909@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:24:17 -0500 Subject: [PATCH] consuming a red pill will now eject you from the Matrix (#79533) ## About The Pull Request If your bitrunning avatar somehow acquires and consumes a red pill, they will be disconnected from the Matrix. Note that this, like the 5% chance to receive a red pill message, only happens with pills with the fully red pill sprite (pill4). As far as I'm aware, only custom pills dispensed from a ChemMaster can have this sprite. ## Why It's Good For The Game hehe funny reference proof of testing: ![image](https://github.com/tgstation/tgstation/assets/42606352/8be936cb-ad98-4808-92aa-5445199524df) I also tested consuming normal and red pills in the non-bitrunning world to ensure that they still transfer chems, that red pill messages still work, and that they don't break anything. ## Changelog :cl: ATHATH add: If your bitrunning avatar somehow acquires and consumes a red pill, they will be disconnected from the Matrix. /:cl: --- code/__DEFINES/dcs/signals/signals_bitrunning.dm | 3 +++ .../bitrunning/components/avatar_connection.dm | 3 ++- code/modules/reagents/reagent_containers/pill.dm | 12 +++++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/code/__DEFINES/dcs/signals/signals_bitrunning.dm b/code/__DEFINES/dcs/signals/signals_bitrunning.dm index 74d418182d5..57bf5af1422 100644 --- a/code/__DEFINES/dcs/signals/signals_bitrunning.dm +++ b/code/__DEFINES/dcs/signals/signals_bitrunning.dm @@ -4,6 +4,9 @@ /// from /obj/effect/bitrunning/loot_signal: (points) #define COMSIG_BITRUNNER_GOAL_POINT "bitrunner_goal_point" +/// from /obj/item/reagent_containers/pill +#define COMSIG_BITRUNNER_RED_PILL_SEVER "bitrunner_red_pill_sever" + // Netpods /// from /obj/machinery/netpod/sever_connection() diff --git a/code/modules/bitrunning/components/avatar_connection.dm b/code/modules/bitrunning/components/avatar_connection.dm index 129ef63423a..7f1eed97baa 100644 --- a/code/modules/bitrunning/components/avatar_connection.dm +++ b/code/modules/bitrunning/components/avatar_connection.dm @@ -82,7 +82,7 @@ * - Mailed in a cache * - Click / Stand on the ladder */ - RegisterSignals(parent, list(COMSIG_BITRUNNER_ALERT_SEVER, COMSIG_BITRUNNER_CACHE_SEVER, COMSIG_BITRUNNER_LADDER_SEVER), PROC_REF(on_safe_disconnect)) + RegisterSignals(parent, list(COMSIG_BITRUNNER_ALERT_SEVER, COMSIG_BITRUNNER_CACHE_SEVER, COMSIG_BITRUNNER_LADDER_SEVER, COMSIG_BITRUNNER_RED_PILL_SEVER), PROC_REF(on_safe_disconnect)) RegisterSignal(parent, COMSIG_LIVING_DEATH, PROC_REF(on_sever_connection)) RegisterSignal(parent, COMSIG_MOB_APPLY_DAMAGE, PROC_REF(on_linked_damage)) @@ -91,6 +91,7 @@ UnregisterSignal(parent, COMSIG_BITRUNNER_ALERT_SEVER) UnregisterSignal(parent, COMSIG_BITRUNNER_CACHE_SEVER) UnregisterSignal(parent, COMSIG_BITRUNNER_LADDER_SEVER) + UnregisterSignal(parent, COMSIG_BITRUNNER_RED_PILL_SEVER) UnregisterSignal(parent, COMSIG_LIVING_DEATH) UnregisterSignal(parent, COMSIG_MOB_APPLY_DAMAGE) diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index 7c7f97f0cc7..3ba094fb781 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -47,13 +47,15 @@ return on_consumption(M, user) ///Runs the consumption code, can be overriden for special effects -/obj/item/reagent_containers/pill/proc/on_consumption(mob/M, mob/user) - if(icon_state == "pill4" && prob(5)) //you take the red pill - you stay in Wonderland, and I show you how deep the rabbit hole goes - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(to_chat), M, span_notice("[pick(strings(REDPILL_FILE, "redpill_questions"))]")), 50) +/obj/item/reagent_containers/pill/proc/on_consumption(mob/consumer, mob/giver) + if(icon_state == "pill4") //you take the red pill - you stay in Wonderland, and I show you how deep the rabbit hole goes + SEND_SIGNAL(consumer, COMSIG_BITRUNNER_RED_PILL_SEVER) //if your bitrunning avatar somehow manages to acquire and consume a red pill, they will be ejected from the Matrix + if(prob(5)) //the other kind of red pill + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(to_chat), consumer, span_notice("[pick(strings(REDPILL_FILE, "redpill_questions"))]")), 50) if(apply_type == INGEST) - SEND_SIGNAL(src, COMSIG_PILL_CONSUMED, eater = M, feeder = user) + SEND_SIGNAL(src, COMSIG_PILL_CONSUMED, eater = consumer, feeder = giver) if(reagents.total_volume) - reagents.trans_to(M, reagents.total_volume, transferred_by = user, methods = apply_type) + reagents.trans_to(consumer, reagents.total_volume, transferred_by = giver, methods = apply_type) qdel(src) return TRUE