From 3ab8b52cd3081e125e8cd854f488c8b3154150ec Mon Sep 17 00:00:00 2001 From: ShizCalev Date: Thu, 22 Feb 2018 15:33:45 -0500 Subject: [PATCH] Cleans up some time stuff with DisplayTimeText --- code/__HELPERS/time.dm | 10 +++++----- code/controllers/subsystem/ticker.dm | 2 +- code/game/objects/items/grenades/chem_grenade.dm | 2 +- code/game/objects/items/grenades/grenade.dm | 4 ++-- code/game/objects/items/hot_potato.dm | 2 +- code/modules/admin/admin.dm | 7 ++++--- .../antagonists/abductor/equipment/abduction_gear.dm | 2 +- .../clock_scriptures/scripture_applications.dm | 6 +++--- code/modules/antagonists/cult/cult_comms.dm | 2 +- code/modules/shuttle/navigation_computer.dm | 2 +- 10 files changed, 20 insertions(+), 19 deletions(-) diff --git a/code/__HELPERS/time.dm b/code/__HELPERS/time.dm index 47f9d26d214..daf2b33889d 100644 --- a/code/__HELPERS/time.dm +++ b/code/__HELPERS/time.dm @@ -63,7 +63,7 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0) //Takes a value of time in deciseconds. //Returns a text value of that number in hours, minutes, or seconds. -/proc/DisplayTimeText(time_value) +/proc/DisplayTimeText(time_value, truncate = FALSE) var/second = time_value*0.1 var/second_adjusted = null var/second_rounded = FALSE @@ -91,7 +91,7 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0) second = " and [round(second, 0.1)] seconds" else if(second_adjusted == 1 && second >= 1) - second = "1 second" + second = "[truncate ? "second" : "1 second"]" else if(second > 1) second = "[second_adjusted] seconds" else @@ -121,7 +121,7 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0) else if((day || hour) && !second) minute = " and 1 minute" else - minute = "1 minute" + minute = "[truncate ? "minute" : "1 minute"]" else minute = null @@ -144,7 +144,7 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0) else if(day && (!minute || !second)) hour = " and 1 hour" else - hour = "1 hour" + day = "[truncate ? "hour" : "1 hour"]" else hour = null @@ -153,6 +153,6 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0) if(day > 1) day = "[day] days" else - day = "1 day" + day = "[truncate ? "day" : "1 day"]" return "[day][hour][minute][second]" diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index e8a78cd2904..7b6ab2b49dc 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -594,7 +594,7 @@ SUBSYSTEM_DEF(ticker) to_chat(world, "An admin has delayed the round end.") return - to_chat(world, "Rebooting World in [delay/10] [(delay >= 10 && delay < 20) ? "second" : "seconds"]. [reason]") + to_chat(world, "Rebooting World in [DisplayTimeText(delay)]. [reason]") var/start_wait = world.time UNTIL(round_end_sound_sent || (world.time - start_wait) > (delay * 2)) //don't wait forever diff --git a/code/game/objects/items/grenades/chem_grenade.dm b/code/game/objects/items/grenades/chem_grenade.dm index 8851b3446b1..5f603ec9e27 100644 --- a/code/game/objects/items/grenades/chem_grenade.dm +++ b/code/game/objects/items/grenades/chem_grenade.dm @@ -60,7 +60,7 @@ to_chat(user, "You need to add at least one beaker before locking the [initial(name)] assembly!") else if(stage == READY && !nadeassembly) det_time = det_time == 50 ? 30 : 50 //toggle between 30 and 50 - to_chat(user, "You modify the time delay. It's set for [det_time / 10] second\s.") + to_chat(user, "You modify the time delay. It's set for [DisplayTimeText(det_time)].") else if(stage == EMPTY) to_chat(user, "You need to add an activation mechanism!") diff --git a/code/game/objects/items/grenades/grenade.dm b/code/game/objects/items/grenades/grenade.dm index e4174563b85..d3b7a19ba6c 100644 --- a/code/game/objects/items/grenades/grenade.dm +++ b/code/game/objects/items/grenades/grenade.dm @@ -43,7 +43,7 @@ ..() if(display_timer) if(det_time > 1) - to_chat(user, "The timer is set to [det_time/10] second\s.") + to_chat(user, "The timer is set to [DisplayTimeText(det_time)].") else to_chat(user, "\The [src] is set for instant detonation.") @@ -68,7 +68,7 @@ var/mob/living/carbon/C = user C.throw_mode_on() if(msg) - to_chat(user, "You prime \the [src]! [det_time/10] seconds!") + to_chat(user, "You prime [src]! [DisplayTimeText(det_time)]!") playsound(src, 'sound/weapons/armbomb.ogg', volume, 1) active = TRUE icon_state = initial(icon_state) + "_active" diff --git a/code/game/objects/items/hot_potato.dm b/code/game/objects/items/hot_potato.dm index 3c7293c48db..65bfd09f9c2 100644 --- a/code/game/objects/items/hot_potato.dm +++ b/code/game/objects/items/hot_potato.dm @@ -64,7 +64,7 @@ if(is_active()) to_chat(user, "[src] is flashing red-hot! You should probably get rid of it!") if(show_timer) - to_chat(user, "[src]'s timer looks to be at [(activation_time - world.time) / 10] seconds!") + to_chat(user, "[src]'s timer looks to be at [DisplayTimeText(activation_time - world.time)]!") /obj/item/hot_potato/equipped(mob/user) . = ..() diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index fc4e04f97e2..61ec6316d57 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -595,14 +595,15 @@ if(SSticker.current_state > GAME_STATE_PREGAME) return alert("Too late... The game has already started!") if(newtime) - SSticker.SetTimeLeft(newtime * 10) + newtime = newtime*10 + SSticker.SetTimeLeft(newtime) if(newtime < 0) to_chat(world, "The game start has been delayed.") log_admin("[key_name(usr)] delayed the round start.") else - to_chat(world, "The game will start in [newtime] seconds.") + to_chat(world, "The game will start in [DisplayTimeText(newtime)].") SEND_SOUND(world, sound('sound/ai/attention.ogg')) - log_admin("[key_name(usr)] set the pre-game delay to [newtime] seconds.") + log_admin("[key_name(usr)] set the pre-game delay to [DisplayTimeText(newtime)].") SSblackbox.record_feedback("tally", "admin_verb", 1, "Delay Game Start") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /datum/admins/proc/unprison(mob/M in GLOB.mob_list) diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm index dcc8be412ff..e59ae54a09e 100644 --- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm +++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm @@ -327,7 +327,7 @@ return var/command = stripped_input(user, "Enter the command for your target to follow.\ - Uses Left: [G.mind_control_uses], Duration: [G.mind_control_duration / 10] seconds","Enter command") + Uses Left: [G.mind_control_uses], Duration: [DisplayTimeText(G.mind_control_duration)]","Enter command") if(!command) return diff --git a/code/modules/antagonists/clockcult/clock_scriptures/scripture_applications.dm b/code/modules/antagonists/clockcult/clock_scriptures/scripture_applications.dm index 308a34e9a27..da499065d7b 100644 --- a/code/modules/antagonists/clockcult/clock_scriptures/scripture_applications.dm +++ b/code/modules/antagonists/clockcult/clock_scriptures/scripture_applications.dm @@ -100,13 +100,13 @@ human_servants++ construct_limit = round(CLAMP((human_servants / 4), 1, 3)) - recent_marauders //1 per 4 human servants, maximum of 3, reduced by recent marauder creation if(recent_marauders) - to_chat(invoker, "The Hierophant Network is depleted by a summoning in the last [MARAUDER_SCRIPTURE_SCALING_THRESHOLD / 10] seconds - limiting the number of available marauders by [recent_marauders]!") + to_chat(invoker, "The Hierophant Network is depleted by a summoning in the last [DisplayTimeText(MARAUDER_SCRIPTURE_SCALING_THRESHOLD, TRUE)] - limiting the number of available marauders by [recent_marauders]!") /datum/clockwork_scripture/create_object/construct/clockwork_marauder/pre_recital() channel_time = initial(channel_time) if(recent_marauders) scaled_recital_time = min(recent_marauders * MARAUDER_SCRIPTURE_SCALING_TIME, MARAUDER_SCRIPTURE_SCALING_MAX) - to_chat(invoker, "The Hierophant Network is under strain from repeated summoning, making this scripture [scaled_recital_time / 10] seconds slower!") + to_chat(invoker, "The Hierophant Network is under strain from repeated summoning, making this scripture [DisplayTimeText(scaled_recital_time)] slower!") channel_time += scaled_recital_time return TRUE @@ -118,4 +118,4 @@ /proc/marauder_reset() var/datum/clockwork_scripture/create_object/construct/clockwork_marauder/CM = new() CM.recent_marauders-- - qdel(CM) \ No newline at end of file + qdel(CM) diff --git a/code/modules/antagonists/cult/cult_comms.dm b/code/modules/antagonists/cult/cult_comms.dm index 68c93fa04cb..961f071b022 100644 --- a/code/modules/antagonists/cult/cult_comms.dm +++ b/code/modules/antagonists/cult/cult_comms.dm @@ -364,7 +364,7 @@ to_chat(B.current, "[owner] has marked [C.cult_team.blood_target] in the [A.name] as the cult's top priority, get there immediately!") SEND_SOUND(B.current, sound(pick('sound/hallucinations/over_here2.ogg','sound/hallucinations/over_here3.ogg'),0,1,75)) B.current.client.images += C.cult_team.blood_target_image - to_chat(owner,"You have marked the [target] for the cult! It will last for [base_cooldown/10] seconds.") + to_chat(owner,"You have marked the [target] for the cult! It will last for [DisplayTimeText(base_cooldown)].") name = "Clear the Blood Mark" desc = "Remove the Blood Mark you previously set." button_icon_state = "emp" diff --git a/code/modules/shuttle/navigation_computer.dm b/code/modules/shuttle/navigation_computer.dm index 15257a62a16..e657cfde376 100644 --- a/code/modules/shuttle/navigation_computer.dm +++ b/code/modules/shuttle/navigation_computer.dm @@ -99,7 +99,7 @@ var/mob/camera/aiEye/remote/shuttle_docker/the_eye = eyeobj var/landing_clear = checkLandingSpot() if(designate_time && (landing_clear != SHUTTLE_DOCKER_BLOCKED)) - to_chat(current_user, "Targeting transit location, please wait [designate_time/10] seconds...") + to_chat(current_user, "Targeting transit location, please wait [DisplayTimeText(designate_time)]...") designating_target_loc = the_eye.loc var/wait_completed = do_after(current_user, designate_time, FALSE, designating_target_loc, TRUE, CALLBACK(src, /obj/machinery/computer/camera_advanced/shuttle_docker/proc/canDesignateTarget)) designating_target_loc = null