From edb552c480ea2dc69f35f6f8c779e99c5a5ec4b1 Mon Sep 17 00:00:00 2001 From: pinatacolada Date: Sat, 23 Jan 2016 22:26:12 +0000 Subject: [PATCH 1/5] Makes the surgery computer useful Adds nanoUI to it, and makes the surgery computer announce the patient's health and beep when it degrades past certain thresholds. Also lets you customize those tresholds and mute them individually if you want to. This is my first PR and I did it more so I could get familiar with byond and git, please tell if something's wrong --- code/game/machinery/computer/Operating.dm | 193 ++++++++++++++---- ...atacolada-pr-usefulishsurgerycomputers.yml | 37 ++++ nano/templates/op_computer.tmpl | 171 ++++++++++++++++ 3 files changed, 360 insertions(+), 41 deletions(-) create mode 100644 html/changelogs/pinatacolada-pr-usefulishsurgerycomputers.yml create mode 100644 nano/templates/op_computer.tmpl diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm index f3e6de46321..7620059b64c 100644 --- a/code/game/machinery/computer/Operating.dm +++ b/code/game/machinery/computer/Operating.dm @@ -7,10 +7,16 @@ icon_keyboard = "med_key" icon_screen = "crew" circuit = /obj/item/weapon/circuitboard/operating - var/mob/living/carbon/human/victim = null var/obj/machinery/optable/table = null - + var/mob/living/carbon/human/victim = null light_color = LIGHT_COLOR_PURE_BLUE + var/verbose = 1 //general speaker toggle + var/patientName = null + var/oxyAlarm = 30 //oxy damage at which the computer will beep + var/choice = 0 //just for going into and out of the options menu + var/healthAnnounce = 1 //healther announcer toggle + var/crit = 1 //crit beeping toggle + /obj/machinery/computer/operating/New() ..() @@ -24,7 +30,7 @@ add_fingerprint(user) if(stat & (BROKEN|NOPOWER)) return - interact(user) + ui_interact(user) /obj/machinery/computer/operating/attack_hand(mob/user) @@ -36,45 +42,116 @@ add_fingerprint(user) - interact(user) + ui_interact(user) + + +///obj/machinery/computer/operating/interact(mob/user) +// if ( ((get_dist(src, user) > 1) && !isobserver(user)) || (stat & (BROKEN|NOPOWER)) ) +// if (!istype(user, /mob/living/silicon)) +// user.unset_machine() +// user << browse(null, "window=op") +// return +// +// user.set_machine(src) +// var/dat = "Operating Computer\n" +// dat += "Close

