From 629c099db7149e4e48b39e1525a503cfc21c57b9 Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Mon, 29 Aug 2022 16:45:29 +0100 Subject: [PATCH] Refactors status displays (#18811) * Refactors status displays * biggest commit --- code/__DEFINES/machines.dm | 21 ++ code/__DEFINES/radio.dm | 1 - .../weather/weather_types/radiation_storm.dm | 5 +- code/game/machinery/ai_display.dm | 112 ++++++++ .../game/machinery/computer/communications.dm | 49 +--- code/game/machinery/doors/brigdoors.dm | 12 +- code/game/machinery/status_display.dm | 263 +++++------------- code/game/machinery/supply_display.dm | 35 +-- code/modules/events/door_runtime.dm | 2 +- code/modules/mob/living/silicon/ai/ai.dm | 17 +- code/modules/mob/living/silicon/ai/death.dm | 6 +- code/modules/mob/living/silicon/ai/login.dm | 5 +- code/modules/mob/living/silicon/ai/logout.dm | 8 +- .../modules/mob/living/silicon/decoy/death.dm | 6 +- code/modules/pda/cart_apps.dm | 53 ++-- .../security_levels/security_levels.dm | 12 +- code/modules/shuttle/supply.dm | 14 - icons/obj/status_display.dmi | Bin 125474 -> 124206 bytes paradise.dme | 1 + .../tgui/interfaces/CommunicationsComputer.js | 2 +- .../tgui/interfaces/pda/pda_status_display.js | 20 +- tgui/packages/tgui/public/tgui.bundle.js | 2 +- 22 files changed, 294 insertions(+), 352 deletions(-) create mode 100644 code/game/machinery/ai_display.dm diff --git a/code/__DEFINES/machines.dm b/code/__DEFINES/machines.dm index 50ceb5ad927..3a8662dedee 100644 --- a/code/__DEFINES/machines.dm +++ b/code/__DEFINES/machines.dm @@ -105,3 +105,24 @@ #define LOGIN_TYPE_AI 2 #define LOGIN_TYPE_ROBOT 3 #define LOGIN_TYPE_ADMIN 4 + +// Status display maptext stuff +#define DISPLAY_CHARS_PER_LINE 5 +#define DISPLAY_FONT_SIZE "5pt" +#define DISPLAY_FONT_COLOR "#09f" +#define DISPLAY_WARNING_FONT_COLOR "#f90" +#define DISPLAY_FONT_STYLE "Small Fonts" +#define DISPLAY_SCROLL_SPEED 2 + +// Status display mode types +#define STATUS_DISPLAY_BLANK 0 +#define STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME 1 +#define STATUS_DISPLAY_MESSAGE 2 +#define STATUS_DISPLAY_ALERT 3 +#define STATUS_DISPLAY_TIME 4 +#define STATUS_DISPLAY_CUSTOM 5 + +// AI display mode types +#define AI_DISPLAY_MODE_BLANK 0 +#define AI_DISPLAY_MODE_EMOTE 1 +#define AI_DISPLAY_MODE_BSOD 2 diff --git a/code/__DEFINES/radio.dm b/code/__DEFINES/radio.dm index ec3c987bb20..e5162b73ec6 100644 --- a/code/__DEFINES/radio.dm +++ b/code/__DEFINES/radio.dm @@ -1,5 +1,4 @@ -#define DISPLAY_FREQ 1435 //status displays #define ATMOS_FIRE_FREQ 1437 //air alarms #define ENGINE_FREQ 1438 //engine components #define ATMOS_VENTSCRUB 1439 //vents, scrubbers, atmos control diff --git a/code/datums/weather/weather_types/radiation_storm.dm b/code/datums/weather/weather_types/radiation_storm.dm index 221c0005c6d..6c6a1d5cbfe 100644 --- a/code/datums/weather/weather_types/radiation_storm.dm +++ b/code/datums/weather/weather_types/radiation_storm.dm @@ -67,7 +67,6 @@ /datum/weather/rad_storm/proc/status_alarm(active) //Makes the status displays show the radiation warning for those who missed the announcement. if(active) - post_status("alert", "radiation") + post_status(STATUS_DISPLAY_ALERT, "radiation") else - post_status("blank") - post_status("shuttle") + post_status(STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME) diff --git a/code/game/machinery/ai_display.dm b/code/game/machinery/ai_display.dm new file mode 100644 index 00000000000..599c171e960 --- /dev/null +++ b/code/game/machinery/ai_display.dm @@ -0,0 +1,112 @@ +GLOBAL_LIST_EMPTY(ai_displays) + + +/obj/machinery/ai_status_display + icon = 'icons/obj/status_display.dmi' + icon_state = "frame" + name = "AI display" + anchored = TRUE + density = FALSE + + var/spookymode = FALSE + + /// Current mode + var/mode = AI_DISPLAY_MODE_BLANK + + /// Target icon state + var/picture_state + /// Current emotion, used to calculate an icon state + var/emotion = "Neutral" + +/obj/machinery/ai_status_display/Initialize(mapload) + . = ..() + GLOB.ai_displays |= src + +/obj/machinery/ai_status_display/Destroy() + GLOB.ai_displays -= src + return ..() + +/obj/machinery/ai_status_display/attack_ai(mob/living/silicon/ai/user) + if(isAI(user)) + user.ai_statuschange() + +/obj/machinery/ai_status_display/emp_act(severity) + if(stat & (BROKEN|NOPOWER)) + ..(severity) + return + mode = AI_DISPLAY_MODE_BSOD + update_icon() + ..(severity) + +/obj/machinery/ai_status_display/power_change() + ..() + if(stat & NOPOWER) + set_light(0) + else + set_light(1, LIGHTING_MINIMUM_POWER) + +/obj/machinery/ai_status_display/flicker() + if(stat & (NOPOWER | BROKEN)) + return FALSE + + spookymode = TRUE + update_icon() + return TRUE + +/obj/machinery/ai_status_display/update_overlays() + . = ..() + + var/new_display + + underlays.Cut() + + if(stat & NOPOWER) + return + + switch(mode) + // Blank + if(AI_DISPLAY_MODE_BLANK) + new_display = "ai_off" + + // AI emoticon + if(AI_DISPLAY_MODE_EMOTE) + switch(emotion) + if("Very Happy") + new_display = "ai_veryhappy" + if("Happy") + new_display = "ai_happy" + if("Neutral") + new_display = "ai_neutral" + if("Unsure") + new_display = "ai_unsure" + if("Confused") + new_display = "ai_confused" + if("Sad") + new_display = "ai_sad" + if("Surprised") + new_display = "ai_surprised" + if("Upset") + new_display = "ai_upset" + if("Angry") + new_display = "ai_angry" + if("BSOD") + new_display = "ai_bsod" + if("Blank") + new_display = "ai_off" + if("Problems?") + new_display = "ai_trollface" + if("Awesome") + new_display = "ai_awesome" + if("Dorfy") + new_display = "ai_urist" + if("Facepalm") + new_display = "ai_facepalm" + if("Friend Computer") + new_display = "ai_friend" + + // BSOD + if(AI_DISPLAY_MODE_BSOD) + new_display = "ai_bsod" + + . += new_display + underlays += emissive_appearance(icon, "lightmask") diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index b35d23025a6..5c493bf4506 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -33,7 +33,7 @@ var/stat_msg1 var/stat_msg2 - var/display_type = "blank" + var/display_type = STATUS_DISPLAY_TIME var/display_icon var/datum/announcement/priority/crew_announcement = new @@ -155,7 +155,7 @@ return call_shuttle_proc(usr, input) if(SSshuttle.emergency.timer) - post_status("shuttle") + post_status(STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME) setMenuState(usr, COMM_SCREEN_MAIN) if("cancelshuttle") @@ -166,7 +166,7 @@ if(response == "Yes") cancel_call_proc(usr) if(SSshuttle.emergency.timer) - post_status("shuttle") + post_status(STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME) setMenuState(usr, COMM_SCREEN_MAIN) if("messagelist") @@ -198,17 +198,17 @@ // Status display stuff if("setstat") - display_type = params["statdisp"] + display_type = text2num(params["statdisp"]) switch(display_type) - if("message") + if(STATUS_DISPLAY_MESSAGE) display_icon = null - post_status("message", stat_msg1, stat_msg2, usr) - if("alert") + post_status(STATUS_DISPLAY_MESSAGE, stat_msg1, stat_msg2) + if(STATUS_DISPLAY_ALERT) display_icon = params["alert"] - post_status("alert", params["alert"], user = usr) + post_status(STATUS_DISPLAY_ALERT, params["alert"]) else display_icon = null - post_status(params["statdisp"], user = usr) + post_status(display_type) setMenuState(usr, COMM_SCREEN_STAT) if("setmsg1") @@ -337,9 +337,9 @@ "line_2" = (stat_msg2 ? stat_msg2 : "-----"), "presets" = list( - list("name" = "blank", "label" = "Clear", "desc" = "Blank slate"), - list("name" = "shuttle", "label" = "Shuttle ETA", "desc" = "Display how much time is left."), - list("name" = "message", "label" = "Message", "desc" = "A custom message.") + list("name" = STATUS_DISPLAY_BLANK, "label" = "Clear", "desc" = "Blank slate"), + list("name" = STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME, "label" = "Shuttle ETA", "desc" = "Display how much time is left."), + list("name" = STATUS_DISPLAY_MESSAGE, "label" = "Message", "desc" = "A custom message.") ), "alerts"=list( @@ -450,6 +450,7 @@ to_chat(user, "Central Command does not allow the shuttle to be called at this time. Please stand by.") //This may show up before Epsilon Alert/Before DS arrives return + // AA 2022-08-18 - Why is this not a round time offset?? if(world.time < 54000) // 30 minute grace period to let the game get going to_chat(user, "The shuttle is refueling. Please wait another [round((54000-world.time)/600)] minutes before trying again.") return @@ -469,7 +470,7 @@ message_admins("[key_name_admin(user)] has called the shuttle - [formatJumpTo(user)].", 1) return - +// Why the hell are all these procs global? /proc/cancel_call_proc(mob/user) if(SSshuttle.cancelEvac(user)) log_game("[key_name(user)] has recalled the shuttle.") @@ -479,28 +480,6 @@ log_game("[key_name(user)] has tried and failed to recall the shuttle.") message_admins("[key_name_admin(user)] has tried and failed to recall the shuttle - ([ADMIN_FLW(user,"FLW")]).", 1) -/proc/post_status(command, data1, data2, mob/user = null) - - var/datum/radio_frequency/frequency = SSradio.return_frequency(DISPLAY_FREQ) - - if(!frequency) return - - var/datum/signal/status_signal = new - status_signal.transmission_method = 1 - status_signal.data["command"] = command - - switch(command) - if("message") - status_signal.data["msg1"] = data1 - status_signal.data["msg2"] = data2 - log_admin("STATUS: [user] set status screen message: [data1] [data2]") - //message_admins("STATUS: [user] set status screen with [PDA]. Message: [data1] [data2]") - if("alert") - status_signal.data["picture_state"] = data1 - - spawn(0) - frequency.post_signal(null, status_signal) - /obj/machinery/computer/communications/Destroy() GLOB.shuttle_caller_list -= src diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index 0080a375478..36bbce914e9 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -1,7 +1,3 @@ -#define CHARS_PER_LINE 5 -#define FONT_SIZE "5pt" -#define FONT_COLOR "#09f" -#define FONT_STYLE "Small Fonts" #define CELL_NONE "None" /////////////////////////////////////////////////////////////////////////////////////////////// @@ -416,7 +412,7 @@ var/disp1 = id var/timeleft = timeleft() var/disp2 = "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]" - if(length(disp2) > CHARS_PER_LINE) + if(length(disp2) > DISPLAY_CHARS_PER_LINE) disp2 = "Error" update_display(disp1, disp2) else @@ -440,7 +436,7 @@ /obj/machinery/door_timer/proc/update_display(line1, line2) line1 = uppertext(line1) line2 = uppertext(line2) - var/new_text = {"
a!(*)C
z%4=OWqV0~&HceV|s|lx|r)>G?9U)>Ga*IBbgt$wqEWbC%Kv7NtUi*TP{A)5NsX