Refactors beams. Adds tethering. IV drips/bags are now tethered. (#29570)

* refactor

* tether

* tetherrrs

* logic fix (i hope)

* ci fix

* ok please work
This commit is contained in:
Contrabang
2025-07-09 14:49:40 +00:00
committed by GitHub
parent 6c2aa06eb3
commit 1f124ac835
15 changed files with 404 additions and 106 deletions
@@ -18,6 +18,10 @@
var/mob/living/carbon/human/injection_target
var/injection_action_delay = 3 SECONDS
/obj/item/reagent_containers/iv_bag/Initialize(mapload)
. = ..()
RegisterSignal(src, COMSIG_TETHER_DESTROYED, PROC_REF(tether_snapped))
/obj/item/reagent_containers/iv_bag/Destroy()
end_processing()
return ..()
@@ -52,12 +56,34 @@
injection_target = target
RegisterSignal(injection_target, COMSIG_PARENT_EXAMINE, PROC_REF(on_examine))
START_PROCESSING(SSobj, src)
update_iv_type()
/obj/item/reagent_containers/iv_bag/proc/end_processing()
/obj/item/reagent_containers/iv_bag/proc/update_iv_type()
var/target = injection_target
injection_target = null
SEND_SIGNAL(src, COMSIG_TETHER_STOP)
injection_target = target
if(!injection_target)
return
if(istype(loc, /obj/machinery/iv_drip))
injection_target.AddComponent(/datum/component/tether, src, 2, 50, "iv_tether", "tubing")
else
injection_target.AddComponent(/datum/component/tether, src, 1, 5, "iv_tether", "tubing")
/obj/item/reagent_containers/iv_bag/proc/end_processing(send_signal = TRUE)
if(injection_target)
UnregisterSignal(injection_target, COMSIG_PARENT_EXAMINE)
injection_target = null
STOP_PROCESSING(SSobj, src)
if(send_signal)
SEND_SIGNAL(src, COMSIG_TETHER_STOP)
/obj/item/reagent_containers/iv_bag/proc/tether_snapped()
if(!injection_target)
return
to_chat(injection_target, "<span class='userdanger'>[src]'s needle is ripped out of you!</span>")
injection_target.apply_damage(3, BRUTE, pick("r_arm", "l_arm"))
end_processing(FALSE)
/obj/item/reagent_containers/iv_bag/process()
if(QDELETED(injection_target))
@@ -69,12 +95,6 @@
end_processing()
return
if(get_dist(get_turf(src), get_turf(injection_target)) > 1)
to_chat(injection_target, "<span class='userdanger'>[src]'s needle is ripped out of you!</span>")
injection_target.apply_damage(3, BRUTE, pick("r_arm", "l_arm"))
end_processing()
return
if(mode) // Injecting
if(reagents.total_volume)
var/fraction = min(amount_per_transfer_from_this/reagents.total_volume, 1) //The amount of reagents we'll transfer to the person