mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-09 16:07:40 +00:00
Makes the operation computer tgui
This commit is contained in:
committed by
CitadelStationBot
parent
0e0eb351b3
commit
3fbe3bdd63
@@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
/obj/machinery/computer/operating
|
||||
name = "operating computer"
|
||||
desc = "Used to monitor the vitals of a patient during surgery."
|
||||
@@ -72,3 +73,77 @@
|
||||
dat += "<BR>"
|
||||
dat += "</div>"
|
||||
return dat
|
||||
=======
|
||||
/obj/machinery/computer/operating
|
||||
name = "operating computer"
|
||||
desc = "Used to monitor the vitals of a patient during surgery."
|
||||
icon_screen = "crew"
|
||||
icon_keyboard = "med_key"
|
||||
circuit = /obj/item/circuitboard/computer/operating
|
||||
var/mob/living/carbon/human/patient
|
||||
var/obj/structure/table/optable/table
|
||||
light_color = LIGHT_COLOR_BLUE
|
||||
|
||||
/obj/machinery/computer/operating/Initialize()
|
||||
. = ..()
|
||||
find_table()
|
||||
|
||||
/obj/machinery/computer/operating/proc/find_table()
|
||||
for(var/dir in GLOB.cardinals)
|
||||
table = locate(/obj/structure/table/optable, get_step(src, dir))
|
||||
if(table)
|
||||
table.computer = src
|
||||
break
|
||||
|
||||
/obj/machinery/computer/operating/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "operating_computer", name, 350, 470, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/operating/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["table"] = table
|
||||
if(table)
|
||||
data["patient"] = list()
|
||||
if(table.check_patient())
|
||||
patient = table.patient
|
||||
switch(patient.stat)
|
||||
if(CONSCIOUS)
|
||||
data["patient"]["stat"] = "Conscious"
|
||||
data["patient"]["statstate"] = "good"
|
||||
if(SOFT_CRIT)
|
||||
data["patient"]["stat"] = "Conscious"
|
||||
data["patient"]["statstate"] = "average"
|
||||
if(UNCONSCIOUS)
|
||||
data["patient"]["stat"] = "Unconscious"
|
||||
data["patient"]["statstate"] = "average"
|
||||
if(DEAD)
|
||||
data["patient"]["stat"] = "Dead"
|
||||
data["patient"]["statstate"] = "bad"
|
||||
data["patient"]["health"] = patient.health
|
||||
data["patient"]["blood_type"] = patient.dna.blood_type
|
||||
data["patient"]["maxHealth"] = patient.maxHealth
|
||||
data["patient"]["minHealth"] = HEALTH_THRESHOLD_DEAD
|
||||
data["patient"]["bruteLoss"] = patient.getBruteLoss()
|
||||
data["patient"]["fireLoss"] = patient.getFireLoss()
|
||||
data["patient"]["toxLoss"] = patient.getToxLoss()
|
||||
data["patient"]["oxyLoss"] = patient.getOxyLoss()
|
||||
if(patient.surgeries.len)
|
||||
data["procedures"] = list()
|
||||
for(var/datum/surgery/procedure in patient.surgeries)
|
||||
var/datum/surgery_step/surgery_step = procedure.get_surgery_step()
|
||||
var/alternative_step
|
||||
if(surgery_step.repeatable)
|
||||
var/datum/surgery_step/next_step = procedure.get_surgery_next_step()
|
||||
if(next_step)
|
||||
alternative_step = capitalize(next_step.name)
|
||||
else
|
||||
alternative_step = "Finish operation"
|
||||
data["procedures"] += list(list(
|
||||
"name" = capitalize(procedure.name),
|
||||
"next_step" = capitalize(surgery_step.name),
|
||||
"alternative_step" = alternative_step
|
||||
))
|
||||
return data
|
||||
>>>>>>> a683ab6... Makes the operation computer tgui (#32775)
|
||||
|
||||
46
tgui/src/interfaces/operating_computer.ract
Normal file
46
tgui/src/interfaces/operating_computer.ract
Normal file
@@ -0,0 +1,46 @@
|
||||
{{#unless data.table}}
|
||||
<ui-notice>
|
||||
No table detected!
|
||||
</ui-notice>
|
||||
{{/unless}}
|
||||
<ui-display>
|
||||
<ui-display title='Patient State'>
|
||||
{{#if data.patient}}
|
||||
<ui-section label='State'>
|
||||
<span class='{{data.patient.statstate}}'>{{data.patient.stat}}</span>
|
||||
</ui-section>
|
||||
<ui-section label='Blood Type'>
|
||||
<span class='content'>{{data.patient.blood_type}}</span>
|
||||
</ui-section>
|
||||
<ui-section label='Health'>
|
||||
<ui-bar min='{{data.patient.minHealth}}' max='{{data.patient.maxHealth}}' value='{{data.patient.health}}'
|
||||
state='{{data.patient.health >= 0 ? "good" : "average"}}'>{{Math.round(adata.patient.health)}}</ui-bar>
|
||||
</ui-section>
|
||||
{{#each [{label: "Brute", type: "bruteLoss"}, {label: "Burn", type: "fireLoss"}, {label: "Toxin", type: "toxLoss"}, {label: "Respiratory", type: "oxyLoss"}]}}
|
||||
<ui-section label='{{label}}'>
|
||||
<ui-bar min='0' max='{{data.patient.maxHealth}}' value='{{data.patient[type]}}' state='bad'>{{Math.round(adata.patient[type])}}</ui-bar>
|
||||
</ui-section>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
No patient detected.
|
||||
{{/if}}
|
||||
</ui-display>
|
||||
<ui-display title='Initiated Procedures'>
|
||||
{{#if data.procedures}}
|
||||
{{#each data.procedures}}
|
||||
<ui-subdisplay title='{{name}}'>
|
||||
<ui-section label='Next Step'>
|
||||
<span class='content'>{{next_step}}</span>
|
||||
</ui-section>
|
||||
{{#if alternative_step}}
|
||||
<ui-section label='Alternative Step'>
|
||||
<span class='content'>{{alternative_step}}</span>
|
||||
</ui-section>
|
||||
{{/if}}
|
||||
</ui-subdisplay>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
No active procedures.
|
||||
{{/if}}
|
||||
</ui-display>
|
||||
</ui-display>
|
||||
Reference in New Issue
Block a user