Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into Fix_IV_Lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Drulikar committed Aug 9, 2023
2 parents e156fa2 + 0d5fd03 commit db97216
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 32 deletions.
58 changes: 26 additions & 32 deletions code/game/machinery/iv_drip.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -44,15 +46,6 @@
else if(!current_beam && attached && !QDELETED(src))
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
attached = null
Expand All @@ -61,17 +54,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
Expand All @@ -81,35 +75,35 @@
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
update_beam()
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
Expand Down Expand Up @@ -152,20 +146,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)
Expand Down
5 changes: 5 additions & 0 deletions html/changelogs/AutoChangeLog-pr-4070.yml
Original file line number Diff line number Diff line change
@@ -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."

0 comments on commit db97216

Please sign in to comment.