Fixes IV Drip Runtime

This commit is contained in:
Fox-McCloud
2017-07-13 22:46:57 -04:00
parent a5909dc08b
commit d27a2efb70
+22 -8
View File
@@ -1,10 +1,14 @@
#define IV_TAKING 0
#define IV_INJECTING 1
/obj/machinery/iv_drip
name = "\improper IV drip"
icon = 'icons/obj/iv_drip.dmi'
icon_state = "iv_drip"
anchored = 0
anchored = FALSE
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
var/mob/living/carbon/human/attached = null
var/mode = 1 // 1 is injecting, 0 is taking blood.
var/mode = IV_INJECTING
var/obj/item/weapon/reagent_containers/beaker = null
var/transfer_amount = 5
var/possible_transfer_amounts = list(1,5,10)
@@ -61,7 +65,7 @@
overlays += filling
/obj/machinery/iv_drip/MouseDrop(mob/living/target)
if(!ishuman(usr))
if(!ishuman(usr) || !iscarbon(target))
return
if(attached)
@@ -83,6 +87,7 @@
else
to_chat(usr, "<span class='warning'>There's nothing attached to the IV drip!</span>")
/obj/machinery/iv_drip/attackby(obj/item/weapon/W, mob/user, params)
if(istype(W, /obj/item/weapon/reagent_containers))
if(beaker)
@@ -124,13 +129,14 @@
var/amount = beaker.reagents.maximum_volume - beaker.reagents.total_volume
amount = min(amount, 4)
// If the beaker is full, ping
if(amount == 0)
if(prob(5)) visible_message("\The [src] pings.")
if(!amount)
if(prob(5))
visible_message("[src] pings.")
return
// If the human is losing too much blood, beep.
if(attached.blood_volume < BLOOD_VOLUME_SAFE && prob(5))
visible_message("\The [src] beeps loudly.")
visible_message("[src] beeps loudly.")
playsound(loc, 'sound/machines/twobeep.ogg', 50, 1)
attached.transfer_blood_to(beaker, amount)
update_icon()
@@ -192,7 +198,7 @@
/obj/machinery/iv_drip/examine(mob/user)
..(user)
if(!(user in view(2)) && user != loc)
if(get_dist(user, src) > 2)
return
to_chat(user, "The IV drip is [mode ? "injecting" : "taking blood"].")
@@ -212,9 +218,17 @@
set category = "Object"
set src in view(1)
if(!iscarbon(usr))
to_chat(usr, "<span class='warning'>You can't do that!</span>")
return
if(usr.incapacitated())
return
var/default = 5
var/N = input("Amount per transfer from this:", "[src]", default) as null|anything in possible_transfer_amounts
if(N)
transfer_amount = N
transfer_amount = N
#undef IV_TAKING
#undef IV_INJECTING