Merge pull request #16040 from SandPoot/better-countdown-effect
Makes countdown objects follow their targets better
This commit is contained in:
@@ -9,6 +9,8 @@
|
|||||||
anchored = TRUE
|
anchored = TRUE
|
||||||
layer = GHOST_LAYER
|
layer = GHOST_LAYER
|
||||||
color = "#ff0000" // text color
|
color = "#ff0000" // text color
|
||||||
|
appearance_flags = NO_CLIENT_COLOR | RESET_ALPHA | RESET_COLOR | RESET_TRANSFORM
|
||||||
|
vis_flags = VIS_INHERIT_ID
|
||||||
var/text_size = 3 // larger values clip when the displayed text is larger than 2 digits.
|
var/text_size = 3 // larger values clip when the displayed text is larger than 2 digits.
|
||||||
var/started = FALSE
|
var/started = FALSE
|
||||||
var/displayed_text
|
var/displayed_text
|
||||||
@@ -17,6 +19,10 @@
|
|||||||
/obj/effect/countdown/Initialize(mapload)
|
/obj/effect/countdown/Initialize(mapload)
|
||||||
. = ..()
|
. = ..()
|
||||||
attach(loc)
|
attach(loc)
|
||||||
|
RegisterSignal(loc, COMSIG_PARENT_QDELETING, .proc/on_parent_deleting)
|
||||||
|
|
||||||
|
/obj/effect/countdown/proc/on_parent_deleting(atom/being_deleted, force)
|
||||||
|
qdel(src)
|
||||||
|
|
||||||
/obj/effect/countdown/examine(mob/user)
|
/obj/effect/countdown/examine(mob/user)
|
||||||
. = ..()
|
. = ..()
|
||||||
@@ -24,7 +30,12 @@
|
|||||||
|
|
||||||
/obj/effect/countdown/proc/attach(atom/A)
|
/obj/effect/countdown/proc/attach(atom/A)
|
||||||
attached_to = A
|
attached_to = A
|
||||||
forceMove(get_turf(A))
|
if(ismovable(A))
|
||||||
|
var/atom/movable/M = A
|
||||||
|
moveToNullspace()
|
||||||
|
M.vis_contents |= src
|
||||||
|
else
|
||||||
|
forceMove(get_turf(A))
|
||||||
|
|
||||||
/obj/effect/countdown/proc/start()
|
/obj/effect/countdown/proc/start()
|
||||||
if(!started)
|
if(!started)
|
||||||
@@ -44,7 +55,8 @@
|
|||||||
/obj/effect/countdown/process()
|
/obj/effect/countdown/process()
|
||||||
if(!attached_to || QDELETED(attached_to))
|
if(!attached_to || QDELETED(attached_to))
|
||||||
qdel(src)
|
qdel(src)
|
||||||
forceMove(get_turf(attached_to))
|
if(!ismovable(attached_to))
|
||||||
|
forceMove(get_turf(attached_to))
|
||||||
var/new_val = get_value()
|
var/new_val = get_value()
|
||||||
if(new_val == displayed_text)
|
if(new_val == displayed_text)
|
||||||
return
|
return
|
||||||
@@ -56,8 +68,9 @@
|
|||||||
maptext = null
|
maptext = null
|
||||||
|
|
||||||
/obj/effect/countdown/Destroy()
|
/obj/effect/countdown/Destroy()
|
||||||
attached_to = null
|
|
||||||
STOP_PROCESSING(SSfastprocess, src)
|
STOP_PROCESSING(SSfastprocess, src)
|
||||||
|
UnregisterSignal(attached_to, COMSIG_PARENT_QDELETING)
|
||||||
|
attached_to = null
|
||||||
. = ..()
|
. = ..()
|
||||||
|
|
||||||
/obj/effect/countdown/ex_act(severity, target, origin) //immune to explosions
|
/obj/effect/countdown/ex_act(severity, target, origin) //immune to explosions
|
||||||
|
|||||||
Reference in New Issue
Block a user