Files
Letter NandGitHub d50ea14baa effect cleanup (#7502)
yeah, also updates emissive blockers
2026-01-27 12:44:16 -05:00

108 lines
2.5 KiB
Plaintext

/obj/effect/countdown
name = "countdown"
desc = "We're leaving together\n\
But still it's farewell\n\
And maybe we'll come back\n\
To Earth, who can tell?"
invisibility = INVISIBILITY_OBSERVER
anchored = TRUE
plane = OBSERVER_PLANE
color = "#ff0000" // text color
var/text_size = 3 // larger values clip when the displayed text is larger than 2 digits.
var/started = FALSE
var/displayed_text
var/atom/attached_to
/obj/effect/countdown/Initialize(mapload)
. = ..()
attach(loc)
/obj/effect/countdown/examine(mob/user)
. = ..()
. += "This countdown is displaying: [displayed_text]."
/obj/effect/countdown/proc/attach(atom/A)
attached_to = A
var/turf/loc_turf = get_turf(A)
if(!loc_turf)
RegisterSignal(attached_to, COMSIG_MOVABLE_MOVED, PROC_REF(retry_attach), TRUE)
else
forceMove(loc_turf)
/obj/effect/countdown/proc/retry_attach()
SIGNAL_HANDLER
var/turf/loc_turf = get_turf(attached_to)
if(!loc_turf)
return
forceMove(loc_turf)
UnregisterSignal(attached_to, COMSIG_MOVABLE_MOVED)
/obj/effect/countdown/proc/start()
if(!started)
START_PROCESSING(SSprocess_5fps, src)
started = TRUE
/obj/effect/countdown/proc/stop()
if(started)
maptext = null
STOP_PROCESSING(SSprocess_5fps, src)
started = FALSE
/obj/effect/countdown/proc/get_value()
// Get the value from our atom
return
/obj/effect/countdown/process()
if(!attached_to || QDELETED(attached_to))
qdel(src)
forceMove(get_turf(attached_to))
var/new_val = get_value()
if(new_val == displayed_text)
return
displayed_text = new_val
if(displayed_text)
maptext = MAPTEXT("[displayed_text]")
else
maptext = null
/obj/effect/countdown/Destroy()
attached_to = null
STOP_PROCESSING(SSprocess_5fps, src)
. = ..()
/obj/effect/countdown/singularity_pull(atom/singularity, current_size)
return
/obj/effect/countdown/singularity_act()
return
/obj/effect/countdown/nuclearbomb
name = "nuclear bomb countdown"
color = "#81FF14"
// /obj/effect/countdown/nuclearbomb/get_value()
// var/obj/machinery/nuclearbomb/N = attached_to
// if(!istype(N))
// return
// else if(N.timing)
// return round(N.get_time_left(), 1)
/obj/effect/countdown/supermatter
name = "supermatter damage"
color = "#00ff80"
pixel_y = 8
/obj/effect/countdown/supermatter/attach(atom/A)
. = ..()
if(istype(A, /obj/machinery/power/supermatter))
pixel_y = -12
/obj/effect/countdown/supermatter/get_value()
var/obj/machinery/power/supermatter/S = attached_to
if(!istype(S))
return
return "<div align='center' valign='bottom' style='position:relative; top:0px; left:0px'>[round(S.get_integrity())]%</div>"