diff --git a/code/game/gamemodes/gang/dominator.dm b/code/game/gamemodes/gang/dominator.dm index d53fe91186a..5ad7dd3dc58 100644 --- a/code/game/gamemodes/gang/dominator.dm +++ b/code/game/gamemodes/gang/dominator.dm @@ -12,6 +12,7 @@ var/operating = 0 //0=standby or broken, 1=takeover var/warned = 0 //if this device has set off the warning at <3 minutes yet var/datum/effect_system/spark_spread/spark_system + var/obj/effect/countdown/dominator/countdown /obj/machinery/dominator/tesla_act() qdel(src) @@ -22,6 +23,7 @@ poi_list |= src spark_system = new spark_system.set_up(5, 1, src) + countdown = new(src) /obj/machinery/dominator/examine(mob/user) ..() @@ -121,6 +123,9 @@ poi_list.Remove(src) gang = null qdel(spark_system) + qdel(countdown) + countdown = null + SSmachine.processing -= src return ..() /obj/machinery/dominator/emp_act(severity) @@ -189,6 +194,10 @@ src.name = "[gang.name] Gang [src.name]" operating = 1 icon_state = "dominator-[gang.color]" + + countdown.text_color = gang.color_hex + countdown.start() + SetLuminosity(3) SSmachine.processing += src diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm index 0284f09bcf8..b3d73e7feea 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -210,6 +210,7 @@ var/bomb_set /obj/machinery/nuclearbomb/process() if (timing > 0) + countdown.start() bomb_set = 1 //So long as there is one nuke timing, it means one nuke is armed. timeleft-- if (timeleft <= 0) @@ -220,7 +221,8 @@ var/bomb_set for(var/mob/M in viewers(1, src)) if ((M.client && M.machine == src)) attack_hand(M) - return + else + countdown.stop() /obj/machinery/nuclearbomb/attack_paw(mob/user) return attack_hand(user) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 472922740a7..a7574d2028f 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -31,11 +31,15 @@ var/radio_key = /obj/item/device/encryptionkey/headset_med var/radio_channel = "Medical" + var/obj/effect/countdown/clonepod/countdown + /obj/machinery/clonepod/New() ..() var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/clonepod(null) B.apply_default_parts(src) + countdown = new(src) + radio = new(src) radio.keyslot = new radio_key radio.subspace_transmission = 1 @@ -44,6 +48,9 @@ /obj/machinery/clonepod/Destroy() qdel(radio) + radio = null + qdel(countdown) + countdown = null . = ..() /obj/machinery/clonepod/RefreshParts() @@ -114,12 +121,14 @@ if (isnull(occupant) || !is_operational()) return if ((!isnull(occupant)) && (occupant.stat != DEAD)) - var/completion = (100 * ((occupant.health + 100) / (heal_level + 100))) - user << "Current clone cycle is [round(completion)]% complete." + user << "Current clone cycle is [round(get_completion())]% complete." else if(mess) user << "It's filled with blood and vicerea. You swear you can see \ it moving..." +/obj/machinery/clonepod/proc/get_completion() + . = (100 * ((occupant.health + 100) / (heal_level + 100))) + /obj/machinery/clonepod/attack_ai(mob/user) return examine(user) @@ -145,6 +154,7 @@ attempting = TRUE //One at a time!! locked = TRUE + countdown.start() eject_wait = TRUE spawn(30) @@ -301,6 +311,7 @@ /obj/machinery/clonepod/proc/go_out() if (locked) return + countdown.stop() if (mess) //Clean that mess and dump those gibs! mess = 0 @@ -322,7 +333,7 @@ var/turf/T = get_turf(src) occupant.forceMove(T) icon_state = "pod_0" - eject_wait = 0 //If it's still set somehow. + eject_wait = FALSE //If it's still set somehow. occupant.domutcheck() //Waiting until they're out before possible monkeyizing. occupant = null diff --git a/code/modules/countdown/countdown.dm b/code/modules/countdown/countdown.dm index ddd70e4d833..886e8874403 100644 --- a/code/modules/countdown/countdown.dm +++ b/code/modules/countdown/countdown.dm @@ -5,10 +5,11 @@ And maybe we'll come back\n\ To earth, who can tell?" - var/last_displayed + var/displayed_text var/atom/attached_to var/text_color = "#ff0000" - var/text_size = 5 + var/text_size = 4 + var/started = FALSE invisibility = INVISIBILITY_OBSERVER layer = GHOST_LAYER @@ -19,7 +20,17 @@ /obj/effect/countdown/proc/attach(atom/A) attached_to = A loc = get_turf(A) - SSfastprocess.processing |= src + +/obj/effect/countdown/proc/start() + if(!started) + SSfastprocess.processing |= src + started = TRUE + +/obj/effect/countdown/proc/stop() + if(started) + overlays.Cut() + SSfastprocess.processing -= src + started = FALSE /obj/effect/countdown/proc/get_value() // Get the value from our atom @@ -29,13 +40,14 @@ if(!attached_to || qdeleted(attached_to)) qdel(src) var/new_val = get_value() - if(new_val == last_displayed) + if(new_val == displayed_text) return - last_displayed = new_val - if(new_val) + displayed_text = new_val + + if(displayed_text) var/image/text_image = new(loc = src) //text_image.maptext = "[new_val]" - text_image.maptext = "[new_val]" + text_image.maptext = "[displayed_text]" text_image.color = text_color overlays.Cut() @@ -68,3 +80,28 @@ return else if(N.timing) return N.timeleft + +/obj/effect/countdown/clonepod + name = "cloning pod countdown" + text_color = "#0C479D" + text_size = 2 + +/obj/effect/countdown/clonepod/get_value() + var/obj/machinery/clonepod/C = attached_to + if(!istype(C)) + return + if(C.occupant) + var/completion = round(C.get_completion()) + return completion + +/obj/effect/countdown/dominator + name = "dominator countdown" + text_size = 2 + text_color = "#ff00ff" // Overwritten when the dominator starts + +/obj/effect/countdown/clonepod/get_value() + var/obj/machinery/dominator/D = attached_to + if(!istype(D)) + return + if(D.gang && D.gang.dom_timer) + return D.gang.dom_timer