Merge pull request #6518 from faerindel/adv_scanner_print

Adds printing occupant status option to bodyscanners.
This commit is contained in:
Zuhayr
2014-09-28 22:15:15 +09:30
2 changed files with 206 additions and 152 deletions
+205 -151
View File
@@ -9,7 +9,7 @@
icon_state = "body_scanner_0"
density = 1
anchored = 1
use_power = 1
idle_power_usage = 60
active_power_usage = 10000 //10 kW. It's a big all-body scanner.
@@ -226,10 +226,10 @@
if(!connected || (connected.stat & (NOPOWER|BROKEN)))
user << "\red This console is not connected to a functioning body scanner."
return
if(!ishuman(connected.occupant))
user << "\red This device can only scan compatible lifeforms."
return
var/dat
if (src.delete && src.temphtml) //Window in buffer but its just simple message, so nothing
src.delete = src.delete
@@ -237,156 +237,210 @@
dat = text("[]<BR><BR><A href='?src=\ref[];clear=1'>Main Menu</A>", src.temphtml, src)
else
if (src.connected) //Is something connected?
var/mob/living/carbon/human/occupant = src.connected.occupant
dat = "<font color='blue'><B>Occupant Statistics:</B></FONT><BR>" //Blah obvious
if (istype(occupant)) //is there REALLY someone in there?
var/t1
switch(occupant.stat) // obvious, see what their status is
if(0)
t1 = "Conscious"
if(1)
t1 = "Unconscious"
else
t1 = "*dead*"
if (!istype(occupant,/mob/living/carbon/human))
dat += "<font color='red'>This device can only scan human occupants.</FONT>"
else
dat += text("[]\tHealth %: [] ([])</FONT><BR>", (occupant.health > 50 ? "<font color='blue'>" : "<font color='red'>"), occupant.health, t1)
if(occupant.virus2.len)
dat += text("<font color='red'>Viral pathogen detected in blood stream.</font><BR>")
dat += text("[]\t-Brute Damage %: []</FONT><BR>", (occupant.getBruteLoss() < 60 ? "<font color='blue'>" : "<font color='red'>"), occupant.getBruteLoss())
dat += text("[]\t-Respiratory Damage %: []</FONT><BR>", (occupant.getOxyLoss() < 60 ? "<font color='blue'>" : "<font color='red'>"), occupant.getOxyLoss())
dat += text("[]\t-Toxin Content %: []</FONT><BR>", (occupant.getToxLoss() < 60 ? "<font color='blue'>" : "<font color='red'>"), occupant.getToxLoss())
dat += text("[]\t-Burn Severity %: []</FONT><BR><BR>", (occupant.getFireLoss() < 60 ? "<font color='blue'>" : "<font color='red'>"), occupant.getFireLoss())
dat += text("[]\tRadiation Level %: []</FONT><BR>", (occupant.radiation < 10 ?"<font color='blue'>" : "<font color='red'>"), occupant.radiation)
dat += text("[]\tGenetic Tissue Damage %: []</FONT><BR>", (occupant.getCloneLoss() < 1 ?"<font color='blue'>" : "<font color='red'>"), occupant.getCloneLoss())
dat += text("[]\tApprox. Brain Damage %: []</FONT><BR>", (occupant.getBrainLoss() < 1 ?"<font color='blue'>" : "<font color='red'>"), occupant.getBrainLoss())
dat += text("Paralysis Summary %: [] ([] seconds left!)<BR>", occupant.paralysis, round(occupant.paralysis / 4))
dat += text("Body Temperature: [occupant.bodytemperature-T0C]&deg;C ([occupant.bodytemperature*1.8-459.67]&deg;F)<BR><HR>")
if(occupant.has_brain_worms())
dat += "Large growth detected in frontal lobe, possibly cancerous. Surgical removal is recommended.<BR/>"
if(occupant.vessel)
var/blood_volume = round(occupant.vessel.get_reagent_amount("blood"))
var/blood_percent = blood_volume / 560
blood_percent *= 100
dat += text("[]\tBlood Level %: [] ([] units)</FONT><BR>", (blood_volume > 448 ?"<font color='blue'>" : "<font color='red'>"), blood_percent, blood_volume)
if(occupant.reagents)
dat += text("Inaprovaline units: [] units<BR>", occupant.reagents.get_reagent_amount("inaprovaline"))
dat += text("Soporific: [] units<BR>", occupant.reagents.get_reagent_amount("stoxin"))
dat += text("[]\tDermaline: [] units</FONT><BR>", (occupant.reagents.get_reagent_amount("dermaline") < 30 ? "<font color='black'>" : "<font color='red'>"), occupant.reagents.get_reagent_amount("dermaline"))
dat += text("[]\tBicaridine: [] units<BR>", (occupant.reagents.get_reagent_amount("bicaridine") < 30 ? "<font color='black'>" : "<font color='red'>"), occupant.reagents.get_reagent_amount("bicaridine"))
dat += text("[]\tDexalin: [] units<BR>", (occupant.reagents.get_reagent_amount("dexalin") < 30 ? "<font color='black'>" : "<font color='red'>"), occupant.reagents.get_reagent_amount("dexalin"))
for(var/datum/disease/D in occupant.viruses)
if(!D.hidden[SCANNER])
dat += text("<font color='red'><B>Warning: [D.form] Detected</B>\nName: [D.name].\nType: [D.spread].\nStage: [D.stage]/[D.max_stages].\nPossible Cure: [D.cure]</FONT><BR>")
dat += "<HR><table border='1'>"
dat += "<tr>"
dat += "<th>Organ</th>"
dat += "<th>Burn Damage</th>"
dat += "<th>Brute Damage</th>"
dat += "<th>Other Wounds</th>"
dat += "</tr>"
for(var/datum/organ/external/e in occupant.organs)
dat += "<tr>"
var/AN = ""
var/open = ""
var/infected = ""
var/imp = ""
var/bled = ""
var/robot = ""
var/splint = ""
var/internal_bleeding = ""
var/lung_ruptured = ""
for(var/datum/wound/W in e.wounds) if(W.internal)
internal_bleeding = "<br>Internal bleeding"
break
if(istype(e, /datum/organ/external/chest) && occupant.is_lung_ruptured())
lung_ruptured = "Lung ruptured:"
if(e.status & ORGAN_SPLINTED)
splint = "Splinted:"
if(e.status & ORGAN_BLEEDING)
bled = "Bleeding:"
if(e.status & ORGAN_BROKEN)
AN = "[e.broken_description]:"
if(e.status & ORGAN_ROBOT)
robot = "Prosthetic:"
if(e.open)
open = "Open:"
switch (e.germ_level)
if (INFECTION_LEVEL_ONE to INFECTION_LEVEL_ONE + 200)
infected = "Mild Infection:"
if (INFECTION_LEVEL_ONE + 200 to INFECTION_LEVEL_ONE + 300)
infected = "Mild Infection+:"
if (INFECTION_LEVEL_ONE + 300 to INFECTION_LEVEL_ONE + 400)
infected = "Mild Infection++:"
if (INFECTION_LEVEL_TWO to INFECTION_LEVEL_TWO + 200)
infected = "Acute Infection:"
if (INFECTION_LEVEL_TWO + 200 to INFECTION_LEVEL_TWO + 300)
infected = "Acute Infection+:"
if (INFECTION_LEVEL_TWO + 300 to INFECTION_LEVEL_TWO + 400)
infected = "Acute Infection++:"
if (INFECTION_LEVEL_THREE to INFINITY)
infected = "Septic:"
var/unknown_body = 0
for(var/I in e.implants)
if(is_type_in_list(I,known_implants))
imp += "[I] implanted:"
else
unknown_body++
if(unknown_body || e.hidden)
imp += "Unknown body present:"
if(!AN && !open && !infected & !imp)
AN = "None:"
if(!(e.status & ORGAN_DESTROYED))
dat += "<td>[e.display_name]</td><td>[e.burn_dam]</td><td>[e.brute_dam]</td><td>[robot][bled][AN][splint][open][infected][imp][internal_bleeding][lung_ruptured]</td>"
else
dat += "<td>[e.display_name]</td><td>-</td><td>-</td><td>Not Found</td>"
dat += "</tr>"
for(var/datum/organ/internal/i in occupant.internal_organs)
var/mech = ""
if(i.robotic == 1)
mech = "Assisted:"
if(i.robotic == 2)
mech = "Mechanical:"
var/infection = "None"
switch (i.germ_level)
if (1 to INFECTION_LEVEL_ONE + 200)
infection = "Mild Infection:"
if (INFECTION_LEVEL_ONE + 200 to INFECTION_LEVEL_ONE + 300)
infection = "Mild Infection+:"
if (INFECTION_LEVEL_ONE + 300 to INFECTION_LEVEL_ONE + 400)
infection = "Mild Infection++:"
if (INFECTION_LEVEL_TWO to INFECTION_LEVEL_TWO + 200)
infection = "Acute Infection:"
if (INFECTION_LEVEL_TWO + 200 to INFECTION_LEVEL_TWO + 300)
infection = "Acute Infection+:"
if (INFECTION_LEVEL_TWO + 300 to INFINITY)
infection = "Acute Infection++:"
dat += "<tr>"
dat += "<td>[i.name]</td><td>N/A</td><td>[i.damage]</td><td>[infection]:[mech]</td><td></td>"
dat += "</tr>"
dat += "</table>"
if(occupant.sdisabilities & BLIND)
dat += text("<font color='red'>Cataracts detected.</font><BR>")
if(occupant.sdisabilities & NEARSIGHTED)
dat += text("<font color='red'>Retinal misalignment detected.</font><BR>")
else
dat += "\The [src] is empty."
dat = format_occupant_data(src.connected.get_occupant_data())
dat += "<HR><A href='?src=\ref[src];print=1'>Print</A><BR>"
else
dat = "<font color='red'> Error: No Body Scanner connected.</font>"
dat += text("<BR><BR><A href='?src=\ref[];mach_close=scanconsole'>Close</A>", user)
dat += text("<BR><A href='?src=\ref[];mach_close=scanconsole'>Close</A>", user)
user << browse(dat, "window=scanconsole;size=430x600")
return
/obj/machinery/body_scanconsole/Topic(href, href_list)
if (..())
return
if (href_list["print"])
if (!src.connected)
usr << "\icon[src]<span class='warning'>Error: No body scanner connected.</span>"
return
var/mob/living/carbon/human/occupant = src.connected.occupant
if (!src.connected.occupant)
usr << "\icon[src]<span class='warning'>The body scanner is empty.</span>"
return
if (!istype(occupant,/mob/living/carbon/human))
usr << "\icon[src]<span class='warning'>The body scanner cannot scan that lifeform.</span>"
return
var/obj/item/weapon/paper/R = new(src.loc)
R.name = "Body scan report"
R.info = format_occupant_data(src.connected.get_occupant_data())
/obj/machinery/bodyscanner/proc/get_occupant_data()
if (!occupant || !istype(occupant, /mob/living/carbon/human))
return
var/mob/living/carbon/human/H = occupant
var/list/occupant_data = list(
"stationtime" = worldtime2text(),
"stat" = H.stat,
"health" = H.health,
"virus_present" = H.virus2.len,
"bruteloss" = H.getBruteLoss(),
"fireloss" = H.getFireLoss(),
"oxyloss" = H.getOxyLoss(),
"toxloss" = H.getToxLoss(),
"rads" = H.radiation,
"cloneloss" = H.getCloneLoss(),
"brainloss" = H.getBrainLoss(),
"paralysis" = H.paralysis,
"bodytemp" = H.bodytemperature,
"borer_present" = H.has_brain_worms(),
"inaprovaline_amount" = H.reagents.get_reagent_amount("inaprovaline"),
"dexalin_amount" = H.reagents.get_reagent_amount("dexalin"),
"stoxin_amount" = H.reagents.get_reagent_amount("stoxin"),
"bicaridine_amount" = H.reagents.get_reagent_amount("bicaridine"),
"dermaline_amount" = H.reagents.get_reagent_amount("dermaline"),
"blood_amount" = H.vessel.get_reagent_amount("blood"),
"disabilities" = H.sdisabilities,
"tg_diseases_list" = H.viruses.Copy(),
"lung_ruptured" = H.is_lung_ruptured(),
"external_organs" = H.organs.Copy(),
"internal_organs" = H.internal_organs.Copy()
)
return occupant_data
/obj/machinery/body_scanconsole/proc/format_occupant_data(var/list/occ)
var/dat = "<font color='blue'><b>Scan performed at [occ["stationtime"]]</b></font><br>"
dat += "<font color='blue'><b>Occupant Statistics:</b></font><br>"
var/aux
switch (occ["stat"])
if(0)
aux = "Conscious"
if(1)
aux = "Unconscious"
else
aux = "Dead"
dat += text("[]\tHealth %: [] ([])</font><br>", (occ["health"] > 50 ? "<font color='blue'>" : "<font color='red'>"), occ["health"], aux)
if (occ["virus_present"])
dat += "<font color='red'>Viral pathogen detected in blood stream.</font><br>"
dat += text("[]\t-Brute Damage %: []</font><br>", (occ["bruteloss"] < 60 ? "<font color='blue'>" : "<font color='red'>"), occ["bruteloss"])
dat += text("[]\t-Respiratory Damage %: []</font><br>", (occ["oxyloss"] < 60 ? "<font color='blue'>" : "<font color='red'>"), occ["oxyloss"])
dat += text("[]\t-Toxin Content %: []</font><br>", (occ["toxloss"] < 60 ? "<font color='blue'>" : "<font color='red'>"), occ["toxloss"])
dat += text("[]\t-Burn Severity %: []</font><br><br>", (occ["fireloss"] < 60 ? "<font color='blue'>" : "<font color='red'>"), occ["fireloss"])
dat += text("[]\tRadiation Level %: []</font><br>", (occ["rads"] < 10 ?"<font color='blue'>" : "<font color='red'>"), occ["rads"])
dat += text("[]\tGenetic Tissue Damage %: []</font><br>", (occ["cloneloss"] < 1 ?"<font color='blue'>" : "<font color='red'>"), occ["cloneloss"])
dat += text("[]\tApprox. Brain Damage %: []</font><br>", (occ["brainloss"] < 1 ?"<font color='blue'>" : "<font color='red'>"), occ["brainloss"])
dat += text("Paralysis Summary %: [] ([] seconds left!)<br>", occ["paralysis"], round(occ["paralysis"] / 4))
dat += text("Body Temperature: [occ["bodytemp"]-T0C]&deg;C ([occ["bodytemp"]*1.8-459.67]&deg;F)<br><HR>")
if(occ["borer_present"])
dat += "Large growth detected in frontal lobe, possibly cancerous. Surgical removal is recommended.<br>"
dat += text("[]\tBlood Level %: [] ([] units)</FONT><BR>", (occ["blood_amount"] > 448 ?"<font color='blue'>" : "<font color='red'>"), occ["blood_amount"]*100 / 560, occ["blood_amount"])
dat += text("Inaprovaline: [] units<BR>", occ["inaprovaline_amount"])
dat += text("Soporific: [] units<BR>", occ["stoxin_amount"])
dat += text("[]\tDermaline: [] units</FONT><BR>", (occ["dermaline"] < 30 ? "<font color='black'>" : "<font color='red'>"), occ["dermaline"])
dat += text("[]\tBicaridine: [] units<BR>", (occ["bicaridine"] < 30 ? "<font color='black'>" : "<font color='red'>"), occ["bicaridine"])
dat += text("[]\tDexalin: [] units<BR>", (occ["dexalin"] < 30 ? "<font color='black'>" : "<font color='red'>"), occ["dexalin"])
for(var/datum/disease/D in occ["tg_diseases_list"])
if(!D.hidden[SCANNER])
dat += text("<font color='red'><B>Warning: [D.form] Detected</B>\nName: [D.name].\nType: [D.spread].\nStage: [D.stage]/[D.max_stages].\nPossible Cure: [D.cure]</FONT><BR>")
dat += "<HR><table border='1'>"
dat += "<tr>"
dat += "<th>Organ</th>"
dat += "<th>Burn Damage</th>"
dat += "<th>Brute Damage</th>"
dat += "<th>Other Wounds</th>"
dat += "</tr>"
for(var/datum/organ/external/e in occ["external_organs"])
var/AN = ""
var/open = ""
var/infected = ""
var/imp = ""
var/bled = ""
var/robot = ""
var/splint = ""
var/internal_bleeding = ""
var/lung_ruptured = ""
dat += "<tr>"
for(var/datum/wound/W in e.wounds) if(W.internal)
internal_bleeding = "<br>Internal bleeding"
break
if(istype(e, /datum/organ/external/chest) && occ["lung_ruptured"])
lung_ruptured = "Lung ruptured:"
if(e.status & ORGAN_SPLINTED)
splint = "Splinted:"
if(e.status & ORGAN_BLEEDING)
bled = "Bleeding:"
if(e.status & ORGAN_BROKEN)
AN = "[e.broken_description]:"
if(e.status & ORGAN_ROBOT)
robot = "Prosthetic:"
if(e.open)
open = "Open:"
switch (e.germ_level)
if (INFECTION_LEVEL_ONE to INFECTION_LEVEL_ONE + 200)
infected = "Mild Infection:"
if (INFECTION_LEVEL_ONE + 200 to INFECTION_LEVEL_ONE + 300)
infected = "Mild Infection+:"
if (INFECTION_LEVEL_ONE + 300 to INFECTION_LEVEL_ONE + 400)
infected = "Mild Infection++:"
if (INFECTION_LEVEL_TWO to INFECTION_LEVEL_TWO + 200)
infected = "Acute Infection:"
if (INFECTION_LEVEL_TWO + 200 to INFECTION_LEVEL_TWO + 300)
infected = "Acute Infection+:"
if (INFECTION_LEVEL_TWO + 300 to INFECTION_LEVEL_TWO + 400)
infected = "Acute Infection++:"
if (INFECTION_LEVEL_THREE to INFINITY)
infected = "Septic:"
if (e.implants.len)
var/unknown_body = 0
for(var/I in e.implants)
if(is_type_in_list(I,known_implants))
imp += "[I] implanted:"
else
unknown_body++
if(unknown_body || e.hidden)
imp += "Unknown body present:"
if(!AN && !open && !infected & !imp)
AN = "None:"
if(!(e.status & ORGAN_DESTROYED))
dat += "<td>[e.display_name]</td><td>[e.burn_dam]</td><td>[e.brute_dam]</td><td>[robot][bled][AN][splint][open][infected][imp][internal_bleeding][lung_ruptured]</td>"
else
dat += "<td>[e.display_name]</td><td>-</td><td>-</td><td>Not Found</td>"
dat += "</tr>"
for(var/datum/organ/internal/i in occ["internal_organs"])
var/mech = ""
if(i.robotic == 1)
mech = "Assisted:"
if(i.robotic == 2)
mech = "Mechanical:"
var/infection = "None"
switch (i.germ_level)
if (1 to INFECTION_LEVEL_ONE + 200)
infection = "Mild Infection:"
if (INFECTION_LEVEL_ONE + 200 to INFECTION_LEVEL_ONE + 300)
infection = "Mild Infection+:"
if (INFECTION_LEVEL_ONE + 300 to INFECTION_LEVEL_ONE + 400)
infection = "Mild Infection++:"
if (INFECTION_LEVEL_TWO to INFECTION_LEVEL_TWO + 200)
infection = "Acute Infection:"
if (INFECTION_LEVEL_TWO + 200 to INFECTION_LEVEL_TWO + 300)
infection = "Acute Infection+:"
if (INFECTION_LEVEL_TWO + 300 to INFINITY)
infection = "Acute Infection++:"
dat += "<tr>"
dat += "<td>[i.name]</td><td>N/A</td><td>[i.damage]</td><td>[infection]:[mech]</td><td></td>"
dat += "</tr>"
dat += "</table>"
if(occ["sdisabilities"] & BLIND)
dat += text("<font color='red'>Cataracts detected.</font><BR>")
if(occ["sdisabilities"] & NEARSIGHTED)
dat += text("<font color='red'>Retinal misalignment detected.</font><BR>")
return dat
+1 -1
View File
@@ -185,7 +185,7 @@
//List of active diseases
var/viruses = list() // replaces var/datum/disease/virus
var/list/viruses = list() // replaces var/datum/disease/virus
//Monkey/infected mode
var/list/resistances = list()