diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm
index 1e7e42ae92ce..69cf4eae5c2f 100644
--- a/code/game/machinery/computer/Operating.dm
+++ b/code/game/machinery/computer/Operating.dm
@@ -54,7 +54,7 @@
ui_interact(user)
..()
-/obj/machinery/computer/operating/ui_interact(mob/user, datum/tgui/ui = null)
+/obj/machinery/computer/operating/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "OperatingComputer", "Patient Monitor")
@@ -63,7 +63,10 @@
/obj/machinery/computer/operating/ui_data(mob/user, datum/tgui/ui)
var/data[0]
var/mob/living/carbon/human/occupant
- if(table)
+ if(!table)
+ data["table"] = 0
+ else
+ data["table"] = 1
occupant = table.victim
data["hasOccupant"] = occupant ? 1 : 0
var/occupantData[0]
@@ -119,9 +122,9 @@
occupantData["bloodPercent"] = round(100*(blood_volume/occupant.species.blood_volume), 0.01) //copy pasta ends here
occupantData["bloodType"] = occupant.dna.b_type
- occupantData["surgery"] = build_surgery_list(user)
+ occupantData["procedures"] = build_surgery_list(user)
- data["occupant"] = occupantData
+ data["patient"] = occupantData
data["verbose"]=verbose
data["oxyAlarm"]=oxyAlarm
data["choice"]=choice
@@ -302,7 +305,17 @@
*/
/obj/machinery/computer/operating/proc/find_next_steps(mob/user, zone)
. = list()
- for(var/datum/surgery_step/S in get_surgery_steps_without_basetypes())
+ var/list/possible_next_steps = get_surgery_steps_without_basetypes()
+ // these steps prompt the player in can_use, don't call them every ui update
+ var/list/prompting_surgery_steps = list(
+ /datum/surgery_step/internal/detatch_organ,
+ /datum/surgery_step/internal/remove_organ,
+ /datum/surgery_step/internal/attach_organ,
+ /datum/surgery_step/internal/rip_organ,
+ )
+ for(var/datum/surgery_step/S in possible_next_steps)
+ if (S.type in prompting_surgery_steps)
+ continue
if(S.can_use(user, victim, zone, null) && S.is_valid_target(victim))
var/allowed_tools_by_name = list()
for(var/tool in S.allowed_tools)
@@ -311,6 +324,4 @@
continue
var/obj/tool_path = tool
allowed_tools_by_name += capitalize(initial(tool_path.name))
- // Please for the love of all that is holy, someone make surgery steps
- // have names so I don't have to do this stupid pretty_type shit.
- . += "[pretty_type(S)]: [english_list(allowed_tools_by_name)]"
+ . += list(S.step_name = english_list(allowed_tools_by_name))
diff --git a/code/modules/surgery/bones.dm b/code/modules/surgery/bones.dm
index 734a788d43e9..2e27a62087e1 100644
--- a/code/modules/surgery/bones.dm
+++ b/code/modules/surgery/bones.dm
@@ -8,6 +8,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/glue_bone
+ step_name = "Glue bone"
+
allowed_tools = list(
/obj/item/surgical/bonegel = 100
)
@@ -50,6 +52,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/set_bone
+ step_name = "Set bone"
+
allowed_tools = list(
/obj/item/surgical/bonesetter = 100,
/obj/item/surgical/bonesetter_primitive = 60
@@ -95,6 +99,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/mend_skull
+ step_name = "Mend skull"
+
allowed_tools = list(
/obj/item/surgical/bonesetter = 100,
/obj/item/surgical/bonesetter_primitive = 60
@@ -135,6 +141,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/finish_bone
+ step_name = "Finish bone"
+
allowed_tools = list(
/obj/item/surgical/bonegel = 100
)
@@ -176,6 +184,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/clamp_bone
+ step_name = "Clamp bone"
+
allowed_tools = list(
/obj/item/surgical/bone_clamp = 100
)
diff --git a/code/modules/surgery/encased.dm b/code/modules/surgery/encased.dm
index 438506ef882c..aa50cc8532f3 100644
--- a/code/modules/surgery/encased.dm
+++ b/code/modules/surgery/encased.dm
@@ -19,6 +19,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/open_encased/saw
+ step_name = "Saw bones"
+
allowed_tools = list(
/obj/item/surgical/circular_saw = 100, \
/obj/item/surgical/saw_bronze = 75, \
@@ -70,6 +72,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/open_encased/retract
+ step_name = "Retract bones"
+
allowed_tools = list(
/obj/item/surgical/retractor = 100,
/obj/item/surgical/retractor_primitive = 75
@@ -124,6 +128,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/open_encased/close
+ step_name = "Close bones"
+
allowed_tools = list(
/obj/item/surgical/retractor = 100,
/obj/item/surgical/retractor_primitive = 75
@@ -183,6 +189,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/open_encased/mend
+ step_name = "Mend bones"
+
allowed_tools = list(
/obj/item/surgical/bonegel = 100
)
@@ -224,6 +232,8 @@
// Saw/Retractor/Gel Combi-open and close.
///////////////////////////////////////////////////////////////
/datum/surgery_step/open_encased/advancedsaw_open
+ step_name = "Divert bones"
+
allowed_tools = list(
/obj/item/surgical/circular_saw/manager = 100
)
@@ -273,6 +283,8 @@
/datum/surgery_step/open_encased/advancedsaw_mend
+ step_name = "Seal bones"
+
allowed_tools = list(
/obj/item/surgical/circular_saw/manager = 100
)
diff --git a/code/modules/surgery/external_repair.dm b/code/modules/surgery/external_repair.dm
index 416c1ba6a109..a708a2e608f2 100644
--- a/code/modules/surgery/external_repair.dm
+++ b/code/modules/surgery/external_repair.dm
@@ -30,6 +30,8 @@
//////////////////////////////////////////////////////////////////
/datum/surgery_step/repairflesh/scan_injury
+ step_name = "Scan injury"
+
allowed_tools = list(
/obj/item/healthanalyzer = 100,
/obj/item/atmos_analyzer = 10
@@ -80,6 +82,8 @@
//////////////////////////////////////////////////////////////////
/datum/surgery_step/repairflesh/repair_burns
+ step_name = "Reconstruct skin"
+
allowed_tools = list(
/obj/item/stack/medical/advanced/ointment = 100,
/obj/item/surgical/FixOVein = 100,
@@ -149,6 +153,8 @@
//////////////////////////////////////////////////////////////////
/datum/surgery_step/repairflesh/repair_brute
+ step_name = "Repair skin"
+
allowed_tools = list(
/obj/item/stack/medical/advanced/bruise_pack = 100,
/obj/item/surgical/cautery = 100,
diff --git a/code/modules/surgery/face.dm b/code/modules/surgery/face.dm
index 6bcc37b58711..6882d8e6f49d 100644
--- a/code/modules/surgery/face.dm
+++ b/code/modules/surgery/face.dm
@@ -21,6 +21,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/generic/cut_face
+ step_name = "Cut face"
+
allowed_tools = list(
/obj/item/surgical/scalpel = 100, \
/obj/item/surgical/scalpel_primitive = 80, \
@@ -57,6 +59,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/face/mend_vocal
+ step_name = "Fix vocal cords"
+
allowed_tools = list(
/obj/item/surgical/hemostat = 100, \
/obj/item/stack/cable_coil = 75, \
@@ -90,6 +94,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/face/fix_face
+ step_name = "Fix face"
+
allowed_tools = list(
/obj/item/surgical/retractor = 100, \
/obj/item/surgical/retractor_primitive = 75, \
@@ -125,6 +131,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/face/cauterize
+ step_name = "Cauterize"
+
allowed_tools = list(
/obj/item/surgical/cautery = 100, \
/obj/item/clothing/mask/smokable/cigarette = 75, \
diff --git a/code/modules/surgery/generic.dm b/code/modules/surgery/generic.dm
index 253a47906a23..bf5ce7447ce9 100644
--- a/code/modules/surgery/generic.dm
+++ b/code/modules/surgery/generic.dm
@@ -27,6 +27,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/generic/cut_open
+ step_name = "Incise"
+
allowed_tools = list(
/obj/item/surgical/scalpel = 100,
/obj/item/surgical/scalpel_bronze = 90,
@@ -73,6 +75,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/generic/cut_with_laser
+ step_name = "Laser incision"
+
allowed_tools = list(
/obj/item/surgical/scalpel/laser3 = 95, \
/obj/item/surgical/scalpel/laser2 = 85, \
@@ -119,6 +123,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/generic/incision_manager
+ step_name = "Prepared incision"
+
allowed_tools = list(
/obj/item/surgical/scalpel/manager = 100,
)
@@ -165,6 +171,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/generic/clamp_bleeders
+ step_name = "Clamp bleeders"
+
allowed_tools = list(
/obj/item/surgical/hemostat = 100,
/obj/item/stack/cable_coil = 75,
@@ -205,6 +213,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/generic/retract_skin
+ step_name = "Retract skin"
+
allowed_tools = list(
/obj/item/surgical/retractor = 100,
/obj/item/surgical/retractor_primitive = 75,
@@ -266,6 +276,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/generic/cauterize
+ step_name = "Cauterize"
+
allowed_tools = list(
/obj/item/surgical/cautery = 100,
/obj/item/clothing/mask/smokable/cigarette = 75,
@@ -308,6 +320,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/generic/amputate
+ step_name = "Amputate limb"
+
allowed_tools = list(
/obj/item/surgical/circular_saw = 100,
/obj/item/material/knife/machete/hatchet = 75,
diff --git a/code/modules/surgery/implant.dm b/code/modules/surgery/implant.dm
index b6c00fe16c6d..c57a9e045d64 100644
--- a/code/modules/surgery/implant.dm
+++ b/code/modules/surgery/implant.dm
@@ -44,6 +44,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/cavity/make_space
+ step_name = "Prepare cavity"
+
allowed_tools = list(
/obj/item/surgical/surgicaldrill = 100,
/obj/item/pen = 75,
@@ -76,6 +78,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/cavity/close_space
+ step_name = "Seal cavity"
+
priority = 2
allowed_tools = list(
/obj/item/surgical/cautery = 100,
@@ -111,6 +115,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/cavity/place_item
+ step_name = "Implant item"
+
priority = 0
allowed_tools = list(/obj/item = 100)
@@ -168,6 +174,8 @@
update_icon()
/datum/surgery_step/cavity/implant_removal
+ step_name = "Remove implant"
+
allowed_tools = list(
/obj/item/surgical/hemostat = 100, \
/obj/item/surgical/hemostat_primitive = 50, \
diff --git a/code/modules/surgery/limb_reattach.dm b/code/modules/surgery/limb_reattach.dm
index a2c2e78d804d..0e3a17c4cfb7 100644
--- a/code/modules/surgery/limb_reattach.dm
+++ b/code/modules/surgery/limb_reattach.dm
@@ -22,12 +22,16 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/limb/attach
+ step_name = "Attach limb"
+
allowed_tools = list(/obj/item/organ/external = 100)
min_duration = 50
max_duration = 70
/datum/surgery_step/limb/attach/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ if (!istype(tool, /obj/item/organ/external))
+ return 0
var/obj/item/organ/external/E = tool
var/obj/item/organ/external/P = target.organs_by_name[E.parent_organ]
var/obj/item/organ/external/affected = target.get_organ(target_zone)
@@ -73,6 +77,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/limb/connect
+ step_name = "Connect muscles"
+
allowed_tools = list(
/obj/item/surgical/hemostat = 100, \
/obj/item/stack/cable_coil = 75, \
@@ -113,6 +119,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/limb/mechanize
+ step_name = "Attach prosthetic"
+
allowed_tools = list(/obj/item/robot_parts = 100)
min_duration = 80
diff --git a/code/modules/surgery/neck.dm b/code/modules/surgery/neck.dm
index 069187ac9438..f5997cd8a81d 100644
--- a/code/modules/surgery/neck.dm
+++ b/code/modules/surgery/neck.dm
@@ -21,6 +21,8 @@
/////////////////////////////
/datum/surgery_step/brainstem/mend_vessels
+ step_name = "Mend vessels"
+
priority = 1
allowed_tools = list(
/obj/item/surgical/FixOVein = 100,
@@ -56,6 +58,8 @@
/////////////////////////////
/datum/surgery_step/brainstem/drill_vertebrae
+ step_name = "Drill vertebrae"
+
priority = 3 //Do this instead of expanding the skull cavity
allowed_tools = list(
/obj/item/surgical/surgicaldrill = 100,
@@ -99,6 +103,8 @@
/////////////////////////////
/datum/surgery_step/brainstem/clean_chips
+ step_name = "Clear bone chips"
+
priority = 3 //Do this instead of picking around for implants.
allowed_tools = list(
/obj/item/surgical/hemostat = 100,
@@ -139,6 +145,8 @@
/////////////////////////////
/datum/surgery_step/brainstem/mend_cord
+ step_name = "Mend spinal cord"
+
priority = 1 //Do this after IB.
allowed_tools = list(
/obj/item/surgical/FixOVein = 100,
@@ -179,6 +187,8 @@
/////////////////////////////
/datum/surgery_step/brainstem/mend_vertebrae
+ step_name = "Mend vertebrae"
+
priority = 3 //Do this instead of fixing bones.
allowed_tools = list(
/obj/item/surgical/bonegel = 100,
@@ -217,6 +227,8 @@
/////////////////////////////
/datum/surgery_step/brainstem/realign_tissue
+ step_name = "Realign tissue"
+
priority = 3 //Do this instead of searching for objects in the skull.
allowed_tools = list(
/obj/item/surgical/hemostat = 100,
diff --git a/code/modules/surgery/organs_internal.dm b/code/modules/surgery/organs_internal.dm
index e96159a8265b..8ad03a4e9665 100644
--- a/code/modules/surgery/organs_internal.dm
+++ b/code/modules/surgery/organs_internal.dm
@@ -58,6 +58,8 @@
// CHEST INTERNAL ORGAN SURGERY //
//////////////////////////////////////////////////////////////////
/datum/surgery_step/internal/fix_organ
+ step_name = "Fix organs"
+
allowed_tools = list(
/obj/item/stack/medical/advanced/bruise_pack= 100, \
/obj/item/stack/medical/bruise_pack = 20
@@ -145,6 +147,7 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/internal/detatch_organ/
+ step_name = "Detatch organ"
allowed_tools = list(
/obj/item/surgical/scalpel = 100, \
@@ -209,6 +212,7 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/internal/remove_organ
+ step_name = "Extract organ"
allowed_tools = list(
/obj/item/surgical/hemostat = 100, \
@@ -268,6 +272,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/internal/replace_organ
+ step_name = "Insert organ"
+
allowed_tools = list(
/obj/item/organ = 100
)
@@ -347,6 +353,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/internal/attach_organ
+ step_name = "Attach organ"
+
allowed_tools = list(
/obj/item/surgical/FixOVein = 100, \
/obj/item/stack/cable_coil = 75
@@ -399,6 +407,7 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/internal/rip_organ
+ step_name = "Rip organ"
allowed_tools = list(
/obj/item/surgical/scalpel/ripper = 100
diff --git a/code/modules/surgery/other.dm b/code/modules/surgery/other.dm
index 5319e1c8e99e..477605328ce1 100644
--- a/code/modules/surgery/other.dm
+++ b/code/modules/surgery/other.dm
@@ -8,6 +8,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/fix_vein
+ step_name = "Fix vein"
+
priority = 2
allowed_tools = list(
/obj/item/surgical/FixOVein = 100, \
@@ -70,6 +72,8 @@
// Necrosis Surgery Step 1
///////////////////////////////////////////////////////////////
/datum/surgery_step/fix_dead_tissue //Debridement
+ step_name = "Debride tissue"
+
priority = 2
allowed_tools = list(
/obj/item/surgical/scalpel = 100, \
@@ -119,6 +123,8 @@
// Necrosis Surgery Step 2
///////////////////////////////////////////////////////////////
/datum/surgery_step/treat_necrosis
+ step_name = "Treat necrosis"
+
priority = 2
allowed_tools = list(
/obj/item/reagent_containers/dropper = 100,
@@ -194,6 +200,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/hardsuit
+ step_name = "Remove hardsuit"
+
allowed_tools = list(
/obj/item/weldingtool = 80,
/obj/item/surgical/circular_saw = 60,
@@ -260,6 +268,8 @@
return target_zone == BP_TORSO && (MUTATION_HUSK in target.mutations)
/datum/surgery_step/dehusk/structinitial
+ step_name = "Create mesh"
+
allowed_tools = list(
/obj/item/surgical/bioregen = 100
)
@@ -289,6 +299,8 @@
..()
/datum/surgery_step/dehusk/relocateflesh
+ step_name = "Relocate flesh"
+
allowed_tools = list(
/obj/item/surgical/hemostat = 100, \
/obj/item/stack/cable_coil = 75, \
@@ -321,6 +333,8 @@
..()
/datum/surgery_step/dehusk/structfinish
+ step_name = "Finish structure"
+
allowed_tools = list(
/obj/item/surgical/bioregen = 100, \
/obj/item/surgical/FixOVein = 30
@@ -365,6 +379,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/internal/detoxify
+ step_name = "Detoxify"
+
blood_level = 1
allowed_tools = list(/obj/item/surgical/bioregen=100)
min_duration = 90
diff --git a/code/modules/surgery/robotics.dm b/code/modules/surgery/robotics.dm
index b24a7dca4162..14a3fda45380 100644
--- a/code/modules/surgery/robotics.dm
+++ b/code/modules/surgery/robotics.dm
@@ -28,6 +28,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/robotics/unscrew_hatch
+ step_name = "Unscrew hatch"
+
allowed_tools = list(
/obj/item/coin = 50,
/obj/item/material/knife = 50
@@ -67,6 +69,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/robotics/open_hatch
+ step_name = "Open hatch"
+
allowed_tools = list(
/obj/item/surgical/retractor = 100,
/obj/item/surgical/retractor_primitive = 75,
@@ -105,6 +109,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/robotics/close_hatch
+ step_name = "Close hatch"
+
allowed_tools = list(
/obj/item/surgical/retractor = 100,
/obj/item/surgical/retractor_primitive = 75,
@@ -144,6 +150,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/robotics/repair_brute
+ step_name = "Fix structure"
+
allowed_tools = list(
/obj/item/weldingtool = 100,
/obj/item/pickaxe/plasmacutter = 50
@@ -185,6 +193,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/robotics/repair_burn
+ step_name = "Fix wiring"
+
allowed_tools = list(
/obj/item/stack/cable_coil = 100
)
@@ -233,6 +243,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/robotics/fix_organ_robotic //For artificial organs
+ step_name = "Repair systems"
+
allowed_tools = list(
/obj/item/stack/nanopaste = 100, \
/obj/item/surgical/bonegel = 30, \
@@ -301,6 +313,7 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/robotics/detatch_organ_robotic
+ step_name = "Decouple system"
allowed_tools = list(
/obj/item/multitool = 100
@@ -354,6 +367,7 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/robotics/attach_organ_robotic
+ step_name = "Install system"
allowed_tools = list(
/obj/item/surgical/FixOVein = 100
@@ -406,6 +420,8 @@
///////////////////////////////////////////////////////////////
/datum/surgery_step/robotics/install_mmi
+ step_name = "Install MMI"
+
allowed_tools = list(
/obj/item/mmi = 100
)
@@ -484,6 +500,8 @@
*/
/datum/surgery_step/robotics/install_nymph
+ step_name = "Install Nymph"
+
allowed_tools = list(
/obj/item/holder/diona = 100
)
diff --git a/code/modules/surgery/slimes.dm b/code/modules/surgery/slimes.dm
index 4b83d8c3b158..ac945710cdd9 100644
--- a/code/modules/surgery/slimes.dm
+++ b/code/modules/surgery/slimes.dm
@@ -12,6 +12,7 @@
/datum/surgery_step/slime/cut_flesh
+ step_name = "Incise"
allowed_tools = list(
/obj/item/surgical/scalpel = 100,
/obj/item/surgical/scalpel_bronze = 90,
@@ -42,6 +43,8 @@
/datum/surgery_step/slime/cut_innards
+ step_name = "Expose core"
+
allowed_tools = list(
/obj/item/surgical/scalpel = 100, \
/obj/item/surgical/scalpel_bronze = 90, \
@@ -72,6 +75,8 @@
/datum/surgery_step/slime/saw_core
+ step_name = "Extract core"
+
allowed_tools = list(
/obj/item/surgical/circular_saw = 100, \
/obj/item/surgical/saw_bronze = 90, \
diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm
index 8e430c51bd3d..b6ae6f8fa96b 100644
--- a/code/modules/surgery/surgery.dm
+++ b/code/modules/surgery/surgery.dm
@@ -7,6 +7,8 @@
var/surgery_odds = 30 // temporary - surgery odds for on-turf.
/datum/surgery_step
+ var/step_name = "" //label to show for this step on operating consoles
+
var/priority = 0 //steps with higher priority would be attempted first
var/req_open = 1 //1 means the part must be cut open, 0 means it doesn't
diff --git a/tgui/packages/tgui/interfaces/OperatingComputer.js b/tgui/packages/tgui/interfaces/OperatingComputer.js
index 07898019c094..7fb2353f022c 100644
--- a/tgui/packages/tgui/interfaces/OperatingComputer.js
+++ b/tgui/packages/tgui/interfaces/OperatingComputer.js
@@ -1,5 +1,5 @@
-import { useBackend, useSharedState } from '../backend';
-import { AnimatedNumber, Button, LabeledList, NoticeBox, ProgressBar, Section, Tabs } from '../components';
+import { useBackend } from '../backend';
+import { AnimatedNumber, LabeledList, NoticeBox, ProgressBar, Section, Divider } from '../components';
import { Window } from '../layouts';
const damageTypes = [
@@ -21,37 +21,32 @@ const damageTypes = [
},
];
-export const OperatingComputer = (props, context) => {
- const { act } = useBackend(context);
- const [tab, setTab] = useSharedState(context, 'tab', 1);
+const patientStates = {
+ 0: {
+ color: 'good',
+ statText: 'Conscious',
+ },
+ 1: {
+ color: 'average',
+ statText: 'Unconscious',
+ },
+ 2: {
+ color: 'bad',
+ statText: 'Dead',
+ },
+ 3: {
+ color: 'light-gray',
+ statText: 'Unknown',
+ },
+};
+export const OperatingComputer = (props, context) => {
return (
-
- setTab(1)}>
- Patient State
-
- setTab(2)}>
- Surgery Procedures
-
- act("open_experiments")}>
- Experiments
-
-
- {tab === 1 && (
-
- )}
- {tab === 2 && (
-
- )}
+
);
@@ -61,9 +56,10 @@ const PatientStateView = (props, context) => {
const { act, data } = useBackend(context);
const {
table,
- procedures = [],
- patient = {},
+ hasOccupant,
+ patient,
} = data;
+ const patientStat = patientStates[patient.stat] || patientStates[3];
if (!table) {
return (
@@ -73,16 +69,16 @@ const PatientStateView = (props, context) => {
}
return (
<>
-
- {patient && (
+
+ {hasOccupant && (
- {patient.stat}
+ color={patientStat.color}>
+ {patientStat.statText}
- {patient.blood_type}
+ {patient.bloodType}
{
'No Patient Detected'
)}
- {procedures.length === 0 && (
+ {(patient.procedures?.length === 0) && (
)}
- {procedures.map(procedure => (
+ {patient.procedures?.map(procedure => (
+ {procedure.currentStage}
+
-
- {procedure.next_step}
- {procedure.chems_needed && (
- <>
- Required Chemicals:
-
- {procedure.chems_needed}
- >
- )}
-
- {!!data.alternative_step && (
-
- {procedure.alternative_step}
- {procedure.alt_chems_needed && (
- <>
- Required Chemicals:
-
- {procedure.alt_chems_needed}
- >
- )}
+ {Object.entries(procedure.nextSteps).map(([k, v]) => (
+
+ {v}
- )}
+ ))}
))}
>
);
};
-
-const SurgeryProceduresView = (props, context) => {
- const { act, data } = useBackend(context);
- const {
- surgeries = [],
- } = data;
- return (
-
-
- );
-};