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

🆑 ATHATH
add: If your bitrunning avatar somehow acquires and consumes a red pill,
they will be disconnected from the Matrix.
/🆑
This commit is contained in:
ATH1909
2023-12-14 12:24:17 -05:00
committed by GitHub
parent fccb061d17
commit fe51ce7f66
3 changed files with 12 additions and 6 deletions
@@ -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()
@@ -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)
@@ -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