From d93e8da04967325343217193ffaca47fb8ea81ef Mon Sep 17 00:00:00 2001 From: Julian56 <117036822+Huffie56@users.noreply.github.com> Date: Wed, 9 Aug 2023 07:59:18 +0200 Subject: [PATCH 1/2] Fix remove iv needing power to operate. (#4070) # About the pull request fixes: https://github.com/cmss13-devs/cmss13/issues/3848 and add a skill check like for the blood pack. also turned four variable with a single letter into better ones. # Explain why it's good for the game # Testing Photographs and Procedure
Screenshots & Videos Put screenshots and videos here with an empty line between the screenshots and the `
` tags.
# Changelog :cl: add: Add a skill check to operate IV. fix: Fix remove iv needing power to operate. /:cl: --------- Co-authored-by: Julien Co-authored-by: forest2001 <41653574+realforest2001@users.noreply.github.com> Co-authored-by: Drathek <76988376+Drulikar@users.noreply.github.com> --- code/game/machinery/iv_drip.dm | 58 +++++++++++++++------------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index b538f55292c1..0b2b01fdb918 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -11,6 +11,8 @@ var/mode = 1 // 1 is injecting, 0 is taking blood. var/obj/item/reagent_container/beaker = null var/datum/beam/current_beam + //make it so that IV doesn't require power to function. + use_power = USE_POWER_NONE /obj/structure/machinery/iv_drip/update_icon() if(attached) @@ -44,15 +46,6 @@ 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() @@ -60,17 +53,18 @@ /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 - if(H.stat || get_dist(H, src) > 1 || H.blinded || H.lying) + var/mob/living/carbon/human/user = usr + if(user.stat || get_dist(user, src) > 1 || user.blinded || user.lying) + return + + if(!skillcheck(user, SKILL_SURGERY, SKILL_SURGERY_NOVICE)) + to_chat(user, SPAN_WARNING("You don't know how to [attached ? "disconnect" : "connect"] this!")) return if(attached) - H.visible_message("[H] detaches \the [src] from \the [attached].", \ + user.visible_message("[user] detaches \the [src] from \the [attached].", \ "You detach \the [src] from \the [attached].") attached.active_transfusions -= src attached = null @@ -80,7 +74,7 @@ return if(in_range(src, usr) && iscarbon(over_object) && get_dist(over_object, src) <= 1) - H.visible_message("[H] attaches \the [src] to \the [over_object].", \ + user.visible_message("[user] attaches \the [src] to \the [over_object].", \ "You attach \the [src] to \the [over_object].") attached = over_object attached.active_transfusions += src @@ -88,27 +82,27 @@ update_icon() start_processing() - -/obj/structure/machinery/iv_drip/attackby(obj/item/W, mob/living/user) - if (istype(W, /obj/item/reagent_container)) +/obj/structure/machinery/iv_drip/attackby(obj/item/container, mob/living/user) + if (istype(container, /obj/item/reagent_container)) if(beaker) to_chat(user, SPAN_WARNING("There is already a reagent container loaded!")) return - if((!istype(W, /obj/item/reagent_container/blood) && !istype(W, /obj/item/reagent_container/glass)) || istype(W, /obj/item/reagent_container/glass/bucket)) + if((!istype(container, /obj/item/reagent_container/blood) && !istype(container, /obj/item/reagent_container/glass)) || istype(container, /obj/item/reagent_container/glass/bucket)) to_chat(user, SPAN_WARNING("That won't fit!")) return - if(user.drop_inv_item_to_loc(W, src)) - beaker = W + if(user.drop_inv_item_to_loc(container, src)) + beaker = container var/reagentnames = "" - for(var/datum/reagent/R in beaker.reagents.reagent_list) - reagentnames += ";[R.name]" + + for(var/datum/reagent/chem in beaker.reagents.reagent_list) + reagentnames += ";[chem.name]" 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].") + to_chat(user, "You attach \the [container] to \the [src].") update_beam() update_icon() return @@ -151,20 +145,20 @@ if(prob(5)) visible_message("\The [src] pings.") return - var/mob/living/carbon/T = attached + var/mob/living/carbon/patient = attached - if(!istype(T)) + if(!istype(patient)) return - if(ishuman(T)) - var/mob/living/carbon/human/H = T - if(H.species && H.species.flags & NO_BLOOD) + if(ishuman(patient)) + var/mob/living/carbon/human/human_patient = patient + if(human_patient.species && human_patient.species.flags & NO_BLOOD) return // If the human is losing too much blood, beep. - if(T.blood_volume < BLOOD_VOLUME_SAFE) if(prob(5)) + if(patient.blood_volume < BLOOD_VOLUME_SAFE) if(prob(5)) visible_message("\The [src] beeps loudly.") - T.take_blood(beaker,amount) + patient.take_blood(beaker,amount) update_icon() /obj/structure/machinery/iv_drip/attack_hand(mob/user as mob) From 0d5fd0332736fd636e47b701f481b3ed0181426a Mon Sep 17 00:00:00 2001 From: cm13-github <128137806+cm13-github@users.noreply.github.com> Date: Wed, 9 Aug 2023 07:10:03 +0100 Subject: [PATCH 2/2] Automatic changelog for PR #4070 [ci skip] --- html/changelogs/AutoChangeLog-pr-4070.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 html/changelogs/AutoChangeLog-pr-4070.yml diff --git a/html/changelogs/AutoChangeLog-pr-4070.yml b/html/changelogs/AutoChangeLog-pr-4070.yml new file mode 100644 index 000000000000..ce07a7f0d64e --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-4070.yml @@ -0,0 +1,5 @@ +author: "Huffie56" +delete-after: True +changes: + - rscadd: "Add a skill check to operate IV." + - bugfix: "Fix remove iv needing power to operate." \ No newline at end of file