diff --git a/code/__defines/_macros.dm b/code/__defines/_macros.dm index b40d982437f..ad8b1c16866 100644 --- a/code/__defines/_macros.dm +++ b/code/__defines/_macros.dm @@ -21,6 +21,8 @@ #define SPAN_SOGHUN(X) ("" + X + "") #define SPAN_VOTE(X) ("" + X + "") +#define SPAN_HIGHDANGER(X) (FONT_LARGE(SPAN_DANGER(X))) + #define FONT_SIZE_SMALL 1 #define FONT_SIZE_NORMAL 2 #define FONT_SIZE_LARGE 3 diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 3dfe12f394c..d813142db59 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -535,3 +535,21 @@ icon = 'icons/mob/screen_gen.dmi' icon_state = "wiz_energy" invisibility = 101 + +/obj/screen/status + icon = 'icons/mob/screen/midnight.dmi' + icon_state = "status_template" + var/status_message + +/obj/screen/status/Initialize(mapload, var/set_icon, var/set_overlay, var/set_status_message) + icon = set_icon + var/image/status_overlay = image('icons/mob/screen/hud_status.dmi', null, set_overlay) + status_overlay.appearance_flags = RESET_COLOR + add_overlay(status_overlay) + status_message = set_status_message + return ..() + +/obj/screen/status/Click(var/location, var/control, var/params) + var/list/modifiers = params2list(params) + if(status_message && modifiers["shift"]) + to_chat(usr, status_message) diff --git a/code/modules/mob/living/carbon/human/intoxication.dm b/code/modules/mob/living/carbon/human/intoxication.dm index cb8570559ad..92ee34d3db6 100644 --- a/code/modules/mob/living/carbon/human/intoxication.dm +++ b/code/modules/mob/living/carbon/human/intoxication.dm @@ -80,3 +80,14 @@ add_chemical_effect(CE_HEPATOTOXIC, 10) adjustOxyLoss(3,100) adjustBrainLoss(1,50) + +/mob/living/carbon/human/proc/is_drunk() + var/SR = species.ethanol_resistance + if(SR == -1) + return FALSE + + var/bac = get_blood_alcohol() + if(bac > (INTOX_MUSCLEIMP * SR)) + return TRUE + + return FALSE diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index bf15f94b35e..7cc197ce279 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -825,11 +825,17 @@ var/tmp/last_frenzy_state var/tmp/last_oxy_overlay + var/list/status_overlays = null + /mob/living/carbon/human/can_update_hud() if((!client && !bg) || QDELETED(src)) return FALSE return TRUE +// corresponds with the status overlay in hud_status.dmi +#define DRUNK_STRING "drunk" +#define BLEEDING_STRING "bleeding" + /mob/living/carbon/human/handle_regular_hud_updates() if(hud_updateflag) // update our mob's hud overlays, AKA what others see flaoting above our head handle_hud_list() @@ -1064,8 +1070,56 @@ if (bodytemp.icon_state != new_temp) bodytemp.icon_state = new_temp + if(client) + var/has_drunk_status = LAZYISIN(status_overlays, DRUNK_STRING) + if(is_drunk()) + if(!has_drunk_status) + add_status_to_hud(DRUNK_STRING, SPAN_GOOD("You are drunk. Your words are slurred, and your movements are uncoordinated.")) + else if(has_drunk_status) + qdel(status_overlays[DRUNK_STRING]) + status_overlays -= DRUNK_STRING + + var/has_bleeding_limb = FALSE + var/has_bleeding_status = LAZYISIN(status_overlays, BLEEDING_STRING) + for(var/obj/item/organ/external/damaged_limb as anything in bad_external_organs) + if(damaged_limb.status & ORGAN_BLEEDING) + has_bleeding_limb = TRUE + break + if(has_bleeding_limb) + if(!has_bleeding_status) + add_status_to_hud(BLEEDING_STRING, SPAN_HIGHDANGER("Blood gushes from one of your bodyparts, inspect yourself and seal the wound.")) + else if(has_bleeding_status) + qdel(status_overlays[BLEEDING_STRING]) + status_overlays -= BLEEDING_STRING + + UNSETEMPTY(status_overlays) + else + for(var/status in status_overlays) + qdel(status_overlays[status]) + status_overlays = null return 1 +#undef DRUNK_STRING +#undef BLEEDING_STRING + +/mob/living/carbon/human/proc/add_status_to_hud(var/set_overlay, var/set_status_message) + var/obj/screen/status/new_status = new /obj/screen/status(null, ui_style2icon(client.prefs.UI_style), set_overlay, set_status_message) + new_status.alpha = client.prefs.UI_style_alpha + new_status.color = client.prefs.UI_style_color + new_status.screen_loc = get_status_loc(status_overlays ? LAZYLEN(status_overlays) + 1 : 1) + client.screen += new_status + LAZYSET(status_overlays, set_overlay, new_status) + +/mob/living/carbon/human/proc/get_status_loc(var/placement) + var/col = ((placement - 1)%(13)) + 1 + var/coord_col = "-[col-1]" + var/coord_col_offset = "-[4+2*col]" + + var/row = round((placement-1)/13) + var/coord_row = "[-1 - row]" + var/coord_row_offset = 8 + return "EAST[coord_col]:[coord_col_offset],NORTH[coord_row]:[coord_row_offset]" + /mob/living/carbon/human/handle_random_events() if(InStasis()) return diff --git a/html/changelogs/geeves-status_icons.yml b/html/changelogs/geeves-status_icons.yml new file mode 100644 index 00000000000..67267afb42a --- /dev/null +++ b/html/changelogs/geeves-status_icons.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Added status indicators to the top right of the screen that indicate when you're bleeding or drunk, or both." diff --git a/icons/mob/screen/hud_status.dmi b/icons/mob/screen/hud_status.dmi new file mode 100644 index 00000000000..76860e56323 Binary files /dev/null and b/icons/mob/screen/hud_status.dmi differ diff --git a/icons/mob/screen/midnight.dmi b/icons/mob/screen/midnight.dmi index 45cc4e2b95f..1fda994525b 100644 Binary files a/icons/mob/screen/midnight.dmi and b/icons/mob/screen/midnight.dmi differ diff --git a/icons/mob/screen/old.dmi b/icons/mob/screen/old.dmi index 5b2213f5257..825b95659dd 100644 Binary files a/icons/mob/screen/old.dmi and b/icons/mob/screen/old.dmi differ diff --git a/icons/mob/screen/orange.dmi b/icons/mob/screen/orange.dmi index 6dccc9fda5a..f3d085795a3 100644 Binary files a/icons/mob/screen/orange.dmi and b/icons/mob/screen/orange.dmi differ diff --git a/icons/mob/screen/white.dmi b/icons/mob/screen/white.dmi index 736266c9c16..99375b44835 100644 Binary files a/icons/mob/screen/white.dmi and b/icons/mob/screen/white.dmi differ