diff --git a/code/__DEFINES/clothing.dm b/code/__DEFINES/clothing.dm
index 805d3eccb38..264f07c92fd 100644
--- a/code/__DEFINES/clothing.dm
+++ b/code/__DEFINES/clothing.dm
@@ -68,3 +68,12 @@
#define GMESSENGER "Grey Messenger Bag"
/// Backpack type: Leather satchel
#define LSATCHEL "Leather Satchel"
+
+//Defines for space suits. The respective define is also an icon.
+#define SPACESUIT_NO_ICON "none"
+#define SPACESUIT_CELL_MISSING "missing"
+#define SPACESUIT_CELL_EMPTY "empty"
+#define SPACESUIT_CELL_HIGH "high"
+#define SPACESUIT_CELL_MID "mid"
+#define SPACESUIT_CELL_LOW "low"
+#define SPACESUIT_CELL_VERY_LOW "very_low"
diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm
index 6af2635972b..0f722a1bc11 100644
--- a/code/_onclick/hud/hud.dm
+++ b/code/_onclick/hud/hud.dm
@@ -93,7 +93,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
var/atom/movable/screen/healths
var/atom/movable/screen/stamina
var/atom/movable/screen/healthdoll/healthdoll
- var/atom/movable/screen/spacesuit
+ var/atom/movable/screen/spacesuit/spacesuit_hud
var/atom/movable/screen/hunger/hunger
/// Subtypes can override this to force a specific UI style
@@ -245,7 +245,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
healths = null
stamina = null
healthdoll = null
- spacesuit = null
+ spacesuit_hud = null
hunger = null
alien_plasma_display = null
alien_queen_finder = null
diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm
index a4a69508a85..4e6ef6f0e2b 100644
--- a/code/_onclick/hud/human.dm
+++ b/code/_onclick/hud/human.dm
@@ -291,8 +291,8 @@
sleep_icon.icon = ui_style
sleep_icon.screen_loc = ui_above_throw
- spacesuit = new /atom/movable/screen/spacesuit(null, src)
- infodisplay += spacesuit
+ spacesuit_hud = new /atom/movable/screen/spacesuit(null, src)
+ infodisplay += spacesuit_hud
healths = new /atom/movable/screen/healths(null, src)
infodisplay += healths
diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm
index 250219e8740..2514376f911 100644
--- a/code/_onclick/hud/screen_objects.dm
+++ b/code/_onclick/hud/screen_objects.dm
@@ -407,6 +407,63 @@
name = "Space suit cell status"
icon_state = "spacesuit_0"
screen_loc = ui_spacesuit
+ mouse_over_pointer = MOUSE_HAND_POINTER
+ ///The overlay added on top of the HUD when the thermal regulator is off.
+ var/static/mutable_appearance/off_overlay = mutable_appearance('icons/hud/screen_gen.dmi', "off")
+ ///Boolean on whether a mouse is being hovered over us right now.
+ var/hovering = FALSE
+ ///Boolean on whether or not the space suit's thermal mode is on. Start at TRUE so we auto-update when we are first equipped.
+ var/cached_thermal_on = TRUE
+
+/atom/movable/screen/spacesuit/Click(location, control, params)
+ if(usr != get_mob())
+ return
+ . = ..()
+ var/mob/living/carbon/human/wearer = hud?.mymob
+ astype(wearer.wear_suit, /obj/item/clothing/suit/space)?.toggle_spacesuit(wearer, manual_toggle = TRUE)
+
+/atom/movable/screen/spacesuit/MouseEntered(location,control,params)
+ if(usr != get_mob())
+ return
+ . = ..()
+ hovering = TRUE
+ var/mob/living/carbon/human/wearer = hud?.mymob
+ astype(wearer.wear_suit, /obj/item/clothing/suit/space)?.update_hud_icon(usr)
+
+/atom/movable/screen/spacesuit/MouseExited(location, control, params)
+ if(usr != get_mob())
+ return
+ . = ..()
+ hovering = FALSE
+ var/mob/living/carbon/human/wearer = hud?.mymob
+ astype(wearer.wear_suit, /obj/item/clothing/suit/space)?.update_hud_icon(usr)
+
+/atom/movable/screen/spacesuit/proc/update_spacesuit_hud_icon(cell_state, cell_percent, thermal_on = TRUE)
+ if(cell_state)
+ switch(cell_state)
+ if(SPACESUIT_NO_ICON)
+ icon_state = null
+ maptext = null
+ cached_thermal_on = TRUE //for next use
+ update_appearance(UPDATE_ICON)
+ return
+ if(SPACESUIT_CELL_MISSING, SPACESUIT_CELL_EMPTY)
+ icon_state = "spacesuit_[cell_state]"
+ maptext = null
+ else
+ icon_state = "spacesuit_[cell_state]"
+ if(cell_percent && hovering)
+ maptext = MAPTEXT("
[round(cell_percent, 0.1)]%
")
+ else
+ maptext = null
+ if(thermal_on != cached_thermal_on)
+ cached_thermal_on = thermal_on
+ update_appearance(UPDATE_ICON)
+
+/atom/movable/screen/spacesuit/update_overlays()
+ . = ..()
+ if(!cached_thermal_on && icon_state)
+ . |= off_overlay
/atom/movable/screen/mov_intent
name = "run/walk toggle"
diff --git a/code/modules/clothing/spacesuits/_spacesuits.dm b/code/modules/clothing/spacesuits/_spacesuits.dm
index d269dfae05e..d5283c7c20c 100644
--- a/code/modules/clothing/spacesuits/_spacesuits.dm
+++ b/code/modules/clothing/spacesuits/_spacesuits.dm
@@ -116,21 +116,14 @@
if(slot & ITEM_SLOT_OCLOTHING) // Check that the slot is valid
START_PROCESSING(SSobj, src)
update_hud_icon(user) // update the hud
- RegisterSignal(user, COMSIG_MOB_GET_STATUS_TAB_ITEMS, PROC_REF(get_status_tab_item))
// On removal stop processing, save battery
/obj/item/clothing/suit/space/dropped(mob/living/user)
. = ..()
STOP_PROCESSING(SSobj, src)
- UnregisterSignal(user, COMSIG_MOB_GET_STATUS_TAB_ITEMS)
- var/mob/living/carbon/carbon_user = user
- if(istype(carbon_user))
- carbon_user.update_spacesuit_hud_icon("0")
-
-/obj/item/clothing/suit/space/proc/get_status_tab_item(mob/living/source, list/items)
- SIGNAL_HANDLER
- items += "Thermal Regulator: [thermal_on ? "On" : "Off"]"
- items += "Cell Charge: [cell ? "[round(cell.percent(), 0.1)]%" : "No Cell!"]"
+ var/mob/living/carbon/human/human_user = user
+ if(istype(human_user) && human_user.hud_used)
+ human_user.hud_used.spacesuit_hud.update_spacesuit_hud_icon(SPACESUIT_NO_ICON)
// Space Suit temperature regulation and power usage
/obj/item/clothing/suit/space/process(seconds_per_tick)
@@ -165,8 +158,8 @@
if(isatom(cell))
QDEL_NULL(cell)
var/mob/living/carbon/human/human = src.loc
- if(istype(human))
- human.update_spacesuit_hud_icon("0")
+ if(istype(human) && human.hud_used)
+ human.hud_used.spacesuit_hud.update_spacesuit_hud_icon(SPACESUIT_NO_ICON)
STOP_PROCESSING(SSobj, src)
return ..()
@@ -226,6 +219,7 @@
if(user.transferItemToLoc(I, src))
cell = I
to_chat(user, span_notice("You successfully install \the [cell] into [src]."))
+ update_hud_icon(user)
return
/// Open the cell cover when ALT+Click on the suit
@@ -246,12 +240,14 @@
/// Remove the cell from the suit if the cell cover is open
/obj/item/clothing/suit/space/proc/remove_cell(mob/user)
- if(cell_cover_open && cell)
- user.visible_message(span_notice("[user] removes \the [cell] from [src]!"), \
- span_notice("You remove [cell]."))
- cell.add_fingerprint(user)
- user.put_in_hands(cell)
- cell = null
+ if(!cell_cover_open || isnull(cell))
+ return
+ user.visible_message(span_notice("[user] removes \the [cell] from [src]!"), \
+ span_notice("You remove [cell]."))
+ cell.add_fingerprint(user)
+ user.put_in_hands(cell)
+ cell = null
+ update_hud_icon(user)
/// Toggle the space suit's cell cover
/obj/item/clothing/suit/space/proc/toggle_spacesuit_cell(mob/user)
@@ -280,6 +276,8 @@
min_cold_protection_temperature = thermal_on ? SPACE_SUIT_MIN_TEMP_PROTECT : SPACE_SUIT_MIN_TEMP_PROTECT_OFF
update_item_action_buttons()
+ if(isnull(toggler) && ishuman(loc))
+ update_hud_icon(loc)
if(!toggler)
return
@@ -305,31 +303,29 @@
// update the HUD icon
/obj/item/clothing/suit/space/proc/update_hud_icon(mob/user)
var/mob/living/carbon/human/human = user
-
- if(!show_hud)
+ if(!show_hud || human.wear_suit != src || isnull(human.hud_used))
return
if(!cell)
- human.update_spacesuit_hud_icon("missing")
+ human.hud_used.spacesuit_hud.update_spacesuit_hud_icon(SPACESUIT_CELL_MISSING, 0, thermal_on)
return
var/cell_percent = cell.percent()
-
// Check if there's enough charge to trigger a thermal regulator tick and
// if there is, whethere the cell's capacity indicates high, medium or low
// charge based on it.
- if(cell.charge >= THERMAL_REGULATOR_COST)
- if(cell_percent > 60)
- human.update_spacesuit_hud_icon("high")
- return
- if(cell_percent > 20)
- human.update_spacesuit_hud_icon("mid")
- return
- human.update_spacesuit_hud_icon("low")
+ if(cell.charge < THERMAL_REGULATOR_COST)
+ human.hud_used.spacesuit_hud.update_spacesuit_hud_icon(SPACESUIT_CELL_EMPTY, cell_percent, thermal_on)
return
-
- human.update_spacesuit_hud_icon("empty")
- return
+ switch(cell_percent)
+ if(0 to 20)
+ human.hud_used.spacesuit_hud.update_spacesuit_hud_icon(SPACESUIT_CELL_VERY_LOW, cell_percent, thermal_on)
+ if(21 to 40)
+ human.hud_used.spacesuit_hud.update_spacesuit_hud_icon(SPACESUIT_CELL_LOW, cell_percent, thermal_on)
+ if(41 to 60)
+ human.hud_used.spacesuit_hud.update_spacesuit_hud_icon(SPACESUIT_CELL_MID, cell_percent, thermal_on)
+ if(61 to 100)
+ human.hud_used.spacesuit_hud.update_spacesuit_hud_icon(SPACESUIT_CELL_HIGH, cell_percent, thermal_on)
// zap the cell if we get hit with an emp
/obj/item/clothing/suit/space/emp_act(severity)
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index bc884201e83..db83e9222a9 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -669,9 +669,6 @@
else
hud_used.healths.icon_state = "health6"
-/mob/living/carbon/proc/update_spacesuit_hud_icon(cell_state = "empty")
- hud_used?.spacesuit?.icon_state = "spacesuit_[cell_state]"
-
/mob/living/carbon/set_health(new_value)
. = ..()
if(. > hardcrit_threshold)
diff --git a/code/modules/mod/mod_control.dm b/code/modules/mod/mod_control.dm
index e2554be5646..e9e1f1a05fe 100644
--- a/code/modules/mod/mod_control.dm
+++ b/code/modules/mod/mod_control.dm
@@ -524,7 +524,7 @@
module.on_unequip()
UnregisterSignal(wearer, list(COMSIG_ATOM_EXITED, COMSIG_SPECIES_GAIN, COMSIG_MOB_CLICKON))
SEND_SIGNAL(src, COMSIG_MOD_WEARER_UNSET, wearer)
- wearer.update_spacesuit_hud_icon("0")
+ wearer.hud_used?.spacesuit_hud.update_spacesuit_hud_icon()
wearer = null
/obj/item/mod/control/proc/get_sealed_slots(list/parts)
@@ -715,17 +715,17 @@
* Updates the wearer's hud according to the current state of the MODsuit
*/
/obj/item/mod/control/proc/update_charge_alert()
- if(isnull(wearer))
+ if(isnull(wearer) || isnull(wearer.client))
return
var/state_to_use
if(!active)
- state_to_use = "0"
+ state_to_use = SPACESUIT_NO_ICON
else if(isnull(core))
state_to_use = "coreless"
else
state_to_use = core.get_charge_icon_state()
- wearer.update_spacesuit_hud_icon(state_to_use || "0")
+ wearer.hud_used.spacesuit_hud.update_spacesuit_hud_icon(state_to_use || SPACESUIT_NO_ICON)
/obj/item/mod/control/proc/update_speed()
var/total_slowdown = 0
diff --git a/code/modules/mod/mod_core.dm b/code/modules/mod/mod_core.dm
index 6a36fae818f..70c4fb90d95 100644
--- a/code/modules/mod/mod_core.dm
+++ b/code/modules/mod/mod_core.dm
@@ -52,7 +52,7 @@
/// Returns what icon state to display on the HUD for the charge level of this core
/obj/item/mod/core/proc/get_charge_icon_state()
- return "0"
+ return SPACESUIT_NO_ICON
/// Gets what the UI should use for the charge bar color.
/obj/item/mod/core/proc/get_chargebar_color()
@@ -90,7 +90,7 @@
return TRUE
/obj/item/mod/core/infinite/get_charge_icon_state()
- return "high"
+ return SPACESUIT_CELL_HIGH
/obj/item/mod/core/infinite/get_chargebar_color()
return "teal"
@@ -171,19 +171,19 @@
/obj/item/mod/core/standard/get_charge_icon_state()
if(isnull(charge_source()))
- return "missing"
+ return SPACESUIT_CELL_MISSING
switch(round(charge_amount() / max_charge_amount(), 0.01))
if(0.75 to INFINITY)
- return "high"
+ return SPACESUIT_CELL_HIGH
if(0.5 to 0.75)
- return "mid"
+ return SPACESUIT_CELL_MID
if(0.25 to 0.5)
- return "low"
+ return SPACESUIT_CELL_LOW
if(0.02 to 0.25)
- return "very_low"
+ return SPACESUIT_CELL_VERY_LOW
- return "empty"
+ return SPACESUIT_CELL_EMPTY
/obj/item/mod/core/standard/get_chargebar_color()
if(isnull(charge_source()))
@@ -335,7 +335,7 @@
return charge_amount() >= amount * charge_modifier
/obj/item/mod/core/ethereal/get_charge_icon_state()
- return isnull(charge_source()) ? "missing" : "0"
+ return isnull(charge_source()) ? SPACESUIT_CELL_MISSING : SPACESUIT_NO_ICON
/obj/item/mod/core/ethereal/get_chargebar_color()
if(isnull(charge_source()))
@@ -405,15 +405,15 @@
/obj/item/mod/core/plasma/get_charge_icon_state()
switch(round(charge_amount() / max_charge_amount(), 0.01))
if(0.75 to INFINITY)
- return "high"
+ return SPACESUIT_CELL_HIGH
if(0.5 to 0.75)
- return "mid"
+ return SPACESUIT_CELL_MID
if(0.25 to 0.5)
- return "low"
+ return SPACESUIT_CELL_LOW
if(0.02 to 0.25)
- return "very_low"
+ return SPACESUIT_CELL_VERY_LOW
- return "empty"
+ return SPACESUIT_CELL_EMPTY
/obj/item/mod/core/plasma/get_chargebar_color()
switch(round(charge_amount() / max_charge_amount(), 0.01))
@@ -648,15 +648,15 @@
/obj/item/mod/core/soul/get_charge_icon_state()
switch(round(charge_amount() / max_charge_amount(), 0.01))
if(0.75 to INFINITY)
- return "high"
+ return SPACESUIT_CELL_HIGH
if(0.5 to 0.75)
- return "mid"
+ return SPACESUIT_CELL_MID
if(0.25 to 0.5)
- return "low"
+ return SPACESUIT_CELL_LOW
if(0.02 to 0.25)
- return "very_low"
+ return SPACESUIT_CELL_VERY_LOW
- return "empty"
+ return SPACESUIT_CELL_EMPTY
/obj/item/mod/core/soul/vv_edit_var(vname, vval)
. = ..()
diff --git a/icons/hud/screen_gen.dmi b/icons/hud/screen_gen.dmi
index e4f4bb4eda7..a86278be2af 100644
Binary files a/icons/hud/screen_gen.dmi and b/icons/hud/screen_gen.dmi differ