" //| Update" +// if(src.table && (src.table.check_victim())) +// src.victim = src.table.victim +// dat += {" +//Patient Information:
+//
+//Name: [src.victim.real_name]
+//Age: [src.victim.age]
+//Blood Type: [src.victim.b_type]
+//
+//Health: [src.victim.health]
+//Brute Damage: [src.victim.getBruteLoss()]
+//Toxins Damage: [src.victim.getToxLoss()]
+//Fire Damage: [src.victim.getFireLoss()]
+//Suffocation Damage: [src.victim.getOxyLoss()]
+//Patient Status: [src.victim.stat ? "Non-Responsive" : "Awake"]
+//Heartbeat rate: [victim.get_pulse(GETPULSE_TOOL)]
+//"} +// else +// src.victim = null +// dat += {" +//Patient Information:
+//
+//No Patient Detected +//"} +// user << browse(dat, "window=op") +// onclose(user, "op") + +/obj/machinery/computer/operating/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)//ui is mostly copy pasta from the sleeper ui + var/data[0] + var/mob/living/carbon/human/occupant = src.table.victim + data["hasOccupant"] = occupant ? 1 : 0 + var/occupantData[0] + + if (occupant) + occupantData["name"] = occupant.name + occupantData["stat"] = occupant.stat + occupantData["health"] = occupant.health + occupantData["maxHealth"] = occupant.maxHealth + occupantData["minHealth"] = config.health_threshold_dead + occupantData["bruteLoss"] = occupant.getBruteLoss() + occupantData["oxyLoss"] = occupant.getOxyLoss() + occupantData["toxLoss"] = occupant.getToxLoss() + occupantData["fireLoss"] = occupant.getFireLoss() + occupantData["paralysis"] = occupant.paralysis + occupantData["hasBlood"] = 0 + occupantData["bodyTemperature"] = occupant.bodytemperature + occupantData["maxTemp"] = 1000 // If you get a burning vox armalis into the sleeper, congratulations + // Because we can put simple_animals in here, we need to do something tricky to get things working nice + occupantData["temperatureSuitability"] = 0 // 0 is the baseline + if (ishuman(occupant) && occupant.species) + var/datum/species/sp = occupant.species + if (occupant.bodytemperature < sp.cold_level_3) + occupantData["temperatureSuitability"] = -3 + else if (occupant.bodytemperature < sp.cold_level_2) + occupantData["temperatureSuitability"] = -2 + else if (occupant.bodytemperature < sp.cold_level_1) + occupantData["temperatureSuitability"] = -1 + else if (occupant.bodytemperature > sp.heat_level_3) + occupantData["temperatureSuitability"] = 3 + else if (occupant.bodytemperature > sp.heat_level_2) + occupantData["temperatureSuitability"] = 2 + else if (occupant.bodytemperature > sp.heat_level_1) + occupantData["temperatureSuitability"] = 1 + else if (istype(occupant, /mob/living/simple_animal)) + var/mob/living/simple_animal/silly = occupant + if (silly.bodytemperature < silly.minbodytemp) + occupantData["temperatureSuitability"] = -3 + else if (silly.bodytemperature > silly.maxbodytemp) + occupantData["temperatureSuitability"] = 3 + // Blast you, imperial measurement system + occupantData["btCelsius"] = occupant.bodytemperature - T0C + occupantData["btFaren"] = ((occupant.bodytemperature - T0C) * (9.0/5.0))+ 32 + + + if (ishuman(occupant) && occupant.vessel && !(occupant.species && occupant.species.flags & NO_BLOOD)) + occupantData["pulse"] = occupant.get_pulse(GETPULSE_TOOL) + occupantData["hasBlood"] = 1 + occupantData["bloodLevel"] = round(occupant.vessel.get_reagent_amount("blood")) + occupantData["bloodMax"] = occupant.max_blood + occupantData["bloodPercent"] = round(100*(occupant.vessel.get_reagent_amount("blood")/occupant.max_blood), 0.01) //copy pasta ends here + + data["occupant"] = occupantData + data["verbose"]=verbose + data["oxyAlarm"]=oxyAlarm + data["choice"]=choice + data["health"]=healthAnnounce + data["crit"]=crit + + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) + if (!ui) + ui = new(user, src, ui_key, "op_computer.tmpl", "Patient Monitor", 650, 655) + ui.set_initial_data(data) + ui.open() + ui.set_auto_update(1) -/obj/machinery/computer/operating/interact(mob/user) - if ( ((get_dist(src, user) > 1) && !isobserver(user)) || (stat & (BROKEN|NOPOWER)) ) - if (!istype(user, /mob/living/silicon)) - user.unset_machine() - user << browse(null, "window=op") - return - user.set_machine(src) - var/dat = "Operating Computer\n" - dat += "Close

