Files
Bubberstation/code/modules/power/singularity/boh_tear.dm
SkyratBot 6ecaa9a994 [MIRROR] Standardizes attack chain signal returns and fixes a tk bug (#1409)
* Standardizes attack chain signal returns and fixes a tk bug (#54475)

The attack chain is a bit of a mess, and the introduction of signals hasn't helped in simplifying it.

In order to take a step into untangling this, I re-ordered the attack signals to no longer be by source type and instead to be grouped more modularly, as they are all members of the attack chain and function similarly. They all share the trait of potentially ending the attack chain via a return, but had several different names for it. I joined it into one.

Additionally, fixed a tk bug reported by @ Timberpoes by adding a signal return check at the base of /mob/proc/RangedAttack

Lastly, removed the async call of /datum/mutation/human/telekinesis/proc/on_ranged_attack, which was added as a lazy patch to appease the linter complaining about a sleep on a signal handler (namely in /obj/singularity/attack_tk). Fixed the problem using timers.

Also cleaned some code here and there.

* Standardizes attack chain signal returns and fixes a tk bug

Co-authored-by: Rohesie <rohesie@gmail.com>
2020-10-21 07:39:32 +02:00

52 lines
1.7 KiB
Plaintext

/// BoH tear
/// The BoH tear is a stationary singularity with a really high gravitational pull, which collapses briefly after being created
/// The BoH isn't deleted for 10 minutes (only moved to nullspace) so that admins may retrieve the things back in case of a grief
/obj/singularity/boh_tear
name = "tear in the fabric of reality"
desc = "Your own comprehension of reality starts bending as you stare this."
icon = 'icons/effects/96x96.dmi'
icon_state = "boh_tear"
pixel_x = -32
pixel_y = -32
dissipate = 0
move_self = 0
consume_range = 1
grav_pull = 25
current_size = STAGE_SIX
allowed_size = STAGE_SIX
var/ghosts = list()
var/old_loc
var/start_time = 0
/obj/singularity/boh_tear/Initialize()
. = ..()
old_loc = loc
start_time = world.time
QDEL_IN(src, 5 SECONDS) // vanishes after 5 seconds
/obj/singularity/boh_tear/process()
//Backup to catch timerss errors
if(start_time + (10 SECONDS) < world.time)
stack_trace("The timer subsytem isn't firing properly, yell at your local coders posthaste")
qdel(src)
eat()
/obj/singularity/boh_tear/consume(atom/A)
A.singularity_act(current_size, src)
/obj/singularity/boh_tear/admin_investigate_setup()
var/turf/T = get_turf(src)
message_admins("A BoH tear has been created at [ADMIN_VERBOSEJMP(T)].")
investigate_log("was created at [AREACOORD(T)].", INVESTIGATE_SINGULO)
/obj/singularity/boh_tear/attack_tk(mob/user)
if(!isliving(user))
return
var/mob/living/jedi = user
to_chat(jedi, "<span class='userdanger'>You don't feel like you are real anymore.</span>")
jedi.dust_animation()
jedi.spawn_dust()
addtimer(CALLBACK(src, .proc/consume, jedi), 0.5 SECONDS)
return COMPONENT_CANCEL_ATTACK_CHAIN