diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index e1c9c9a4e279..b538f55292c1 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -4,13 +4,16 @@ anchored = FALSE density = FALSE drag_delay = 1 + base_pixel_x = 15 + base_pixel_y = -2 var/mob/living/carbon/attached = null var/mode = 1 // 1 is injecting, 0 is taking blood. var/obj/item/reagent_container/beaker = null + var/datum/beam/current_beam /obj/structure/machinery/iv_drip/update_icon() - if(src.attached) + if(attached) icon_state = "hooked" else icon_state = "" @@ -35,8 +38,31 @@ filling.color = mix_color_from_reagents(reagents.reagent_list) overlays += filling +/obj/structure/machinery/iv_drip/proc/update_beam() + if(current_beam) + QDEL_NULL(current_beam) + else if(!QDELETED(src) && attached) + current_beam = beam(attached, "iv_tube") + +/obj/structure/machinery/iv_drip/power_change() + . = ..() + if(stat & NOPOWER && attached) + visible_message("\The [src] retracts its IV tube and shuts down.") + attached.active_transfusions -= src + attached = null + update_beam() + update_icon() + +/obj/structure/machinery/iv_drip/Destroy() + attached?.active_transfusions -= src + update_beam() + . = ..() + /obj/structure/machinery/iv_drip/MouseDrop(over_object, src_location, over_location) ..() + if(inoperable()) + visible_message("\The [src] is not powered.") + return if(ishuman(usr)) var/mob/living/carbon/human/H = usr @@ -48,6 +74,7 @@ "You detach \the [src] from \the [attached].") attached.active_transfusions -= src attached = null + update_beam() update_icon() stop_processing() return @@ -57,6 +84,7 @@ "You attach \the [src] to \the [over_object].") attached = over_object attached.active_transfusions += src + update_beam() update_icon() start_processing() @@ -81,6 +109,7 @@ log_admin("[key_name(user)] put a [beaker] into [src], containing [reagentnames] at ([src.loc.x],[src.loc.y],[src.loc.z]).") to_chat(user, "You attach \the [W] to \the [src].") + update_beam() update_icon() return else @@ -97,6 +126,7 @@ attached.emote("scream") attached.active_transfusions -= src attached = null + update_beam() update_icon() stop_processing() return diff --git a/code/game/objects/items/reagent_containers/blood_pack.dm b/code/game/objects/items/reagent_containers/blood_pack.dm index 450cdde2fa00..8e29a26c2ecd 100644 --- a/code/game/objects/items/reagent_containers/blood_pack.dm +++ b/code/game/objects/items/reagent_containers/blood_pack.dm @@ -13,7 +13,9 @@ var/mode = BLOOD_BAG_INJECTING var/mob/living/carbon/human/connected_to + var/mob/living/carbon/human/connected_from var/blood_type = null + var/datum/beam/current_beam /obj/item/reagent_container/blood/Initialize() . = ..() @@ -32,6 +34,12 @@ if(10 to 50) icon_state = "half" if(51 to INFINITY) icon_state = "full" +/obj/item/reagent_container/blood/proc/update_beam() + if(current_beam) + QDEL_NULL(current_beam) + else if(connected_from && connected_to) + current_beam = connected_from.beam(connected_to, "iv_tube") + /obj/item/reagent_container/blood/attack(mob/attacked_mob, mob/user) . = ..() @@ -44,7 +52,10 @@ user.visible_message("[user] detaches [src] from [connected_to].", \ "You detach [src] from [connected_to].") connected_to.active_transfusions -= src + connected_to.base_pixel_x = 0 connected_to = null + connected_from = null + update_beam() return if(!skillcheck(user, SKILL_SURGERY, SKILL_SURGERY_NOVICE)) @@ -60,10 +71,13 @@ if(istype(attacked_mob, /mob/living/carbon/human)) connected_to = attacked_mob + connected_from = user connected_to.active_transfusions += src + connected_to.base_pixel_x = 5 START_PROCESSING(SSobj, src) user.visible_message("[user] attaches \the [src] to [connected_to].", \ "You attach \the [src] to [connected_to].") + update_beam() /obj/item/reagent_container/blood/process() //if we're not connected to anything stop doing stuff @@ -106,6 +120,10 @@ connected_to.take_blood(src, amount) +/obj/item/reagent_container/blood/dropped() + ..() + bad_disconnect() + ///Used to standardize effects of a blood bag disconnecting improperly /obj/item/reagent_container/blood/proc/bad_disconnect() if(!connected_to) @@ -116,7 +134,10 @@ if(connected_to.pain.feels_pain) connected_to.emote("scream") connected_to.active_transfusions -= src + connected_to.base_pixel_x = 0 connected_to = null + connected_from = null + update_beam() /obj/item/reagent_container/blood/verb/toggle_mode() set category = "Object" diff --git a/icons/effects/beam.dmi b/icons/effects/beam.dmi index 704c0ad1c02c..d6ee40cf7fe8 100644 Binary files a/icons/effects/beam.dmi and b/icons/effects/beam.dmi differ