Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Grayscaled Alarm and Status Display Icons #304

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions code/datums/security_state.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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."

Expand All @@ -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."

Expand All @@ -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"

Expand All @@ -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
13 changes: 11 additions & 2 deletions code/game/machinery/alarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")

Expand Down
17 changes: 15 additions & 2 deletions code/game/machinery/status_display.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 18 additions & 0 deletions code/unit_tests/security_state.dm
Original file line number Diff line number Diff line change
@@ -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
Binary file modified icons/misc/security_state.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions nebula.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down