Files
Bubberstation/code/datums/components/plumbing/IV_drip.dm
T
c7ee4d2b13 [MIRROR] Plumbing IV drip (#3453)
* Plumbing IV drip (#56920)

Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>

* Plumbing IV drip

Co-authored-by: Time-Green <timkoster1@hotmail.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>
2021-02-17 13:43:42 +00:00

35 lines
1.1 KiB
Plaintext

///Component for IVs that tracks the current person being IV'd. Input received through plumbing is instead routed to the whoever is attached
/datum/component/plumbing/iv_drip
demand_connects = SOUTH
supply_connects = NORTH
methods = INJECT
/datum/component/plumbing/iv_drip/Initialize()
. = ..()
recipient_reagents_holder = null
/datum/component/plumbing/iv_drip/RegisterWithParent()
. = ..()
RegisterSignal(parent, list(COMSIG_IV_ATTACH), .proc/update_attached)
RegisterSignal(parent, list(COMSIG_IV_DETACH), .proc/clear_attached)
/datum/component/plumbing/iv_drip/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_IV_ATTACH))
UnregisterSignal(parent, list(COMSIG_IV_DETACH))
///When an IV is attached, we will use whoever is attached as our receiving container
/datum/component/plumbing/iv_drip/proc/update_attached(datum/source, mob/living/attachee)
SIGNAL_HANDLER
if(attachee?.reagents)
recipient_reagents_holder = attachee.reagents
///IV has been detached, so clear the holder
/datum/component/plumbing/iv_drip/proc/clear_attached(datum/source)
SIGNAL_HANDLER
recipient_reagents_holder = null