From 6bcf0c41ee139e0fd1a8317fb28d8c0fefe2ca48 Mon Sep 17 00:00:00 2001
From: Nathan Winters <100448493+CinnamonSnowball@users.noreply.github.com>
Date: Thu, 16 Feb 2023 21:14:12 +0100
Subject: [PATCH] Adds a cooldown progress bar to Cryocells (#20328)
* Add a cooldown progress bar to cryocells
* Color the progress bar warningly while no beaker loaded
* Give 'No beaker loaded' message a unique color
* Give the progress bar a label
---
.../components/unary_devices/cryo.dm | 3 ++-
tgui/packages/tgui/interfaces/Cryo.js | 19 ++++++++++++++++---
tgui/packages/tgui/public/tgui.bundle.js | 4 ++--
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
index 542f74f94db..605990300e0 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
@@ -216,7 +216,7 @@
/obj/machinery/atmospherics/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, 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, "Cryo", "Cryo Cell", 520, 490)
+ ui = new(user, src, ui_key, "Cryo", "Cryo Cell", 520, 500)
ui.open()
/obj/machinery/atmospherics/unary/cryo_cell/ui_data(mob/user)
@@ -253,6 +253,7 @@
if(beaker.reagents && beaker.reagents.reagent_list.len)
for(var/datum/reagent/R in beaker.reagents.reagent_list)
data["beakerVolume"] += R.volume
+ data["cooldownProgress"] = round(clamp((world.time - last_injection) / injection_cooldown, 0, 1) * 100)
data["auto_eject_healthy"] = (auto_eject_prefs & AUTO_EJECT_HEALTHY) ? TRUE : FALSE
data["auto_eject_dead"] = (auto_eject_prefs & AUTO_EJECT_DEAD) ? TRUE : FALSE
diff --git a/tgui/packages/tgui/interfaces/Cryo.js b/tgui/packages/tgui/interfaces/Cryo.js
index f2a932cab1b..21866f4ad4a 100644
--- a/tgui/packages/tgui/interfaces/Cryo.js
+++ b/tgui/packages/tgui/interfaces/Cryo.js
@@ -56,6 +56,7 @@ const CryoContent = (props, context) => {
cellTemperature,
cellTemperatureStatus,
isBeakerLoaded,
+ cooldownProgress,
auto_eject_healthy,
auto_eject_dead,
} = data;
@@ -151,6 +152,18 @@ const CryoContent = (props, context) => {
+
+
+