[MIRROR] Cleans up some time stuff with DisplayTimeText (#5685)

* Cleans up some time stuff with DisplayTimeText

* Update hot_potato.dm
This commit is contained in:
CitadelStationBot
2018-02-24 07:02:45 -06:00
committed by Poojawa
parent 26702fda91
commit b7015c379a
10 changed files with 171 additions and 169 deletions
+5 -5
View File
@@ -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]"
+1 -1
View File
@@ -629,7 +629,7 @@ SUBSYSTEM_DEF(ticker)
to_chat(world, "<span class='boldannounce'>An admin has delayed the round end.</span>")
return
to_chat(world, "<span class='boldannounce'>Rebooting World in [delay/10] [(delay >= 10 && delay < 20) ? "second" : "seconds"]. [reason]</span>")
to_chat(world, "<span class='boldannounce'>Rebooting World in [DisplayTimeText(delay)]. [reason]</span>")
var/start_wait = world.time
UNTIL(round_end_sound_sent || (world.time - start_wait) > (delay * 2)) //don't wait forever
@@ -48,7 +48,7 @@
to_chat(user, "<span class='warning'>You need to add at least one beaker before locking the [initial(name)] assembly!</span>")
else if(stage == READY && !nadeassembly)
det_time = det_time == 50 ? 30 : 50 //toggle between 30 and 50
to_chat(user, "<span class='notice'>You modify the time delay. It's set for [det_time / 10] second\s.</span>")
to_chat(user, "<span class='notice'>You modify the time delay. It's set for [DisplayTimeText(det_time)].</span>")
else if(stage == EMPTY)
to_chat(user, "<span class='warning'>You need to add an activation mechanism!</span>")
+2 -2
View File
@@ -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, "<span class='warning'>You prime \the [src]! [det_time/10] seconds!</span>")
to_chat(user, "<span class='warning'>You prime [src]! [DisplayTimeText(det_time)]!</span>")
playsound(src, 'sound/weapons/armbomb.ogg', volume, 1)
active = TRUE
icon_state = initial(icon_state) + "_active"
+152 -151
View File
@@ -1,151 +1,152 @@
//CREATOR'S NOTE: DO NOT FUCKING GIVE THIS TO BOTANY!
/obj/item/hot_potato
name = "hot potato"
desc = "A label on the side of this potato reads \"Product of DonkCo Service Wing. Activate far away from populated areas. Device will only attach to sapient creatures.\" <span class='boldnotice'>You can attack anyone with it to force it on them instead of yourself!</span>"
icon = 'icons/obj/hydroponics/harvest.dmi'
icon_state = "potato"
flags_1 = NOBLUDGEON_1
force = 0
var/icon_off = "potato"
var/icon_on = "potato_active"
var/detonation_timerid
var/activation_time = 0
var/timer = 600 //deciseconds
var/show_timer = FALSE
var/reusable = FALSE //absolute madman
var/sticky = TRUE
var/forceful_attachment = TRUE
var/stimulant = TRUE
var/detonate_explosion = TRUE
var/detonate_dev_range = 0
var/detonate_heavy_range = 0
var/detonate_light_range = 2
var/detonate_flash_range = 5
var/detonate_fire_range = 5
var/color_val = FALSE
/obj/item/hot_potato/proc/detonate()
var/atom/location = loc
location.visible_message("<span class='userdanger'>[src] [detonate_explosion? "explodes" : "activates"]!</span>", "<span class='userdanger'>[src] activates! You've ran out of time!</span>")
if(detonate_explosion)
explosion(src, detonate_dev_range, detonate_heavy_range, detonate_light_range, detonate_flash_range, flame_range = detonate_fire_range)
deactivate()
if(!reusable)
var/mob/M = loc
if(istype(M))
M.dropItemToGround(src, TRUE)
qdel(src)
/obj/item/hot_potato/proc/is_active()
return isnull(detonation_timerid)? FALSE : TRUE
/obj/item/hot_potato/attack_self(mob/user)
if(activate(timer, user))
user.visible_message("<span class='boldwarning'>[user] squeezes [src], which promptly starts to flash red-hot colors!</span>", "<span class='boldwarning'>You squeeze [src], activating its countdown and attachment mechanism!</span>",
"<span class='boldwarning'>You hear a mechanical click and a loud beeping!</span>")
return
return ..()
/obj/item/hot_potato/process()
if(stimulant)
if(isliving(loc))
var/mob/living/L = loc
L.SetStun(0)
L.SetKnockdown(0)
L.SetSleeping(0)
L.SetUnconscious(0)
L.reagents.add_reagent("muscle_stimulant", CLAMP(5 - L.reagents.get_reagent_amount("muscle_stimulant"), 0, 5)) //If you don't have legs or get bola'd, tough luck!
color_val = !color_val
L.add_atom_colour(color_val? "#ffff00" : "#00ffff", FIXED_COLOUR_PRIORITY)
/obj/item/hot_potato/examine(mob/user)
. = ..()
if(is_active())
to_chat(user, "<span class='warning'>[src] is flashing red-hot! You should probably get rid of it!</span>")
if(show_timer)
to_chat(user, "<span class='warning'>[src]'s timer looks to be at [(activation_time - world.time) / 10] seconds!</span>")
/obj/item/hot_potato/equipped(mob/user)
. = ..()
if(is_active())
to_chat(user, "<span class='userdanger'>You have a really bad feeling about [src]!</span>")
/obj/item/hot_potato/afterattack(atom/target, mob/user, adjacent, params)
if(!adjacent || !ismob(target))
return ..()
force_onto(target, user)
/obj/item/hot_potato/proc/force_onto(mob/living/victim, mob/user)
if(!istype(victim) || user != loc || victim == user)
return FALSE
if(!victim.client)
to_chat(user, "<span class='boldwarning'>[src] refuses to attach to a non-sapient creature!</span>")
if(victim.stat != CONSCIOUS || !victim.get_num_legs())
to_chat(user, "<span class='boldwarning'>[src] refuses to attach to someone incapable of using it!</span>")
user.temporarilyRemoveItemFromInventory(src, TRUE)
. = FALSE
if(!victim.put_in_hands(src))
if(forceful_attachment)
victim.dropItemToGround(victim.get_inactive_held_item())
if(!victim.put_in_hands(src))
victim.dropItemToGround(victim.get_active_held_item())
if(victim.put_in_hands(src))
. = TRUE
else
. = TRUE
else
. = TRUE
if(.)
add_logs(user, victim, "forced a hot potato with explosive variables ([detonate_explosion]-[detonate_dev_range]/[detonate_heavy_range]/[detonate_light_range]/[detonate_flash_range]/[detonate_fire_range]) onto")
user.visible_message("<span class='userdanger'>[user] forces [src] onto [victim]!</span>", "<span class='userdanger'>You force [src] onto [victim]!</span>", "<span class='boldwarning'>You hear a mechanical click and a beep.</span>")
user.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY)
else
add_logs(user, victim, "tried to force a hot potato with explosive variables ([detonate_explosion]-[detonate_dev_range]/[detonate_heavy_range]/[detonate_light_range]/[detonate_flash_range]/[detonate_fire_range]) onto")
user.visible_message("<span class='boldwarning'>[user] tried to force [src] onto [victim], but it could not attach!</span>", "<span class='boldwarning'>You try to force [src] onto [victim], but it is unable to attach!</span>", "<span class='boldwarning'>You hear a mechanical click and two buzzes.</span>")
user.put_in_hands(src)
/obj/item/hot_potato/dropped(mob/user)
. = ..()
user.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY)
/obj/item/hot_potato/proc/activate(delay, mob/user)
if(is_active())
return
update_icon()
if(sticky)
flags_1 |= NODROP_1
name = "primed [name]"
activation_time = timer + world.time
detonation_timerid = addtimer(CALLBACK(src, .proc/detonate), delay, TIMER_STOPPABLE)
START_PROCESSING(SSfastprocess, src)
var/turf/T = get_turf(src)
message_admins("[user? "[ADMIN_LOOKUPFLW(user)] has primed [src]" : "A [src] has been primed"] (Timer:[delay],Explosive:[detonate_explosion],Range:[detonate_dev_range]/[detonate_heavy_range]/[detonate_light_range]/[detonate_fire_range]) for detonation at [COORD(T)]([T.loc])")
log_game("[user? "[user] has primed [src]" : "A [src] has been primed"] ([detonate_dev_range]/[detonate_heavy_range]/[detonate_light_range]/[detonate_fire_range]) for detonation at [COORD(T)]([T.loc])")
/obj/item/hot_potato/proc/deactivate()
update_icon()
name = initial(name)
flags_1 &= ~NODROP_1
deltimer(detonation_timerid)
STOP_PROCESSING(SSfastprocess, src)
detonation_timerid = null
if(ismob(loc))
var/mob/user = loc
user.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY)
/obj/item/hot_potato/update_icon()
icon_state = is_active()? icon_on : icon_off
/obj/item/hot_potato/syndicate
detonate_light_range = 4
detonate_fire_range = 5
/obj/item/hot_potato/harmless
detonate_explosion = FALSE
/obj/item/hot_potato/harmless/toy
desc = "A label on the side of this potato reads \"Product of DonkCo Toys and Recreation department.\" <span class='boldnotice'>You can attack anyone with it to put it on them instead, if they have a free hand to take it!</span>"
sticky = FALSE
reusable = TRUE
forceful_attachment = FALSE
//CREATOR'S NOTE: DO NOT FUCKING GIVE THIS TO BOTANY!
/obj/item/hot_potato
name = "hot potato"
desc = "A label on the side of this potato reads \"Product of DonkCo Service Wing. Activate far away from populated areas. Device will only attach to sapient creatures.\" <span class='boldnotice'>You can attack anyone with it to force it on them instead of yourself!</span>"
icon = 'icons/obj/hydroponics/harvest.dmi'
icon_state = "potato"
flags_1 = NOBLUDGEON_1
force = 0
var/icon_off = "potato"
var/icon_on = "potato_active"
var/detonation_timerid
var/activation_time = 0
var/timer = 600 //deciseconds
var/show_timer = FALSE
var/reusable = FALSE //absolute madman
var/sticky = TRUE
var/forceful_attachment = TRUE
var/stimulant = TRUE
var/detonate_explosion = TRUE
var/detonate_dev_range = 0
var/detonate_heavy_range = 0
var/detonate_light_range = 2
var/detonate_flash_range = 5
var/detonate_fire_range = 5
var/color_val = FALSE
/obj/item/hot_potato/proc/detonate()
var/atom/location = loc
location.visible_message("<span class='userdanger'>[src] [detonate_explosion? "explodes" : "activates"]!</span>", "<span class='userdanger'>[src] activates! You've ran out of time!</span>")
if(detonate_explosion)
explosion(src, detonate_dev_range, detonate_heavy_range, detonate_light_range, detonate_flash_range, flame_range = detonate_fire_range)
deactivate()
if(!reusable)
var/mob/M = loc
if(istype(M))
M.dropItemToGround(src, TRUE)
qdel(src)
/obj/item/hot_potato/proc/is_active()
return isnull(detonation_timerid)? FALSE : TRUE
/obj/item/hot_potato/attack_self(mob/user)
if(activate(timer, user))
user.visible_message("<span class='boldwarning'>[user] squeezes [src], which promptly starts to flash red-hot colors!</span>", "<span class='boldwarning'>You squeeze [src], activating its countdown and attachment mechanism!</span>",
"<span class='boldwarning'>You hear a mechanical click and a loud beeping!</span>")
return
return ..()
/obj/item/hot_potato/process()
if(stimulant)
if(isliving(loc))
var/mob/living/L = loc
L.SetStun(0)
L.SetKnockdown(0)
L.SetSleeping(0)
L.SetUnconscious(0)
L.reagents.add_reagent("muscle_stimulant", CLAMP(5 - L.reagents.get_reagent_amount("muscle_stimulant"), 0, 5)) //If you don't have legs or get bola'd, tough luck!
color_val = !color_val
L.add_atom_colour(color_val? "#ffff00" : "#00ffff", FIXED_COLOUR_PRIORITY)
/obj/item/hot_potato/examine(mob/user)
. = ..()
if(is_active())
to_chat(user, "<span class='warning'>[src] is flashing red-hot! You should probably get rid of it!</span>")
if(show_timer)
to_chat(user, "<span class='warning'>[src]'s timer looks to be at [DisplayTimeText(activation_time - world.time)]!</span>")
/obj/item/hot_potato/equipped(mob/user)
. = ..()
if(is_active())
to_chat(user, "<span class='userdanger'>You have a really bad feeling about [src]!</span>")
/obj/item/hot_potato/afterattack(atom/target, mob/user, adjacent, params)
if(!adjacent || !ismob(target))
return ..()
force_onto(target, user)
/obj/item/hot_potato/proc/force_onto(mob/living/victim, mob/user)
if(!istype(victim) || user != loc || victim == user)
return FALSE
if(!victim.client)
to_chat(user, "<span class='boldwarning'>[src] refuses to attach to a non-sapient creature!</span>")
if(victim.stat != CONSCIOUS || !victim.get_num_legs())
to_chat(user, "<span class='boldwarning'>[src] refuses to attach to someone incapable of using it!</span>")
user.temporarilyRemoveItemFromInventory(src, TRUE)
. = FALSE
if(!victim.put_in_hands(src))
if(forceful_attachment)
victim.dropItemToGround(victim.get_inactive_held_item())
if(!victim.put_in_hands(src))
victim.dropItemToGround(victim.get_active_held_item())
if(victim.put_in_hands(src))
. = TRUE
else
. = TRUE
else
. = TRUE
if(.)
add_logs(user, victim, "forced a hot potato with explosive variables ([detonate_explosion]-[detonate_dev_range]/[detonate_heavy_range]/[detonate_light_range]/[detonate_flash_range]/[detonate_fire_range]) onto")
user.visible_message("<span class='userdanger'>[user] forces [src] onto [victim]!</span>", "<span class='userdanger'>You force [src] onto [victim]!</span>", "<span class='boldwarning'>You hear a mechanical click and a beep.</span>")
user.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY)
else
add_logs(user, victim, "tried to force a hot potato with explosive variables ([detonate_explosion]-[detonate_dev_range]/[detonate_heavy_range]/[detonate_light_range]/[detonate_flash_range]/[detonate_fire_range]) onto")
user.visible_message("<span class='boldwarning'>[user] tried to force [src] onto [victim], but it could not attach!</span>", "<span class='boldwarning'>You try to force [src] onto [victim], but it is unable to attach!</span>", "<span class='boldwarning'>You hear a mechanical click and two buzzes.</span>")
user.put_in_hands(src)
/obj/item/hot_potato/dropped(mob/user)
. = ..()
user.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY)
/obj/item/hot_potato/proc/activate(delay, mob/user)
if(is_active())
return
update_icon()
if(sticky)
flags_1 |= NODROP_1
name = "primed [name]"
activation_time = timer + world.time
detonation_timerid = addtimer(CALLBACK(src, .proc/detonate), delay, TIMER_STOPPABLE)
START_PROCESSING(SSfastprocess, src)
var/turf/T = get_turf(src)
message_admins("[user? "[ADMIN_LOOKUPFLW(user)] has primed [src]" : "A [src] has been primed"] (Timer:[delay],Explosive:[detonate_explosion],Range:[detonate_dev_range]/[detonate_heavy_range]/[detonate_light_range]/[detonate_fire_range]) for detonation at [COORD(T)]([T.loc])")
log_game("[user? "[user] has primed [src]" : "A [src] has been primed"] ([detonate_dev_range]/[detonate_heavy_range]/[detonate_light_range]/[detonate_fire_range]) for detonation at [COORD(T)]([T.loc])")
/obj/item/hot_potato/proc/deactivate()
update_icon()
name = initial(name)
flags_1 &= ~NODROP_1
deltimer(detonation_timerid)
STOP_PROCESSING(SSfastprocess, src)
detonation_timerid = null
if(ismob(loc))
var/mob/user = loc
user.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY)
/obj/item/hot_potato/update_icon()
icon_state = is_active()? icon_on : icon_off
/obj/item/hot_potato/syndicate
detonate_light_range = 4
detonate_fire_range = 5
/obj/item/hot_potato/harmless
detonate_explosion = FALSE
/obj/item/hot_potato/harmless/toy
desc = "A label on the side of this potato reads \"Product of DonkCo Toys and Recreation department.\" <span class='boldnotice'>You can attack anyone with it to put it on them instead, if they have a free hand to take it!</span>"
sticky = FALSE
reusable = TRUE
forceful_attachment = FALSE
+4 -3
View File
@@ -598,14 +598,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, "<b>The game start has been delayed.</b>")
log_admin("[key_name(usr)] delayed the round start.")
else
to_chat(world, "<b>The game will start in [newtime] seconds.</b>")
to_chat(world, "<b>The game will start in [DisplayTimeText(newtime)].</b>")
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)
@@ -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
@@ -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, "<span class='warning'>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]!</span>")
to_chat(invoker, "<span class='warning'>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]!</span>")
/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, "<span class='warning'>The Hierophant Network is under strain from repeated summoning, making this scripture [scaled_recital_time / 10] seconds slower!</span>")
to_chat(invoker, "<span class='warning'>The Hierophant Network is under strain from repeated summoning, making this scripture [DisplayTimeText(scaled_recital_time)] slower!</span>")
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)
qdel(CM)
+1 -1
View File
@@ -364,7 +364,7 @@
to_chat(B.current, "<span class='cultlarge'><b>[owner] has marked [C.cult_team.blood_target] in the [A.name] as the cult's top priority, get there immediately!</b></span>")
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,"<span class='cultbold'>You have marked the [target] for the cult! It will last for [base_cooldown/10] seconds.</span>")
to_chat(owner,"<span class='cultbold'>You have marked the [target] for the cult! It will last for [DisplayTimeText(base_cooldown)].</span>")
name = "Clear the Blood Mark"
desc = "Remove the Blood Mark you previously set."
button_icon_state = "emp"
+1 -1
View File
@@ -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, "<span class='warning'>Targeting transit location, please wait [designate_time/10] seconds...</span>")
to_chat(current_user, "<span class='warning'>Targeting transit location, please wait [DisplayTimeText(designate_time)]...</span>")
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