[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>
This commit is contained in:
SkyratBot
2020-10-21 07:39:32 +02:00
committed by GitHub
co-authored by Rohesie
parent fcad7bb4c2
commit 6ecaa9a994
45 changed files with 327 additions and 198 deletions
@@ -89,11 +89,13 @@
else
return ..()
/obj/structure/chair/attack_tk(mob/user)
if(!anchored || has_buckled_mobs() || !isturf(user.loc))
..()
else
setDir(turn(dir,-90))
return ..()
setDir(turn(dir,-90))
return COMPONENT_CANCEL_ATTACK_CHAIN
/obj/structure/chair/proc/handle_rotation(direction)
handle_layer()
+3 -2
View File
@@ -393,8 +393,9 @@ LINEN BINS
to_chat(user, "<span class='notice'>[hidden] falls out of [B]!</span>")
hidden = null
add_fingerprint(user)
/obj/structure/bedsheetbin/attack_tk(mob/user)
if(amount >= 1)
amount--
@@ -415,5 +416,5 @@ LINEN BINS
hidden.forceMove(drop_location())
hidden = null
add_fingerprint(user)
return COMPONENT_CANCEL_ATTACK_CHAIN
@@ -374,7 +374,8 @@
// tk grab then use on self
/obj/structure/closet/attack_self_tk(mob/user)
return attack_hand(user)
if(attack_hand(user))
return COMPONENT_CANCEL_ATTACK_CHAIN
/obj/structure/closet/verb/verb_toggleopen()
set src in view(1)
+4 -3
View File
@@ -93,15 +93,16 @@
/obj/structure/extinguisher_cabinet/attack_tk(mob/user)
. = COMPONENT_CANCEL_ATTACK_CHAIN
if(stored_extinguisher)
stored_extinguisher.forceMove(loc)
to_chat(user, "<span class='notice'>You telekinetically remove [stored_extinguisher] from [src].</span>")
stored_extinguisher = null
opened = 1
opened = TRUE
playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3)
update_icon()
else
toggle_cabinet(user)
return
toggle_cabinet(user)
/obj/structure/extinguisher_cabinet/attack_paw(mob/user)
+5 -4
View File
@@ -131,14 +131,15 @@
toggle_lock(user)
return
/obj/structure/fireaxecabinet/attack_tk(mob/user)
. = COMPONENT_CANCEL_ATTACK_CHAIN
if(locked)
to_chat(user, "<span class='warning'>The [name] won't budge!</span>")
return
else
open = !open
update_icon()
return
open = !open
update_icon()
/obj/structure/fireaxecabinet/update_overlays()
. = ..()
+4 -2
View File
@@ -88,8 +88,10 @@
user.stop_pulling()
return ..()
/obj/structure/table/attack_tk()
return FALSE
/obj/structure/table/attack_tk(mob/user)
return
/obj/structure/table/CanAllowThrough(atom/movable/mover, turf/target)
. = ..()
+3
View File
@@ -130,11 +130,14 @@
return FALSE
return TRUE
/obj/structure/window/attack_tk(mob/user)
user.changeNext_move(CLICK_CD_MELEE)
user.visible_message("<span class='notice'>Something knocks on [src].</span>")
add_fingerprint(user)
playsound(src, knocksound, 50, TRUE)
return COMPONENT_CANCEL_ATTACK_CHAIN
/obj/structure/window/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0)
if(!can_be_reached(user))