diff --git a/code/__defines/_planes+layers.dm b/code/__defines/_planes+layers.dm index 586a87cd4e..a63681cc21 100644 --- a/code/__defines/_planes+layers.dm +++ b/code/__defines/_planes+layers.dm @@ -138,6 +138,8 @@ What is the naming convention for planes or layers? #define PLANE_MESONS 30 //Stuff seen with mesons, like open ceilings. This is 30 for downstreams. +#define PLANE_STATUS 31 //Status Indicators that show over mobs' heads when certain things like stuns affect them. + #define PLANE_ADMIN2 33 //Purely for shenanigans (above lighting) #define PLANE_BUILDMODE 39 //Things that only show up when you have buildmode on diff --git a/code/__defines/mobs.dm b/code/__defines/mobs.dm index be8f025922..498493ce6c 100644 --- a/code/__defines/mobs.dm +++ b/code/__defines/mobs.dm @@ -398,7 +398,9 @@ #define VIS_CLOAKED 23 -#define VIS_COUNT 23 //Must be highest number from above. +#define VIS_STATUS 24 + +#define VIS_COUNT 24 //Must be highest number from above. //Some mob icon layering defines #define BODY_LAYER -100 diff --git a/code/modules/client/preference_setup/global/setting_datums.dm b/code/modules/client/preference_setup/global/setting_datums.dm index 970c8dd8e6..8efb44a98b 100644 --- a/code/modules/client/preference_setup/global/setting_datums.dm +++ b/code/modules/client/preference_setup/global/setting_datums.dm @@ -229,6 +229,18 @@ var/list/_client_preferences_by_type enabled_description = "Enabled" disabled_description = "Disabled" +/datum/client_preference/status_indicators + description = "Status Indicators" + key = "SHOW_STATUS" + enabled_description = "Show" + disabled_description = "Hide" + +/datum/client_preference/status_indicators/toggled(mob/preference_mob, enabled) + . = ..() + if(preference_mob && preference_mob.plane_holder) + var/datum/plane_holder/PH = preference_mob.plane_holder + PH.set_vis(VIS_STATUS, enabled) + /******************** * Staff Preferences * ********************/ diff --git a/code/modules/client/preferences_toggle_procs.dm b/code/modules/client/preferences_toggle_procs.dm index f1884dea82..aabcc23c8c 100644 --- a/code/modules/client/preferences_toggle_procs.dm +++ b/code/modules/client/preferences_toggle_procs.dm @@ -319,6 +319,19 @@ You will have to reload VChat and/or reconnect to the server for these changes to take place. \ VChat message persistence is not guaranteed if you change this again before the start of the next round.") +/client/verb/toggle_status_indicators() + set name = "Toggle Status Indicators" + set category = "Preferences" + set desc = "Enable/Disable seeing status indicators over peoples' heads." + + var/pref_path = /datum/client_preference/status_indicators + toggle_preference(pref_path) + SScharacter_setup.queue_preferences_save(prefs) + + to_chat(src, "You will now [(is_preference_enabled(/datum/client_preference/status_indicators)) ? "see" : "not see"] status indicators.") + + feedback_add_details("admin_verb","TStatusIndicators") + // Not attached to a pref datum because those are strict binary toggles /client/verb/toggle_examine_mode() diff --git a/code/modules/mob/living/status_indicators.dm b/code/modules/mob/living/status_indicators.dm index f467934521..a3f386b9e6 100644 --- a/code/modules/mob/living/status_indicators.dm +++ b/code/modules/mob/living/status_indicators.dm @@ -8,7 +8,7 @@ // and it will try to always be above the mob sprite, even for larger sprites like xenos. /mob/living - var/list/status_indicators = null // Will become a list of strings or image objects when needed. + var/list/status_indicators = null // Will become a list as needed. // Adds an icon_state, or image overlay, to the list of indicators to be managed automatically. // Also initializes the list if one doesn't exist. @@ -38,7 +38,7 @@ return LAZYACCESS(status_indicators, LAZYFIND(status_indicators, thing)) // Refreshes the indicators over a mob's head. Should only be called when adding or removing a status indicator with the above procs, -// or when the mob changes size for some reason. +// or when the mob changes size visually for some reason. /mob/living/proc/handle_status_indicators() // First, get rid of all the overlays. for(var/thing in status_indicators) @@ -58,7 +58,7 @@ var/y_offset = our_sprite_y + STATUS_INDICATOR_Y_OFFSET // Calculates how 'long' the row of indicators and the margin between them should be. - // The goal is to have the center of that row be aligned with the sprite's center. + // The goal is to have the center of that row be horizontally aligned with the sprite's center. var/expected_status_indicator_length = (STATUS_INDICATOR_ICON_X_SIZE * status_indicators.len) + (STATUS_INDICATOR_ICON_MARGIN * max(status_indicators.len - 1, 0)) var/current_x_position = (x_offset / 2) - (expected_status_indicator_length / 2) @@ -71,7 +71,8 @@ var/image/I = thing // This is a semi-HUD element, in a similar manner as medHUDs, in that they're 'above' everything else in the world, - // but don't pierce obfuscation layers such as blindness, unlike actual HUD elements like inventory slots. + // but don't pierce obfuscation layers such as blindness or darkness, unlike actual HUD elements like inventory slots. + I.plane = PLANE_STATUS I.layer = HUD_LAYER I.appearance_flags = PIXEL_SCALE|TILE_BOUND|NO_CLIENT_COLOR|RESET_COLOR|RESET_ALPHA|RESET_TRANSFORM|KEEP_APART I.pixel_y = y_offset @@ -80,3 +81,8 @@ // Adding the margin space every time saves a conditional check on the last iteration, // and it won't cause any issues since no more icons will be added, and the var is not used for anything else. current_x_position += STATUS_INDICATOR_ICON_X_SIZE + STATUS_INDICATOR_ICON_MARGIN + + +#undef STATUS_INDICATOR_Y_OFFSET +#undef STATUS_INDICATOR_ICON_X_SIZE +#undef STATUS_INDICATOR_ICON_MARGIN diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 3859f40045..209ba2eb7a 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -65,6 +65,10 @@ plane_holder.set_ao(VIS_OBJS, ao_enabled) plane_holder.set_ao(VIS_MOBS, ao_enabled) + // Status indicators + var/status_enabled = client.is_preference_enabled(/datum/client_preference/status_indicators) + plane_holder.set_vis(VIS_STATUS, status_enabled) + //set macro to normal incase it was overriden (like cyborg currently does) client.set_hotkeys_macro("macro", "hotkeymode") diff --git a/code/modules/mob/mob_planes.dm b/code/modules/mob/mob_planes.dm index e1c33efe72..bf2ee1929f 100644 --- a/code/modules/mob/mob_planes.dm +++ b/code/modules/mob/mob_planes.dm @@ -29,6 +29,8 @@ plane_masters[VIS_CH_SPECIAL] = new /obj/screen/plane_master{plane = PLANE_CH_SPECIAL} //"Special" role stuff plane_masters[VIS_CH_STATUS_OOC]= new /obj/screen/plane_master{plane = PLANE_CH_STATUS_OOC} //OOC status HUD + plane_masters[VIS_STATUS] = new /obj/screen/plane_master{plane = PLANE_STATUS} //Status indicators that show over mob heads. + plane_masters[VIS_ADMIN1] = new /obj/screen/plane_master{plane = PLANE_ADMIN1} //For admin use plane_masters[VIS_ADMIN2] = new /obj/screen/plane_master{plane = PLANE_ADMIN2} //For admin use plane_masters[VIS_ADMIN3] = new /obj/screen/plane_master{plane = PLANE_ADMIN3} //For admin use diff --git a/polaris.dme b/polaris.dme index 9d6befed58..2b1987662d 100644 --- a/polaris.dme +++ b/polaris.dme @@ -2965,7 +2965,7 @@ #include "code\ZAS\Zone.dm" #include "interface\interface.dm" #include "interface\skin.dmf" -#include "maps\example\example.dm" +#include "maps\southern_cross\southern_cross.dm" #include "maps\submaps\_helpers.dm" #include "maps\submaps\space_submaps\space.dm" #include "maps\submaps\surface_submaps\mountains\mountains.dm"