diff --git a/aurorastation.dme b/aurorastation.dme index 4b0c9a4ad81..ee05a5d16cd 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -814,6 +814,7 @@ #include "code\game\objects\items\tajara.dm" #include "code\game\objects\items\toys.dm" #include "code\game\objects\items\trash.dm" +#include "code\game\objects\items\vitals_monitor.dm" #include "code\game\objects\items\devices\aicard.dm" #include "code\game\objects\items\devices\augment_implanter.dm" #include "code\game\objects\items\devices\binoculars.dm" diff --git a/code/game/objects/items/vitals_monitor.dm b/code/game/objects/items/vitals_monitor.dm new file mode 100644 index 00000000000..548d2c13887 --- /dev/null +++ b/code/game/objects/items/vitals_monitor.dm @@ -0,0 +1,121 @@ +/obj/item/vitals_monitor + name = "vitals monitor" + desc = "A vitals monitor, used to track a patient's vitality. It needs to be attached to a rollerbed to function." + icon = 'icons/obj/contained_items/tools/vitals_monitor.dmi' + icon_state = "vitals_monitor" + item_state = "vitals_monitor" + contained_sprite = TRUE + + var/obj/structure/bed/roller/bed + var/reported_critical = FALSE + +/obj/item/vitals_monitor/process() + if(!bed) + return + + var/mob/living/carbon/human/H + if(bed?.buckled) + if(ishuman(bed.buckled)) + H = bed.buckled + else if(istype(bed.buckled, /obj/structure/closet)) + H = locate() in bed.buckled.contents + + if(!H) + return + + if(H.is_asystole()) + if(!reported_critical) + bed.visible_message(SPAN_WARNING("\The [src] flashes red!")) + playsound(bed.loc, 'sound/machines/airalarm.ogg', 70) + reported_critical = TRUE + update_icon() + else if(reported_critical) + bed.visible_message(SPAN_NOTICE("\The [src] returns to a normal green.")) + reported_critical = FALSE + update_icon() + +/obj/item/vitals_monitor/proc/update_monitor() + if(bed) + START_PROCESSING(SSprocessing, src) + else + STOP_PROCESSING(SSprocessing, src) + reported_critical = FALSE + update_icon() + +/obj/item/vitals_monitor/update_icon() + if(bed) + if(bed.density) + icon_state = "[initial(icon_state)]-bb" + layer = bed.buckled.layer + 0.1 + else + icon_state = "[initial(icon_state)]-b" + layer = bed.layer + 0.1 + else + icon_state = initial(icon_state) + layer = initial(layer) + if(reported_critical) + color = color_rotation(-120) + else + color = null + +/obj/item/vitals_monitor/CtrlClick(var/mob/user) + if(bed) + return bed.CtrlClick(user) + return ..() + +/obj/item/vitals_monitor/Click() // attack_hand doesn't work here because it's inside the rollerbed + if(bed && bed.Adjacent(usr)) + interact(usr) + return + return ..() + +/obj/item/vitals_monitor/interact(mob/user) + var/datum/vueui/ui = SSvueui.get_open_ui(user, src) + if(!ui) + ui = new(user, src, "devices-vitalsmonitor", 480, 250, capitalize_first_letters(name), set_state_object = bed) + ui.auto_update_content = TRUE + ui.open() + +/obj/item/vitals_monitor/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui) + if(!data) + data = list() + + var/mob/living/carbon/human/H + if(bed?.buckled) + if(ishuman(bed.buckled)) + H = bed.buckled + else if(istype(bed.buckled, /obj/structure/closet)) + H = locate() in bed.buckled.contents + + var/has_occupant = !isnull(H) + VUEUI_SET_CHECK(data["has_occupant"], has_occupant, ., data) + + if(has_occupant) + var/displayed_stat = H.stat + var/blood_oxygenation = H.get_blood_oxygenation() + if(H.status_flags & FAKEDEATH) + displayed_stat = DEAD + blood_oxygenation = min(blood_oxygenation, BLOOD_VOLUME_SURVIVE) + + var/pulse_result + if(H.should_have_organ(BP_HEART)) + var/obj/item/organ/internal/heart/heart = H.internal_organs_by_name[BP_HEART] + if(!heart) + pulse_result = 0 + else if(BP_IS_ROBOTIC(heart)) + pulse_result = -2 + else if(H.status_flags & FAKEDEATH) + pulse_result = 0 + else + pulse_result = H.get_pulse(GETPULSE_TOOL) + else + pulse_result = -1 + if(pulse_result == ">250") + pulse_result = -3 + + VUEUI_SET_CHECK(data["stat"], displayed_stat, ., data) + VUEUI_SET_CHECK(data["brain_activity"], H.get_brain_result(), ., data) + VUEUI_SET_CHECK(data["blood_pressure"], H.get_blood_pressure(), ., data) + VUEUI_SET_CHECK(data["blood_pressure_level"], H.get_blood_pressure_alert(), ., data) + VUEUI_SET_CHECK(data["blood_volume"], H.get_blood_volume(), ., data) + VUEUI_SET_CHECK(data["blood_o2"], blood_oxygenation, ., data) \ No newline at end of file diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index 37cf71184b7..c9ebd99f750 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -224,6 +224,7 @@ var/base_state = "standard" var/item_bedpath = /obj/item/roller var/obj/item/reagent_containers/beaker + var/obj/item/vitals_monitor/vitals var/iv_attached = 0 var/iv_stand = TRUE var/patient_shift = 9 //How much are mobs moved up when they are buckled_to. @@ -234,8 +235,15 @@ ..() LAZYADD(can_buckle, /obj/structure/closet/body_bag) +/obj/structure/bed/roller/Destroy() + QDEL_NULL(beaker) + vitals.bed = null + QDEL_NULL(vitals) + return ..() + /obj/structure/bed/roller/update_icon() - overlays.Cut() + cut_overlays() + vis_contents = list() if(density) icon_state = "[base_state]_up" else @@ -245,18 +253,31 @@ var/percentage = round((beaker.reagents.total_volume / beaker.volume) * 100, 25) var/image/filling = image(icon, "iv_filling[percentage]") filling.color = beaker.reagents.get_color() - iv.overlays += filling + iv.add_overlay(filling) if(percentage < 25) - iv.overlays += image(icon, "light_low") + iv.add_overlay(image(icon, "light_low")) if(density) iv.pixel_y = 6 - overlays += iv + add_overlay(iv) + if(vitals) + vitals.update_monitor() + vis_contents += vitals if(bag_strap && istype(buckled, /obj/structure/closet/body_bag)) LAZYADD(buckled.overlays, image(icon, bag_strap)) /obj/structure/bed/roller/attackby(obj/item/I, mob/user) if(iswrench(I) || istype(I, /obj/item/stack) || iswirecutter(I)) return 1 + if(istype(I, /obj/item/vitals_monitor)) + if(vitals) + to_chat(user, SPAN_WARNING("\The [src] already has a vitals monitor attached!")) + return + to_chat(user, SPAN_NOTICE("You attach \the [I] to \the [src].")) + user.drop_from_inventory(I, src) + vitals = I + vitals.bed = src + update_icon() + return if(iv_stand && !beaker && (istype(I, /obj/item/reagent_containers/glass/beaker) || istype(I, /obj/item/reagent_containers/blood))) if(!user.unEquip(I, target = src)) return @@ -295,6 +316,14 @@ beaker = null update_icon() +/obj/structure/bed/roller/proc/remove_vitals(mob/user) + to_chat(user, SPAN_NOTICE("You detach \the [vitals] from \the [src].")) + vitals.bed = null + vitals.update_monitor() + user.put_in_hands(vitals) + vitals = null + update_icon() + /obj/structure/bed/roller/proc/attach_iv(mob/living/carbon/human/target, mob/user) if(!beaker) return @@ -329,6 +358,9 @@ if(beaker) remove_beaker(usr) return + if(vitals) + remove_vitals(usr) + return if(buckled) return collapse() diff --git a/html/changelogs/geeves-rollerbed_vitals_monitor.yml b/html/changelogs/geeves-rollerbed_vitals_monitor.yml new file mode 100644 index 00000000000..8aa364f9476 --- /dev/null +++ b/html/changelogs/geeves-rollerbed_vitals_monitor.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Added vitals monitors for rollerbeds, two mapped into medical's GTR." \ No newline at end of file diff --git a/icons/obj/contained_items/tools/vitals_monitor.dmi b/icons/obj/contained_items/tools/vitals_monitor.dmi new file mode 100644 index 00000000000..a8eb1df4897 Binary files /dev/null and b/icons/obj/contained_items/tools/vitals_monitor.dmi differ diff --git a/icons/obj/rollerbed.dmi b/icons/obj/rollerbed.dmi index b664669fdf3..4d63e5409d7 100644 Binary files a/icons/obj/rollerbed.dmi and b/icons/obj/rollerbed.dmi differ diff --git a/maps/aurora/aurora-4_mainlevel.dmm b/maps/aurora/aurora-4_mainlevel.dmm index 50a6b1f3794..9932c4fc3af 100644 --- a/maps/aurora/aurora-4_mainlevel.dmm +++ b/maps/aurora/aurora-4_mainlevel.dmm @@ -39336,6 +39336,11 @@ icon_state = "0-2" }, /obj/structure/table/standard, +/obj/item/vitals_monitor, +/obj/item/vitals_monitor{ + pixel_x = 2; + pixel_y = 4 + }, /turf/simulated/floor/tiled/dark, /area/medical/gen_treatment) "bqJ" = ( diff --git a/vueui/src/components/view/devices/vitalsmonitor.vue b/vueui/src/components/view/devices/vitalsmonitor.vue new file mode 100644 index 00000000000..bdd31885d88 --- /dev/null +++ b/vueui/src/components/view/devices/vitalsmonitor.vue @@ -0,0 +1,71 @@ + + + \ No newline at end of file