diff --git a/code/datums/components/plumbing/automated_iv.dm b/code/datums/components/plumbing/automated_iv.dm new file mode 100644 index 00000000000..15639d85251 --- /dev/null +++ b/code/datums/components/plumbing/automated_iv.dm @@ -0,0 +1,36 @@ +/datum/component/plumbing/automated_iv + demand_connects = SOUTH + supply_connects = NORTH + ///Temporary holder to store all the reagents from the iv drip before transferring it to the ducts + var/datum/reagents/plumbing/holder + +/datum/component/plumbing/automated_iv/Initialize(start=TRUE, _ducting_layer, _turn_connects=TRUE, datum/reagents/custom_receiver) + . = ..() + if(!istype(parent, /obj/machinery/iv_drip/plumbing)) + return COMPONENT_INCOMPATIBLE + var/obj/machinery/iv_drip/plumbing/drip = parent + holder = new(drip.reagents.maximum_volume, drip.reagents.flags) + holder.my_atom = drip + +/datum/component/plumbing/automated_iv/Destroy(force) + QDEL_NULL(holder) + return ..() + +/datum/component/plumbing/automated_iv/can_give(amount, reagent) + . = ..() + if(!.) + return + var/obj/machinery/iv_drip/plumbing/drip = parent + return drip.mode == 0 + +/datum/component/plumbing/automated_iv/send_request(dir) + var/obj/machinery/iv_drip/plumbing/drip = parent + if(drip.mode == 1) + process_request(dir = dir) + +/datum/component/plumbing/automated_iv/transfer_to(datum/component/plumbing/target, amount, reagent, datum/ductnet/net, round_robin = TRUE) + reagents.trans_to(holder, reagents.total_volume) + reagents = holder + . = ..() + var/obj/machinery/iv_drip/plumbing/drip = parent + reagents = drip.reagents diff --git a/code/modules/plumbing/plumbers/iv_drip.dm b/code/modules/plumbing/plumbers/iv_drip.dm index 88ad345ffa0..1935049fe73 100644 --- a/code/modules/plumbing/plumbers/iv_drip.dm +++ b/code/modules/plumbing/plumbers/iv_drip.dm @@ -10,9 +10,15 @@ /obj/machinery/iv_drip/plumbing/Initialize(mapload, bolt, layer) . = ..() - AddComponent(/datum/component/plumbing/simple_demand, bolt, layer) + AddComponent(/datum/component/plumbing/automated_iv, bolt, layer) AddComponent(/datum/component/simple_rotation) +/obj/machinery/iv_drip/attack_hand_secondary(mob/user, list/modifiers) + return FALSE + +/obj/machinery/iv_drip/plumbing/click_alt(mob/user) + return FALSE + /obj/machinery/iv_drip/plumbing/add_context(atom/source, list/context, obj/item/held_item, mob/living/user) . = ..() if(isnull(held_item) || held_item.tool_behaviour != TOOL_WRENCH) diff --git a/tgstation.dme b/tgstation.dme index 9b881baed82..f4bd825d3c1 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1400,6 +1400,7 @@ #include "code\datums\components\pet_commands\pet_command.dm" #include "code\datums\components\pet_commands\pet_commands_basic.dm" #include "code\datums\components\plumbing\_plumbing.dm" +#include "code\datums\components\plumbing\automated_iv.dm" #include "code\datums\components\plumbing\buffer.dm" #include "code\datums\components\plumbing\chemical_acclimator.dm" #include "code\datums\components\plumbing\filter.dm"