" //| Update" - if(src.table && (src.table.check_victim())) - src.victim = src.table.victim - dat += {" -Patient Information:
-
-Name: [src.victim.real_name]
-Age: [src.victim.age]
-Blood Type: [src.victim.b_type]
-
-Health: [src.victim.health]
-Brute Damage: [src.victim.getBruteLoss()]
-Toxins Damage: [src.victim.getToxLoss()]
-Fire Damage: [src.victim.getFireLoss()]
-Suffocation Damage: [src.victim.getOxyLoss()]
-Patient Status: [src.victim.stat ? "Non-Responsive" : "Stable"]
-Heartbeat rate: [victim.get_pulse(GETPULSE_TOOL)]
-"} - else - src.victim = null - dat += {" -Patient Information:
-
-No Patient Detected -"} - user << browse(dat, "window=op") - onclose(user, "op") /obj/machinery/computer/operating/Topic(href, href_list) @@ -82,9 +159,43 @@ return 1 if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon))) usr.set_machine(src) + + if(href_list["verboseOn"]) + verbose=1 + if(href_list["verboseOff"]) + verbose=0 + if(href_list["healthOn"]) + healthAnnounce=1 + if(href_list["healthOff"]) + healthAnnounce=0 + if(href_list["critOn"]) + crit=1 + if(href_list["critOff"]) + crit=0 + if(href_list["oxy_adj"]!=0) + oxyAlarm=oxyAlarm+text2num(href_list["oxy_adj"]) + if(href_list["choiceOn"]) + choice=1 + if(href_list["choiceOff"]) + choice=0 return /obj/machinery/computer/operating/process() - if(..()) - src.updateDialog() + + if(src.table && src.table.check_victim()) + if(verbose) + if(patientName!=src.table.victim.name) + patientName=src.table.victim.name + atom_say("New patient detected, loading stats") + src.victim = src.table.victim + sleep(10) + atom_say("[src.victim.real_name], [src.victim.b_type] blood, [src.victim.stat ? "Non-Responsive" : "Awake"]") + atom_say("[round(src.victim.health)]") + if(src.victim.health <= -50 && crit) + playsound(src.loc, 'sound/machines/defib_success.ogg', 50, 0) + if(src.victim.getOxyLoss()>oxyAlarm) + playsound(src.loc, 'sound/machines/defib_saftyOff.ogg', 50, 0) + if(healthAnnounce) + atom_say("[round(src.victim.health)]") + sleep(60) \ No newline at end of file diff --git a/html/changelogs/pinatacolada-pr-usefulishsurgerycomputers.yml b/html/changelogs/pinatacolada-pr-usefulishsurgerycomputers.yml new file mode 100644 index 00000000000..70246bcf1fd --- /dev/null +++ b/html/changelogs/pinatacolada-pr-usefulishsurgerycomputers.yml @@ -0,0 +1,37 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. Remove the quotation mark and put in your name when copy+pasting the example changelog. +author: "pinatacolada" + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Adds NanoUI to the operating computer" + - rscadd: "Adds health announcing, critical and oxygen damage aural alerts to the computer, with a menu to selectively turn them on and off" + diff --git a/nano/templates/op_computer.tmpl b/nano/templates/op_computer.tmpl new file mode 100644 index 00000000000..252c8f5fd75 --- /dev/null +++ b/nano/templates/op_computer.tmpl @@ -0,0 +1,171 @@ + +

Patient Monitor

+ +
+ {{if data.choice==0}} + {{if !data.hasOccupant}} +
No Patient Detected
+ {{else}} +
+ {{:data.occupant.name}} =>  + {{if data.occupant.stat == 0}} + Conscious + {{else data.occupant.stat == 1}} + Unconscious + {{else}} + DEAD + {{/if}} +
+ +
+
Health:
+ {{if data.occupant.health >= data.occupant.maxHealth}} + {{:helper.displayBar(data.occupant.health, 0, data.occupant.maxHealth, 'good')}} + {{else data.occupant.health > 0}} + {{:helper.displayBar(data.occupant.health, 0, data.occupant.maxHealth, 'average')}} + {{else data.occupant.health >= data.minhealth}} + {{:helper.displayBar(data.occupant.health, 0, data.occupant.minHealth, 'average alignRight')}} + {{else}} + {{:helper.displayBar(data.occupant.health, 0, data.occupant.minHealth, 'bad alignRight')}} + {{/if}} +
{{:helper.round(data.occupant.health)}}
+
+ +
+
Brute Damage:
+ {{:helper.displayBar(data.occupant.bruteLoss, 0, data.occupant.maxHealth, 'bad')}} +
{{:helper.round(data.occupant.bruteLoss)}}
+
+ +
+
Resp. Damage:
+ {{:helper.displayBar(data.occupant.oxyLoss, 0, data.occupant.maxHealth, 'bad')}} +
{{:helper.round(data.occupant.oxyLoss)}}
+
+ +
+
Toxin Damage:
+ {{:helper.displayBar(data.occupant.toxLoss, 0, data.occupant.maxHealth, 'bad')}} +
{{:helper.round(data.occupant.toxLoss)}}
+
+ +
+
Burn Severity:
+ {{:helper.displayBar(data.occupant.fireLoss, 0, data.occupant.maxHealth, 'bad')}} +
{{:helper.round(data.occupant.fireLoss)}}
+
+ +
+
Patient Temperature:
+ {{if data.occupant.temperatureSuitability == -3}} + {{:helper.displayBar(data.occupant.bodyTemperature, 0, data.occupant.maxTemp, 'bad')}} +
{{:helper.round(data.occupant.btCelsius)}}°C, {{:helper.round(data.occupant.btFaren)}}°F
+ {{else data.occupant.temperatureSuitability == -2}} + {{:helper.displayBar(data.occupant.bodyTemperature, 0, data.occupant.maxTemp, 'average')}} +
{{:helper.round(data.occupant.btCelsius)}}°C, {{:helper.round(data.occupant.btFaren)}}°F
+ {{else data.occupant.temperatureSuitability == -1}} + {{:helper.displayBar(data.occupant.bodyTemperature, 0, data.occupant.maxTemp, 'average')}} +
{{:helper.round(data.occupant.btCelsius)}}°C, {{:helper.round(data.occupant.btFaren)}}°F
+ {{else data.occupant.temperatureSuitability == 0}} + {{:helper.displayBar(data.occupant.bodyTemperature, 0, data.occupant.maxTemp, 'good')}} +
{{:helper.round(data.occupant.btCelsius)}}°C, {{:helper.round(data.occupant.btFaren)}}°F
+ {{else data.occupant.temperatureSuitability == 1}} + {{:helper.displayBar(data.occupant.bodyTemperature, 0, data.occupant.maxTemp, 'average')}} +
{{:helper.round(data.occupant.btCelsius)}}°C, {{:helper.round(data.occupant.btFaren)}}°F
+ {{else data.occupant.temperatureSuitability == 2}} + {{:helper.displayBar(data.occupant.bodyTemperature, 0, data.occupant.maxTemp, 'average')}} +
{{:helper.round(data.occupant.btCelsius)}}°C, {{:helper.round(data.occupant.btFaren)}}°F
+ {{else data.occupant.temperatureSuitability == 3}} + {{:helper.displayBar(data.occupant.bodyTemperature, 0, data.occupant.maxTemp, 'bad')}} +
{{:helper.round(data.occupant.btCelsius)}}°C, {{:helper.round(data.occupant.btFaren)}}°F
+ {{/if}} +
+ {{if data.occupant.hasBlood}} +
+
+
Blood Level:
+ {{if data.occupant.bloodPercent <= 60}} + {{:helper.displayBar(data.occupant.bloodLevel, 0, data.occupant.bloodMax, 'bad')}} +
+ {{:data.occupant.bloodPercent}}%, {{:data.occupant.bloodLevel}}cl +
+ {{else data.occupant.bloodPercent <= 90}} + {{:helper.displayBar(data.occupant.bloodLevel, 0, data.occupant.bloodMax, 'average')}} +
+ {{:data.occupant.bloodPercent}}%, {{:data.occupant.bloodLevel}}cl +
+ {{else}} + {{:helper.displayBar(data.occupant.bloodLevel, 0, data.occupant.bloodMax, 'good')}} +
+ {{:data.occupant.bloodPercent}}%, {{:data.occupant.bloodLevel}}cl +
+ {{/if}} +
+
+
Pulse:
{{:data.occupant.pulse}} bpm
+
+ {{/if}} + +
+
+ {{/if}} +
+
+ {{:helper.link('Options', 'gear', {'choiceOn' : 1})}} +
+
+ {{else}} +
+
+ Loudspeaker: +
+
+ {{:helper.link('On', 'power-off', {'verboseOn' : 1}, data.verbose ? 'selected' : null)}} + {{:helper.link('Off', 'close', {'verboseOff' : 1}, data.verbose ? null : 'selected')}} +
+
+ +
+
+ Health Announcer: +
+
+ {{:helper.link('On', 'power-off', {'healthOn' : 1}, data.health ? 'selected' : null)}} + {{:helper.link('Off', 'close', {'healthOff' : 1}, data.health ? null : 'selected')}} +
+
+ +
+
+ Critical Alert: +
+
+ {{:helper.link('On', 'power-off', {'critOn' : 1}, data.crit ? 'selected' : null)}} + {{:helper.link('Off', 'close', {'critOff' : 1}, data.crit ? null : 'selected')}} +
+
+ +
+
+
Oxygen Alert Threshold:
+ {{:helper.link('-', null, {'oxy_adj' : -100}, (data.oxyAlarm >= 100) ? null : 'disabled')}} + {{:helper.link('-', null, {'oxy_adj' : -10}, (data.oxyAlarm >= 10) ? null : 'disabled')}} + {{:helper.link('-', null, {'oxy_adj' : -1}, (data.oxyAlarm >= 0) ? null : 'disabled')}} + {{:helper.displayBar( data.oxyAlarm, 0, 200, 'good')}} + {{:helper.link('+', null, {'oxy_adj' : 1}, (data.oxyAlarm < 200) ? null : 'disabled')}} + {{:helper.link('+', null, {'oxy_adj' : 10}, (data.oxyAlarm <= 190) ? null : 'disabled')}} + {{:helper.link('+', null, {'oxy_adj' : 100}, (data.oxyAlarm <= 100) ? null : 'disabled')}} +
 {{: data.oxyAlarm }}  
+
+
+ +
+
+ {{:helper.link('Return', 'arrow-left', {'choiceOff' : 1})}} +
+
+ {{/if}} +
\ No newline at end of file From feacb84b3a482be8ff44089eff3299c0116d7219 Mon Sep 17 00:00:00 2001 From: pinatacolada Date: Sun, 24 Jan 2016 14:19:21 +0000 Subject: [PATCH 2/5] updated to reflect what Fox pointed out also added a thing to show the blood type on the UI that I left out as an oversight --- code/game/machinery/computer/Operating.dm | 34 ++++++++++++----------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm index 7620059b64c..1c45a8b404c 100644 --- a/code/game/machinery/computer/Operating.dm +++ b/code/game/machinery/computer/Operating.dm @@ -1,4 +1,5 @@ //This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 +#define OP_COMPUTER_COOLDOWN 60 /obj/machinery/computer/operating name = "operating computer" @@ -16,7 +17,7 @@ var/choice = 0 //just for going into and out of the options menu var/healthAnnounce = 1 //healther announcer toggle var/crit = 1 //crit beeping toggle - + var/nextTick = OP_COMPUTER_COOLDOWN /obj/machinery/computer/operating/New() ..() @@ -128,7 +129,6 @@ occupantData["btCelsius"] = occupant.bodytemperature - T0C occupantData["btFaren"] = ((occupant.bodytemperature - T0C) * (9.0/5.0))+ 32 - if (ishuman(occupant) && occupant.vessel && !(occupant.species && occupant.species.flags & NO_BLOOD)) occupantData["pulse"] = occupant.get_pulse(GETPULSE_TOOL) occupantData["hasBlood"] = 1 @@ -136,6 +136,8 @@ occupantData["bloodMax"] = occupant.max_blood occupantData["bloodPercent"] = round(100*(occupant.vessel.get_reagent_amount("blood")/occupant.max_blood), 0.01) //copy pasta ends here + occupantData["bloodType"]=occupant.b_type + data["occupant"] = occupantData data["verbose"]=verbose data["oxyAlarm"]=oxyAlarm @@ -143,6 +145,7 @@ data["health"]=healthAnnounce data["crit"]=crit + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) if (!ui) ui = new(user, src, ui_key, "op_computer.tmpl", "Patient Monitor", 650, 655) @@ -183,19 +186,18 @@ /obj/machinery/computer/operating/process() - if(src.table && src.table.check_victim()) + if(table && table.check_victim()) if(verbose) - if(patientName!=src.table.victim.name) - patientName=src.table.victim.name + if(patientName!=table.victim.name) + patientName=table.victim.name atom_say("New patient detected, loading stats") - src.victim = src.table.victim - sleep(10) - atom_say("[src.victim.real_name], [src.victim.b_type] blood, [src.victim.stat ? "Non-Responsive" : "Awake"]") - atom_say("[round(src.victim.health)]") - if(src.victim.health <= -50 && crit) - playsound(src.loc, 'sound/machines/defib_success.ogg', 50, 0) - if(src.victim.getOxyLoss()>oxyAlarm) - playsound(src.loc, 'sound/machines/defib_saftyOff.ogg', 50, 0) - if(healthAnnounce) - atom_say("[round(src.victim.health)]") - sleep(60) \ No newline at end of file + victim = table.victim + atom_say("[victim.real_name], [victim.b_type] blood, [victim.stat ? "Non-Responsive" : "Awake"]") + if(nextTick < world.time) + nextTick=world.time + OP_COMPUTER_COOLDOWN + if(victim.health <= -50 && crit) + playsound(src.loc, 'sound/machines/defib_success.ogg', 50, 0) + if(src.victim.getOxyLoss()>oxyAlarm) + playsound(src.loc, 'sound/machines/defib_saftyOff.ogg', 50, 0) + if(healthAnnounce) + atom_say("[round(victim.health)]") From 6349e3118f6725a918e2c08a0db34dd168a4b43b Mon Sep 17 00:00:00 2001 From: pinatacolada Date: Sun, 24 Jan 2016 14:20:53 +0000 Subject: [PATCH 3/5] updated to add blood type to the UI --- nano/templates/op_computer.tmpl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nano/templates/op_computer.tmpl b/nano/templates/op_computer.tmpl index 252c8f5fd75..e34ccd8d85a 100644 --- a/nano/templates/op_computer.tmpl +++ b/nano/templates/op_computer.tmpl @@ -102,6 +102,9 @@ Used In File(s): \code\game\machinery\computer\Operating.dm
{{:data.occupant.bloodPercent}}%, {{:data.occupant.bloodLevel}}cl
+
+
Blood Type:
{{:data.occupant.bloodType}}
+
{{/if}}
@@ -168,4 +171,4 @@ Used In File(s): \code\game\machinery\computer\Operating.dm
{{/if}} - \ No newline at end of file + From 2c7fb828ec38e3aa1f323bc5b7855fc99b74381b Mon Sep 17 00:00:00 2001 From: pinatacolada Date: Wed, 27 Jan 2016 17:49:19 +0000 Subject: [PATCH 4/5] Adds a threshold for the health announcer also fixes a minor bug where blood type wouldn't show if the patient had less than 60%, and made it a bit more organized overall --- nano/templates/op_computer.tmpl | 54 +++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/nano/templates/op_computer.tmpl b/nano/templates/op_computer.tmpl index e34ccd8d85a..027fdf3443b 100644 --- a/nano/templates/op_computer.tmpl +++ b/nano/templates/op_computer.tmpl @@ -102,10 +102,10 @@ Used In File(s): \code\game\machinery\computer\Operating.dm
{{:data.occupant.bloodPercent}}%, {{:data.occupant.bloodLevel}}cl
+ {{/if}}
Blood Type:
{{:data.occupant.bloodType}}
- {{/if}}
Pulse:
{{:data.occupant.pulse}} bpm
@@ -130,7 +130,7 @@ Used In File(s): \code\game\machinery\computer\Operating.dm {{:helper.link('Off', 'close', {'verboseOff' : 1}, data.verbose ? null : 'selected')}}
- +
Health Announcer: @@ -142,15 +142,39 @@ Used In File(s): \code\game\machinery\computer\Operating.dm
-
- Critical Alert: -
-
- {{:helper.link('On', 'power-off', {'critOn' : 1}, data.crit ? 'selected' : null)}} - {{:helper.link('Off', 'close', {'critOff' : 1}, data.crit ? null : 'selected')}} +
+
Health Announcer Threshold:
+ {{:helper.link('-', null, {'health_adj' : -100}, (data.healthAlarm >= 0) ? null : 'disabled')}} + {{:helper.link('-', null, {'health_adj' : -10}, (data.healthAlarm >= -90) ? null : 'disabled')}} + {{:helper.link('-', null, {'health_adj' : -1}, (data.healthAlarm > -100) ? null : 'disabled')}} + + {{if data.healthAlarm >= 100}} + {{:helper.displayBar(data.healthAlarm, 0, 100, 'good')}} + {{else data.healthAlarm > 0}} + {{:helper.displayBar(data.healthAlarm, 0, 100, 'average')}} + {{else data.healthAlarm >= -100}} + {{:helper.displayBar(data.healthAlarm, 0, -100, 'average alignRight')}} + {{else}} + {{:helper.displayBar(data.healthAlarm, 0, -100, 'bad alignRight')}} + {{/if}} + + {{:helper.link('+', null, {'health_adj' : 1}, (data.healthAlarm < 100) ? null : 'disabled')}} + {{:helper.link('+', null, {'health_adj' : 10}, (data.healthAlarm <= 90) ? null : 'disabled')}} + {{:helper.link('+', null, {'health_adj' : 100}, (data.healthAlarm <= 0) ? null : 'disabled')}} +
 {{: data.healthAlarm }}  
- +
+
+
+ Oxygen Alarm: +
+
+ {{:helper.link('On', 'power-off', {'oxyOn' : 1}, data.oxy ? 'selected' : null)}} + {{:helper.link('Off', 'close', {'oxyOff' : 1}, data.oxy ? null : 'selected')}} +
+
+
Oxygen Alert Threshold:
@@ -164,7 +188,17 @@ Used In File(s): \code\game\machinery\computer\Operating.dm
 {{: data.oxyAlarm }}  
- +
+
+
+ Critical Alert: +
+
+ {{:helper.link('On', 'power-off', {'critOn' : 1}, data.crit ? 'selected' : null)}} + {{:helper.link('Off', 'close', {'critOff' : 1}, data.crit ? null : 'selected')}} +
+
+
{{:helper.link('Return', 'arrow-left', {'choiceOff' : 1})}} From 8d7011cd3831a834d8172982fae18da7f4fe16f9 Mon Sep 17 00:00:00 2001 From: pinatacolada Date: Wed, 27 Jan 2016 17:49:57 +0000 Subject: [PATCH 5/5] Adds a threshold for the health announcer --- code/game/machinery/computer/Operating.dm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm index 1c45a8b404c..5251898e7c7 100644 --- a/code/game/machinery/computer/Operating.dm +++ b/code/game/machinery/computer/Operating.dm @@ -18,6 +18,8 @@ var/healthAnnounce = 1 //healther announcer toggle var/crit = 1 //crit beeping toggle var/nextTick = OP_COMPUTER_COOLDOWN + var/healthAlarm = 50 + var/oxy = 1 //oxygen beeping toggle /obj/machinery/computer/operating/New() ..() @@ -144,11 +146,12 @@ data["choice"]=choice data["health"]=healthAnnounce data["crit"]=crit - + data["healthAlarm"]=healthAlarm + data["oxy"]=oxy ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) if (!ui) - ui = new(user, src, ui_key, "op_computer.tmpl", "Patient Monitor", 650, 655) + ui = new(user, src, ui_key, "op_computer.tmpl", "Patient Monitor", 650, 455) ui.set_initial_data(data) ui.open() ui.set_auto_update(1) @@ -175,12 +178,18 @@ crit=1 if(href_list["critOff"]) crit=0 + if(href_list["oxyOn"]) + oxy=1 + if(href_list["oxyOff"]) + oxy=0 if(href_list["oxy_adj"]!=0) oxyAlarm=oxyAlarm+text2num(href_list["oxy_adj"]) if(href_list["choiceOn"]) choice=1 if(href_list["choiceOff"]) choice=0 + if(href_list["health_adj"]!=0) + healthAlarm=healthAlarm+text2num(href_list["health_adj"]) return @@ -195,9 +204,9 @@ atom_say("[victim.real_name], [victim.b_type] blood, [victim.stat ? "Non-Responsive" : "Awake"]") if(nextTick < world.time) nextTick=world.time + OP_COMPUTER_COOLDOWN - if(victim.health <= -50 && crit) + if(crit && victim.health <= -50 ) playsound(src.loc, 'sound/machines/defib_success.ogg', 50, 0) - if(src.victim.getOxyLoss()>oxyAlarm) + if(oxy && victim.getOxyLoss()>oxyAlarm) playsound(src.loc, 'sound/machines/defib_saftyOff.ogg', 50, 0) - if(healthAnnounce) + if(healthAnnounce && victim.health <= healthAlarm) atom_say("[round(victim.health)]")