[MIRROR] Changes the 'red pill' signal into a more generic 'living pill consumed' [MDB IGNORE] (#25719)

* Changes the 'red pill' signal into a more generic 'living pill consumed' (#80428)

## About The Pull Request
I've been reminded to do that by Mothblocks.

## Why It's Good For The Game
Who would have thought that an oddly specific signal that is only sent
when the pill is red was bad design.

## Changelog
N/A

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com>

* Changes the 'red pill' signal into a more generic 'living pill consumed'

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-12-18 13:02:07 -06:00
committed by GitHub
co-authored by MrMelbert Ghom
parent 720cf262c1
commit 92a397e5dc
4 changed files with 22 additions and 14 deletions
@@ -82,18 +82,21 @@
* - Mailed in a cache
* - Click / Stand on the ladder
*/
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))
RegisterSignals(parent, list(COMSIG_BITRUNNER_ALERT_SEVER, COMSIG_BITRUNNER_CACHE_SEVER, COMSIG_BITRUNNER_LADDER_SEVER), PROC_REF(on_safe_disconnect))
RegisterSignal(parent, COMSIG_LIVING_PILL_CONSUMED, PROC_REF(disconnect_if_red_pill))
RegisterSignal(parent, COMSIG_LIVING_DEATH, PROC_REF(on_sever_connection))
RegisterSignal(parent, COMSIG_MOB_APPLY_DAMAGE, PROC_REF(on_linked_damage))
/datum/component/avatar_connection/UnregisterFromParent()
REMOVE_TRAIT(parent, TRAIT_TEMPORARY_BODY, REF(src))
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)
UnregisterSignal(parent, list(
COMSIG_BITRUNNER_ALERT_SEVER,
COMSIG_BITRUNNER_CACHE_SEVER,
COMSIG_BITRUNNER_LADDER_SEVER,
COMSIG_LIVING_DEATH,
COMSIG_LIVING_PILL_CONSUMED,
COMSIG_MOB_APPLY_DAMAGE,
))
/// Disconnects the avatar and returns the mind to the old_body.
/datum/component/avatar_connection/proc/full_avatar_disconnect(cause_damage = FALSE, datum/source)
@@ -181,6 +184,12 @@
alert.name = "Integrity Compromised"
alert.desc = "The netpod is damaged. Find an exit."
//if your bitrunning avatar somehow manages to acquire and consume a red pill, they will be ejected from the Matrix
/datum/component/avatar_connection/proc/disconnect_if_red_pill(datum/source, obj/item/reagent_containers/pill/pill, mob/feeder)
SIGNAL_HANDLER
if(pill.icon_state == "pill4")
full_avatar_disconnect()
/// Triggers when a safe disconnect is called
/datum/component/avatar_connection/proc/on_safe_disconnect(datum/source)
SIGNAL_HANDLER