diff --git a/code/datums/security_state.dm b/code/datums/security_state.dm index 8cbb5c51c91..f992709b90e 100644 --- a/code/datums/security_state.dm +++ b/code/datums/security_state.dm @@ -148,6 +148,13 @@ var/up_description var/down_description + var/datum/alarm_appearance/alarm_appearance + +/decl/security_level/New() + . = ..() + if(ispath(alarm_appearance, /datum/alarm_appearance)) + alarm_appearance = new alarm_appearance + // Called when we're switching from a lower security level to this one. /decl/security_level/proc/switching_up_to() return @@ -205,6 +212,8 @@ overlay_alarm = "alarm_green" overlay_status_display = "status_display_green" + alarm_appearance = /datum/alarm_appearance/green + down_description = "All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced." /decl/security_level/default/code_blue @@ -219,6 +228,8 @@ overlay_alarm = "alarm_blue" overlay_status_display = "status_display_blue" + alarm_appearance = /datum/alarm_appearance/blue + up_description = "The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible, random searches are permitted." down_description = "The immediate threat has passed. Security may no longer have weapons drawn at all times, but may continue to have them visible. Random searches are still allowed." @@ -234,6 +245,8 @@ overlay_alarm = "alarm_red" overlay_status_display = "status_display_red" + alarm_appearance = /datum/alarm_appearance/red + up_description = "There is an immediate serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised." down_description = "The self-destruct mechanism has been deactivated, there is still however an immediate serious threat to the station. Security may have weapons unholstered at all times, random searches are allowed and advised." @@ -246,6 +259,8 @@ light_color_alarm = COLOR_RED light_color_status_display = COLOR_NAVY_BLUE + alarm_appearance = /datum/alarm_appearance/delta + overlay_alarm = "alarm_delta" overlay_status_display = "status_display_delta" @@ -254,3 +269,65 @@ /decl/security_level/default/code_delta/switching_up_to() security_announcement_delta.Announce("The self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill.", "Attention! Delta security level reached!") notify_station() + +/datum/alarm_appearance + var/display_icon //The icon_state for the displays. Normally only one is used, unless uses_twotone_displays is TRUE. + var/display_icon_color //The color for the display icon. + + var/display_icon_twotone //Used for two-tone displays. + var/display_icon_twotone_color //The color for the display icon. + + var/display_emblem //The icon_state for the emblem, i.e for delta, a radstorm, alerts. + var/display_emblem_color //The color for the emblem. + + var/alarm_icon //The icon_state for the alarms + var/alarm_icon_color //the color for the icon_state + + var/alarm_icon_twotone //Used for two-tone alarms (i.e delta). + var/alarm_icon_twotone_color //The color for the secondary tone icon. + +/datum/alarm_appearance/green + display_icon = "status_display_lines" + display_icon_color = PIPE_COLOR_GREEN + + display_emblem = "status_display_alert" + display_emblem_color = COLOR_WHITE + + alarm_icon = "alarm_normal" + alarm_icon_color = PIPE_COLOR_GREEN + +/datum/alarm_appearance/blue + display_icon = "status_display_lines" + display_icon_color = COLOR_BLUE + + display_emblem = "status_display_alert" + display_emblem_color = COLOR_WHITE + + alarm_icon = "alarm_normal" + alarm_icon_color = COLOR_BLUE + +/datum/alarm_appearance/red + display_icon = "status_display_lines" + display_icon_color = COLOR_RED + + display_emblem = "status_display_alert" + display_emblem_color = COLOR_WHITE + + alarm_icon = "alarm_blinking" + alarm_icon_color = COLOR_RED + +/datum/alarm_appearance/delta + display_icon = "status_display_twotone1" + display_icon_color = COLOR_RED + + display_icon_twotone = "status_display_twotone2" + display_icon_twotone_color = COLOR_YELLOW + + display_emblem = "delta" + display_emblem_color = COLOR_WHITE + + alarm_icon = "alarm_blinking_twotone1" + alarm_icon_color = COLOR_RED + + alarm_icon_twotone = "alarm_blinking_twotone2" + alarm_icon_twotone_color = PIPE_COLOR_YELLOW \ No newline at end of file diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 628829080d9..1430276b619 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -159,7 +159,7 @@ GLOB.name_set_event.register(alarm_area, src, .proc/change_area_name) set_frequency(frequency) - update_icon() + queue_icon_update() /obj/machinery/alarm/get_req_access() if(!locked) @@ -870,7 +870,16 @@ FIRE ALARM var/decl/security_level/sl = security_state.current_security_level set_light(sl.light_max_bright, sl.light_inner_range, sl.light_outer_range, 2, sl.light_color_alarm) - overlays += image(sl.icon, sl.overlay_alarm) + + if(sl.alarm_appearance.alarm_icon) + var/image/alert1 = image(sl.icon, sl.alarm_appearance.alarm_icon) + alert1.color = sl.alarm_appearance.alarm_icon_color + overlays |= alert1 + + if(sl.alarm_appearance.alarm_icon_twotone) + var/image/alert2 = image(sl.icon, sl.alarm_appearance.alarm_icon_twotone) + alert2.color = sl.alarm_appearance.alarm_icon_twotone_color + overlays |= alert2 else overlays += get_cached_overlay("fire0") diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 887e37a315e..19e242998f4 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -165,9 +165,22 @@ var/decl/security_state/security_state = decls_repository.get_decl(GLOB.using_map.security_state) var/decl/security_level/sl = security_state.current_security_level - var/image/alert = image(sl.icon, sl.overlay_status_display) set_light(sl.light_max_bright, sl.light_inner_range, sl.light_outer_range, 2, sl.light_color_alarm) - overlays |= alert + + if(sl.alarm_appearance.display_icon) + var/image/alert1 = image(sl.icon, sl.alarm_appearance.display_icon) + alert1.color = sl.alarm_appearance.display_icon_color + overlays |= alert1 + + if(sl.alarm_appearance.display_icon_twotone) + var/image/alert2 = image(sl.icon, sl.alarm_appearance.display_icon_twotone) + alert2.color = sl.alarm_appearance.display_icon_twotone_color + overlays |= alert2 + + if(sl.alarm_appearance.display_emblem) + var/image/alert3 = image(sl.icon, sl.alarm_appearance.display_emblem) + alert3.color = sl.alarm_appearance.display_emblem_color + overlays |= alert3 /obj/machinery/status_display/proc/set_picture(state) remove_display() diff --git a/code/unit_tests/security_state.dm b/code/unit_tests/security_state.dm new file mode 100644 index 00000000000..ab177b701b6 --- /dev/null +++ b/code/unit_tests/security_state.dm @@ -0,0 +1,18 @@ +/datum/unit_test/shall_have_valid_alarm_appearance + name = "SECURITY STATES: Shall Have Valid Alarm Appearance Datum Types" + +/datum/unit_test/shall_have_valid_alarm_appearance/start_test() + var/list/security_levels = decls_repository.get_decls_of_subtype(/decl/security_level) + var/list/failures + var/list/blacklist = list(/decl/security_level/default) + for(var/sec_key in security_levels) + var/decl/security_level/level = security_levels[sec_key] + if(level.type in blacklist) + continue + if(!istype(level.alarm_appearance, /datum/alarm_appearance)) + LAZYADD(failures, "[level.type]") + if(LAZYLEN(failures)) + fail("One or more security levels did not have their alarm_appearance_type var set: [english_list(failures)]") + else + pass("All security levels have their alarm_appearance_type set.") + return 1 \ No newline at end of file diff --git a/icons/misc/security_state.dmi b/icons/misc/security_state.dmi index ca5d0f05ed7..aff829cdb6c 100644 Binary files a/icons/misc/security_state.dmi and b/icons/misc/security_state.dmi differ diff --git a/nebula.dme b/nebula.dme index 36bd2d696d9..96ded417f7c 100644 --- a/nebula.dme +++ b/nebula.dme @@ -3208,6 +3208,7 @@ #include "code\unit_tests\music_test.dm" #include "code\unit_tests\organ_tests.dm" #include "code\unit_tests\power_tests.dm" +#include "code\unit_tests\security_state.dm" #include "code\unit_tests\seed_tests.dm" #include "code\unit_tests\shuttle_tests.dm" #include "code\unit_tests\submaps.dm"