diff --git a/code/__HELPERS/time.dm b/code/__HELPERS/time.dm index 872f299479c..4b71a2c7162 100644 --- a/code/__HELPERS/time.dm +++ b/code/__HELPERS/time.dm @@ -29,7 +29,7 @@ /proc/time_stamp() return time2text(world.timeofday, "hh:mm:ss") - + /proc/gameTimestamp(format = "hh:mm:ss") // Get the game time in text return time2text(world.time - timezoneOffset + 432000, format) @@ -61,6 +61,12 @@ proc/isDay(var/month, var/day) */ /proc/stop_watch(wh) return round(0.1 * (TimeOfGame - wh), 0.1) - + /proc/month2number(month) - return month_names.Find(month) \ No newline at end of file + return month_names.Find(month) + +//Take a value in seconds and returns a string of minutes and seconds in the format X minute(s) and X seconds. +/proc/seconds_to_time(var/seconds as num) + var/numSeconds = seconds % 60 + var/numMinutes = (seconds - numSeconds) / 60 + return "[numMinutes] [numMinutes > 1 ? "minutes" : "minute"] and [numSeconds] seconds." \ No newline at end of file diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index 818f251024c..39fa5e04037 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -46,7 +46,7 @@
Admission data:

Log generated at: [worldtime2text()]
Detainee: [logname]
- Duration: [timetoset/10] seconds
+ Duration: [seconds_to_time(timetoset / 10)]
Charge(s): [logcharges]
Arresting Officer: [usr.name]


This log file was generated automatically upon activation of a cell timer."} @@ -55,7 +55,7 @@ cell_logs += P var/datum/data/record/R = find_security_record("name", logname) - Radio.autosay("Detainee [logname] has been incarcerated for [timetoset/10] seconds for the charges of, '[logcharges]'. \ + Radio.autosay("Detainee [logname] has been incarcerated for [seconds_to_time(timetoset / 10)] for the charges of, '[logcharges]'. \ Arresting Officer: [usr.name].[R ? "" : " Detainee record not found, manual record update required."]", name, "Security", list(z)) if(R) @@ -277,7 +277,7 @@ dat += "Set Timer: [(setminute ? text("[setminute]:") : null)][setsecond]
" // Controls - dat += "- - + +
" + dat += "Input Time" // Mounted flash controls for(var/obj/machinery/flasher/F in targets) @@ -319,13 +319,9 @@ Radio.autosay("Timer stopped manually by [usr.name].", name, "Security", list(z)) else - if(href_list["tp"]) //adjust timer, close door if not already closed - var/tp = text2num(href_list["tp"]) - var/addtime = (timetoset / 10) - addtime += tp - addtime = min(max(round(addtime), 0), 3600) - - timeset(addtime) + if(href_list["settime"]) + var/time = min(max(round(return_time_input(usr)), 0), 3600) + timeset(time) if(href_list["fc"]) for(var/obj/machinery/flasher/F in targets) @@ -368,6 +364,11 @@ overlays.Cut() overlays += image('icons/obj/status_display.dmi', icon_state=picture_state) +/obj/machinery/door_timer/proc/return_time_input() + var/mins = input(usr, "Minutes", "Enter number of minutes", 0) as num + var/seconds = input(usr, "Seconds", "Enter number of seconds", 0) as num + var/totaltime = (seconds + (mins * 60)) + return totaltime //Checks to see if there's 1 line or 2, adds text-icons-numbers/letters over display // Stolen from status_display