diff --git a/_maps/map_files/Deltastation/DeltaStation2.dmm b/_maps/map_files/Deltastation/DeltaStation2.dmm index b0bcd53f139..3be17a8b4d4 100644 --- a/_maps/map_files/Deltastation/DeltaStation2.dmm +++ b/_maps/map_files/Deltastation/DeltaStation2.dmm @@ -12086,7 +12086,7 @@ /turf/open/floor/iron, /area/station/maintenance/department/engine/atmos) "cMM" = ( -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "medsci-cell"; name = "Med-Sci Cell"; pixel_y = -32 @@ -37019,7 +37019,7 @@ "iXM" = ( /obj/structure/cable, /obj/item/kirbyplants/random, -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "engcell"; name = "Engineering Cell"; pixel_y = 32 @@ -72744,7 +72744,7 @@ /area/station/engineering/atmos/storage/gas) "rNV" = ( /obj/item/kirbyplants/random, -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "brig1"; name = "Cell 1"; pixel_x = -32 @@ -78116,7 +78116,7 @@ /area/station/maintenance/department/chapel) "tbZ" = ( /obj/item/kirbyplants/random, -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "brig2"; name = "Cell 2"; pixel_x = -32 @@ -83875,7 +83875,7 @@ /turf/open/floor/iron/white/smooth_large, /area/station/medical/psychology) "uxC" = ( -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "cargocell"; name = "Cargo Cell"; pixel_x = -32; diff --git a/_maps/map_files/IceBoxStation/IceBoxStation.dmm b/_maps/map_files/IceBoxStation/IceBoxStation.dmm index 508f2dc56b0..3eec6804474 100644 --- a/_maps/map_files/IceBoxStation/IceBoxStation.dmm +++ b/_maps/map_files/IceBoxStation/IceBoxStation.dmm @@ -11762,7 +11762,7 @@ /turf/open/floor/plating, /area/station/maintenance/starboard/aft) "dwS" = ( -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "Cell 3"; name = "Cell 3"; pixel_x = -32 @@ -21111,7 +21111,7 @@ }, /area/station/command/heads_quarters/rd) "gqZ" = ( -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "Cell 2"; name = "Cell 2"; pixel_x = -32 @@ -65110,7 +65110,7 @@ /turf/open/floor/iron/white, /area/station/medical/medbay/aft) "ubo" = ( -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "Cell 1"; name = "Cell 1"; pixel_x = -32 diff --git a/_maps/map_files/KiloStation/KiloStation.dmm b/_maps/map_files/KiloStation/KiloStation.dmm index f848cf688be..290b94dc5bf 100644 --- a/_maps/map_files/KiloStation/KiloStation.dmm +++ b/_maps/map_files/KiloStation/KiloStation.dmm @@ -42978,7 +42978,7 @@ dir = 8 }, /obj/effect/turf_decal/bot, -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "Cell 5"; name = "Cell 5"; pixel_x = -32 @@ -43511,7 +43511,7 @@ dir = 8 }, /obj/effect/turf_decal/bot, -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "Cell 6"; name = "Cell 6"; pixel_x = -32 @@ -48306,7 +48306,7 @@ dir = 8 }, /obj/effect/turf_decal/bot, -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "Cell 2"; name = "Cell 2"; pixel_x = -32 @@ -58517,7 +58517,7 @@ /obj/effect/turf_decal/stripes/corner{ dir = 8 }, -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "Cell 3"; name = "Cell 3"; pixel_x = -32 @@ -59719,7 +59719,7 @@ dir = 8 }, /obj/effect/turf_decal/bot, -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "Cell 1"; name = "Cell 1"; pixel_x = -32 @@ -65931,7 +65931,7 @@ dir = 8 }, /obj/effect/turf_decal/bot, -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "Cell 4"; name = "Cell 4"; pixel_x = -32 diff --git a/_maps/map_files/MetaStation/MetaStation.dmm b/_maps/map_files/MetaStation/MetaStation.dmm index 402f1d70552..286b0e58eb1 100644 --- a/_maps/map_files/MetaStation/MetaStation.dmm +++ b/_maps/map_files/MetaStation/MetaStation.dmm @@ -9419,7 +9419,7 @@ /turf/open/floor/iron, /area/station/hallway/secondary/exit/departure_lounge) "dyr" = ( -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "Cell 3"; name = "Cell 3"; pixel_x = 32; @@ -55584,7 +55584,7 @@ /area/station/engineering/storage/tech) "tDz" = ( /obj/machinery/light/directional/south, -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "Cell 1"; name = "Cell 1"; pixel_y = -32 @@ -68034,7 +68034,7 @@ /turf/open/floor/plating, /area/station/maintenance/department/science/central) "xWQ" = ( -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "Cell 2"; name = "Cell 2"; pixel_y = -32 diff --git a/_maps/map_files/tramstation/tramstation.dmm b/_maps/map_files/tramstation/tramstation.dmm index 0a2760e5687..2a304614edf 100644 --- a/_maps/map_files/tramstation/tramstation.dmm +++ b/_maps/map_files/tramstation/tramstation.dmm @@ -20462,7 +20462,7 @@ /obj/effect/turf_decal/trimline/red/filled/line{ dir = 1 }, -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "scicell"; name = "Science Cell"; pixel_y = 32 @@ -32076,7 +32076,7 @@ /turf/open/floor/iron, /area/station/hallway/secondary/command) "ldp" = ( -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "crgcell"; name = "Cargo Cell"; pixel_x = 32 @@ -38603,7 +38603,7 @@ /turf/open/floor/iron, /area/station/engineering/atmospherics_engine) "niv" = ( -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "medcell"; name = "Medical Cell"; pixel_y = 32 @@ -40184,7 +40184,7 @@ /turf/open/floor/iron/dark, /area/station/engineering/supermatter/room) "nNP" = ( -/obj/machinery/door_timer{ +/obj/machinery/status_display/door_timer{ id = "engcell"; name = "Engineering Cell"; pixel_x = -32 diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 47a9b3755cf..6721baa255e 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -107,7 +107,6 @@ GLOBAL_LIST_INIT(WALLITEMS_INTERIOR, typecacheof(list( /obj/machinery/computer/security/telescreen, /obj/machinery/computer/security/telescreen/entertainment, /obj/machinery/defibrillator_mount, - /obj/machinery/door_timer, /obj/machinery/embedded_controller/radio/simple_vent_controller, /obj/machinery/firealarm, /obj/machinery/flasher, diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index a2f2c810301..f8aed583d82 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -1,30 +1,22 @@ -#define CHARS_PER_LINE 5 -#define FONT_SIZE "5pt" -#define FONT_COLOR "#09f" -#define FONT_STYLE "Small Fonts" #define MAX_TIMER 15 MINUTES - #define PRESET_SHORT 2 MINUTES #define PRESET_MEDIUM 3 MINUTES #define PRESET_LONG 5 MINUTES - - -/////////////////////////////////////////////////////////////////////////////////////////////// -// Brig Door control displays. -// Description: This is a controls the timer for the brig doors, displays the timer on itself and -// has a popup window when used, allowing to set the timer. -// Code Notes: Combination of old brigdoor.dm code from rev4407 and the status_display.dm code -// Date: 01/September/2010 -// Programmer: Veryinky -///////////////////////////////////////////////////////////////////////////////////////////////// -/obj/machinery/door_timer +/** + * Brig Door control displays. + * + * This is a controls the timer for the brig doors, displays the timer on itself and + * has a popup window when used, allowing to set the timer. + */ +/obj/machinery/status_display/door_timer name = "door timer" - icon = 'icons/obj/status_display.dmi' - icon_state = "frame" desc = "A remote control for a door." + current_mode = SD_MESSAGE req_access = list(ACCESS_SECURITY) - density = FALSE + text_color = "#F44" + header_text_color = "#F88" + var/id = null // id of linked machinery/lockers var/activation_time = 0 @@ -37,21 +29,15 @@ var/list/flashers = list() ///List of weakrefs to nearby closets var/list/closets = list() + ///needed to send messages to sec radio + var/obj/item/radio/sec_radio - var/obj/item/radio/Radio //needed to send messages to sec radio - - maptext_height = 26 - maptext_width = 32 - maptext_y = -1 - -/obj/machinery/door_timer/Initialize(mapload) +/obj/machinery/status_display/door_timer/Initialize(mapload) . = ..() - Radio = new/obj/item/radio(src) - Radio.set_listening(FALSE) + sec_radio = new/obj/item/radio(src) + sec_radio.set_listening(FALSE) -/obj/machinery/door_timer/Initialize(mapload) - . = ..() if(id != null) for(var/obj/machinery/door/window/brigdoor/M in urange(20, src)) if (M.id == id) @@ -67,29 +53,48 @@ if(!length(doors) && !length(flashers) && length(closets)) atom_break() - update_appearance() - //Main door timer loop, if it's timing and time is >0 reduce time by 1. // if it's less than 0, open door, reset timer // update the door_timer window and the icon -/obj/machinery/door_timer/process() +/obj/machinery/status_display/door_timer/process() if(machine_stat & (NOPOWER|BROKEN)) + // No power, no processing. + update_appearance() + return PROCESS_KILL + + if(!timing) + return PROCESS_KILL + + if(world.time - activation_time >= timer_duration) + timer_end() // open doors, reset timer, clear status screen + update_content() + +/** + * Update the display content. + */ +/obj/machinery/status_display/door_timer/proc/update_content() + var/time_left = time_left(seconds = TRUE) + + if(time_left == 0) + set_messages("", "") return - if(timing) - if(world.time - activation_time >= timer_duration) - timer_end() // open doors, reset timer, clear status screen - update_appearance() + var/disp1 = name + var/disp2 = "[add_leading(num2text((time_left / 60) % 60), 2, "0")]:[add_leading(num2text(time_left % 60), 2, "0")]" + set_messages(disp1, disp2) -// open/closedoor checks if door_timer has power, if so it checks if the -// linked door is open/closed (by density) then opens it/closes it. -/obj/machinery/door_timer/proc/timer_start() +/** + * Starts counting down the timer and closes linked the door. + * The timer is expected to have already been set by set_timer() + */ +/obj/machinery/status_display/door_timer/proc/timer_start() if(machine_stat & (NOPOWER|BROKEN)) return 0 activation_time = world.time timing = TRUE + begin_processing() for(var/datum/weakref/door_ref as anything in doors) var/obj/machinery/door/window/brigdoor/door = door_ref.resolve() @@ -113,20 +118,23 @@ closet.update_appearance() return 1 - -/obj/machinery/door_timer/proc/timer_end(forced = FALSE) - +/** + * Stops the timer and resets the timer to 0, and opens the linked door. + * Arguments: + * * forced - TRUE if it was forced to stop rather than timing out. Will skip radioing, etc. + */ +/obj/machinery/status_display/door_timer/proc/timer_end(forced = FALSE) if(machine_stat & (NOPOWER|BROKEN)) return 0 if(!forced) - Radio.set_frequency(FREQ_SECURITY) - Radio.talk_into(src, "Timer has expired. Releasing prisoner.", FREQ_SECURITY) + sec_radio.set_frequency(FREQ_SECURITY) + sec_radio.talk_into(src, "Timer has expired. Releasing prisoner.", FREQ_SECURITY) timing = FALSE activation_time = null set_timer(0) - update_appearance() + end_processing() for(var/datum/weakref/door_ref as anything in doors) var/obj/machinery/door/window/brigdoor/door = door_ref.resolve() @@ -151,67 +159,37 @@ return 1 - -/obj/machinery/door_timer/proc/time_left(seconds = FALSE) - . = max(0,timer_duration - (activation_time ? world.time - activation_time : 0)) +/** + * Return time left. + * Arguments: + * * seconds - return time in seconds it TRUE, else deciseconds. + */ +/obj/machinery/status_display/door_timer/proc/time_left(seconds = FALSE) + . = max(0, timer_duration - (activation_time ? world.time - activation_time : 0)) if(seconds) . /= 10 -/obj/machinery/door_timer/proc/set_timer(value) - var/new_time = clamp(value,0,MAX_TIMER) +/** + * Set the timer. Does NOT automatically start counting down, but does update the display. + * + * returns TRUE if no change occurred + * + * Arguments: + * value - time in deciseconds to set the timer for. + */ +/obj/machinery/status_display/door_timer/proc/set_timer(value) + var/new_time = clamp(value, 0, MAX_TIMER) . = new_time == timer_duration //return 1 on no change timer_duration = new_time + update_content() -/obj/machinery/door_timer/ui_interact(mob/user, datum/tgui/ui) +/obj/machinery/status_display/door_timer/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "BrigTimer", name) ui.open() -//icon update function -// if NOPOWER, display blank -// if BROKEN, display blue screen of death icon AI uses -// if timing=true, run update display function -/obj/machinery/door_timer/update_icon() - . = ..() - if(machine_stat & (NOPOWER)) - return - - if(machine_stat & (BROKEN)) - set_picture("ai_bsod") - return - - if(timing) - var/disp1 = id - var/time_left = time_left(seconds = TRUE) - var/disp2 = "[add_leading(num2text((time_left / 60) % 60), 2, "0")]:[add_leading(num2text(time_left % 60), 2, "0")]" - if(length(disp2) > CHARS_PER_LINE) - disp2 = "Error" - update_display(disp1, disp2) - else - if(maptext) - maptext = "" - return - - -// Adds an icon in case the screen is broken/off, stolen from status_display.dm -/obj/machinery/door_timer/proc/set_picture(state) - if(maptext) - maptext = "" - cut_overlays() - add_overlay(mutable_appearance('icons/obj/status_display.dmi', state)) - - -//Checks to see if there's 1 line or 2, adds text-icons-numbers/letters over display -// Stolen from status_display -/obj/machinery/door_timer/proc/update_display(line1, line2) - line1 = uppertext(line1) - line2 = uppertext(line2) - var/new_text = {"