mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
More tweaks to IPC fixes. Merge resolution/compile fixes. Further work on properly integrating, updating and fixing prosthetic options. Repathed internal organs to organ/internal. More work on full synthetics, changelings, overheating. Working on getting organs to qdel properly and spawn properly when robotized. Finalized some overheating values, added remaining prosthetic icons. Finalizing the testing version of the full prosthetic bodies branch. Added suit cyclers to the autolathe and map. Fixing runtime errors. Fixing errors. Changelog. Replacing limb and organ strings with constants. Prevented brainless species from becoming full cyborgs. Fixed issues with brain/MMIs renaming themselves inappropriately. Various fixes and oversights.
169 lines
4.8 KiB
Plaintext
169 lines
4.8 KiB
Plaintext
/obj/machinery/iv_drip
|
|
name = "\improper IV drip"
|
|
icon = 'icons/obj/iv_drip.dmi'
|
|
anchored = 0
|
|
density = 1
|
|
|
|
|
|
/obj/machinery/iv_drip/var/mob/living/carbon/human/attached = null
|
|
/obj/machinery/iv_drip/var/mode = 1 // 1 is injecting, 0 is taking blood.
|
|
/obj/machinery/iv_drip/var/obj/item/weapon/reagent_containers/beaker = null
|
|
|
|
/obj/machinery/iv_drip/update_icon()
|
|
if(src.attached)
|
|
icon_state = "hooked"
|
|
else
|
|
icon_state = ""
|
|
|
|
overlays = null
|
|
|
|
if(beaker)
|
|
var/datum/reagents/reagents = beaker.reagents
|
|
if(reagents.total_volume)
|
|
var/image/filling = image('icons/obj/iv_drip.dmi', src, "reagent")
|
|
|
|
var/percent = round((reagents.total_volume / beaker.volume) * 100)
|
|
switch(percent)
|
|
if(0 to 9) filling.icon_state = "reagent0"
|
|
if(10 to 24) filling.icon_state = "reagent10"
|
|
if(25 to 49) filling.icon_state = "reagent25"
|
|
if(50 to 74) filling.icon_state = "reagent50"
|
|
if(75 to 79) filling.icon_state = "reagent75"
|
|
if(80 to 90) filling.icon_state = "reagent80"
|
|
if(91 to INFINITY) filling.icon_state = "reagent100"
|
|
|
|
filling.icon += reagents.get_color()
|
|
overlays += filling
|
|
|
|
/obj/machinery/iv_drip/MouseDrop(over_object, src_location, over_location)
|
|
..()
|
|
|
|
if(attached)
|
|
visible_message("[src.attached] is detached from \the [src]")
|
|
src.attached = null
|
|
src.update_icon()
|
|
return
|
|
|
|
if(in_range(src, usr) && ishuman(over_object) && get_dist(over_object, src) <= 1)
|
|
visible_message("[usr] attaches \the [src] to \the [over_object].")
|
|
src.attached = over_object
|
|
src.update_icon()
|
|
|
|
|
|
/obj/machinery/iv_drip/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|
if (istype(W, /obj/item/weapon/reagent_containers))
|
|
if(!isnull(src.beaker))
|
|
user << "There is already a reagent container loaded!"
|
|
return
|
|
|
|
user.drop_item()
|
|
W.loc = src
|
|
src.beaker = W
|
|
user << "You attach \the [W] to \the [src]."
|
|
src.update_icon()
|
|
return
|
|
else
|
|
return ..()
|
|
|
|
|
|
/obj/machinery/iv_drip/process()
|
|
set background = 1
|
|
|
|
if(src.attached)
|
|
|
|
if(!(get_dist(src, src.attached) <= 1 && isturf(src.attached.loc)))
|
|
visible_message("The needle is ripped out of [src.attached], doesn't that hurt?")
|
|
src.attached:apply_damage(3, BRUTE, pick("r_arm", "l_arm"))
|
|
src.attached = null
|
|
src.update_icon()
|
|
return
|
|
|
|
if(src.attached && src.beaker)
|
|
// Give blood
|
|
if(mode)
|
|
if(src.beaker.volume > 0)
|
|
var/transfer_amount = REM
|
|
if(istype(src.beaker, /obj/item/weapon/reagent_containers/blood))
|
|
// speed up transfer on blood packs
|
|
transfer_amount = 4
|
|
src.beaker.reagents.trans_to_mob(src.attached, transfer_amount, CHEM_BLOOD)
|
|
update_icon()
|
|
|
|
// Take blood
|
|
else
|
|
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.")
|
|
return
|
|
|
|
var/mob/living/carbon/human/T = attached
|
|
|
|
if(!istype(T)) return
|
|
if(!T.dna)
|
|
return
|
|
if(NOCLONE in T.mutations)
|
|
return
|
|
|
|
if(!T.should_have_organ(O_HEART))
|
|
return
|
|
|
|
// If the human is losing too much blood, beep.
|
|
if(T.vessel.get_reagent_amount("blood") < BLOOD_VOLUME_SAFE) if(prob(5))
|
|
visible_message("\The [src] beeps loudly.")
|
|
|
|
var/datum/reagent/B = T.take_blood(beaker,amount)
|
|
|
|
if (B)
|
|
beaker.reagents.reagent_list |= B
|
|
beaker.reagents.update_total()
|
|
beaker.on_reagent_change()
|
|
beaker.reagents.handle_reactions()
|
|
update_icon()
|
|
|
|
/obj/machinery/iv_drip/attack_hand(mob/user as mob)
|
|
if(src.beaker)
|
|
src.beaker.loc = get_turf(src)
|
|
src.beaker = null
|
|
update_icon()
|
|
else
|
|
return ..()
|
|
|
|
|
|
/obj/machinery/iv_drip/verb/toggle_mode()
|
|
set category = "Object"
|
|
set name = "Toggle Mode"
|
|
set src in view(1)
|
|
|
|
if(!istype(usr, /mob/living))
|
|
usr << "<span class='warning'>You can't do that.</span>"
|
|
return
|
|
|
|
if(usr.stat)
|
|
return
|
|
|
|
mode = !mode
|
|
usr << "The IV drip is now [mode ? "injecting" : "taking blood"]."
|
|
|
|
/obj/machinery/iv_drip/examine(mob/user)
|
|
..(user)
|
|
if (!(user in view(2)) && user!=src.loc) return
|
|
|
|
user << "The IV drip is [mode ? "injecting" : "taking blood"]."
|
|
|
|
if(beaker)
|
|
if(beaker.reagents && beaker.reagents.reagent_list.len)
|
|
usr << "<span class='notice'>Attached is \a [beaker] with [beaker.reagents.total_volume] units of liquid.</span>"
|
|
else
|
|
usr << "<span class='notice'>Attached is an empty [beaker].</span>"
|
|
else
|
|
usr << "<span class='notice'>No chemicals are attached.</span>"
|
|
|
|
usr << "<span class='notice'>[attached ? attached : "No one"] is attached.</span>"
|
|
|
|
/obj/machinery/iv_drip/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
|
if(height && istype(mover) && mover.checkpass(PASSTABLE)) //allow bullets, beams, thrown objects, mice, drones, and the like through.
|
|
return 1
|
|
return ..()
|