From a2669d6791c324f4c768effffbc86d941ea5d65e Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Sun, 25 Oct 2015 14:09:03 -0700 Subject: [PATCH] Sleeper now has a temperature and pulse readout --- code/game/machinery/Sleeper.dm | 87 +++++++++++++--------------------- nano/css/shared.css | 25 ++++++++++ nano/templates/sleeper.tmpl | 58 +++++++++++++++++++++++ 3 files changed, 117 insertions(+), 53 deletions(-) diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index bc7e13343e6..3d645492681 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -115,56 +115,6 @@ if (src.connected) ui_interact(user) - /* - var/mob/living/occupant = src.connected.occupant - var/dat = "Occupant Statistics:
" - if (occupant) - var/t1 - switch(occupant.stat) - if(0) - t1 = "Conscious" - if(1) - t1 = "Unconscious" - if(2) - t1 = "*dead*" - else - dat += text("[]\tHealth %: [] ([])
", (occupant.health > 50 ? "" : ""), occupant.health, t1) - if(iscarbon(occupant)) - var/mob/living/carbon/C = occupant - dat += text("[]\t-Pulse, bpm: []
", (C.pulse == PULSE_NONE || C.pulse == PULSE_THREADY ? "" : ""), C.get_pulse(GETPULSE_TOOL)) - dat += text("[]\t-Brute Damage %: []
", (occupant.getBruteLoss() < 60 ? "" : ""), occupant.getBruteLoss()) - dat += text("[]\t-Respiratory Damage %: []
", (occupant.getOxyLoss() < 60 ? "" : ""), occupant.getOxyLoss()) - dat += text("[]\t-Toxin Content %: []
", (occupant.getToxLoss() < 60 ? "" : ""), occupant.getToxLoss()) - dat += text("[]\t-Burn Severity %: []
", (occupant.getFireLoss() < 60 ? "" : ""), occupant.getFireLoss()) - dat += text("
Paralysis Summary %: [] ([] seconds left!)
", occupant.paralysis, round(occupant.paralysis / 4)) - if(occupant.reagents) - for(var/chemical in connected.injection_chems) - var/datum/reagent/C = chemical_reagents_list[chemical] - dat += "[C.name]: [occupant.reagents.get_reagent_amount(chemical)] units
" - dat += "Refresh Meter Readings
" - if(src.connected.beaker) - dat += "
Remove Beaker
" - if(src.connected.filtering) - dat += "Stop Dialysis
" - dat += text("Output Beaker has [] units of free space remaining

", src.connected.beaker.reagents.maximum_volume - src.connected.beaker.reagents.total_volume) - else - dat += "
Start Dialysis
" - dat += text("Output Beaker has [] units of free space remaining

", src.connected.beaker.reagents.maximum_volume - src.connected.beaker.reagents.total_volume) - else - dat += "
No Dialysis Output Beaker is present.

" - for(var/chemical in connected.injection_chems) - var/datum/reagent/C = chemical_reagents_list[chemical] - dat += "Inject [C.name]: " - for(var/amount in connected.amounts) - dat += "[amount] units
" - dat += "
Eject Patient" - else - dat += "The sleeper is empty." - dat += text("

Close", user) - user << browse(dat, "window=sleeper;size=400x500") - onclose(user, "sleeper") - */ - return /obj/machinery/sleep_console/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) var/data[0] @@ -182,13 +132,44 @@ occupantData["oxyLoss"] = occupant.getOxyLoss() occupantData["toxLoss"] = occupant.getToxLoss() occupantData["fireLoss"] = occupant.getFireLoss() - occupantData["bodyTemperature"] = occupant.bodytemperature 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) + // I wanna do something where the bar gets bluer as the temperature gets lower + // For now, I'll just use the standard format for the temperature status + 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 + + crisis = (occupant.health < connected.min_health) // I'm not sure WHY you'd want to put a simple_animal in a sleeper, but precedent is precedent // Runtime is aptly named, isn't she? - if (ishuman(occupant) && !(occupant.species.flags & NO_BLOOD) && occupant.vessel) + 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 @@ -223,7 +204,7 @@ overdosing = 1 // Because I don't know how to do this on the nano side - pretty_amount = round(reagent_amount, 0.1) + pretty_amount = round(reagent_amount, 0.05) chemicals.Add(list(list("title" = temp.name, "id" = temp.id, "commands" = list("chemical" = temp.id), "occ_amount" = reagent_amount, "pretty_amount" = pretty_amount, "injectable" = injectable, "overdosing" = overdosing, "od_warning" = caution))) data["chemicals"] = chemicals diff --git a/nano/css/shared.css b/nano/css/shared.css index 786b577e615..b9ceac02814 100644 --- a/nano/css/shared.css +++ b/nano/css/shared.css @@ -606,4 +606,29 @@ th.misc { .Pearl { color: #C6CACB; +} + +/* Status bar colors for sleeper temperatures */ +.cold1 { + color: #94B8FF; +} + +.cold2 { + color: #6699FF; +} + +.cold3 { + color: #293D66; +} + +.hot1 { + color: #FF9966; +} + +.hot2 { + color: #993D00; +} + +.hot3 { + color: #FF6600; } \ No newline at end of file diff --git a/nano/templates/sleeper.tmpl b/nano/templates/sleeper.tmpl index 6b480301393..efe73830ea9 100644 --- a/nano/templates/sleeper.tmpl +++ b/nano/templates/sleeper.tmpl @@ -56,9 +56,67 @@ Used In File(s): \code\game\machinery\Sleeper.dm {{: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}}
+
+
Pulse:
{{:data.occupant.pulse}} bpm
+
Blood Level:
{{if data.occupant.bloodPercent <= 60}}