mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
[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:
@@ -198,7 +198,8 @@
|
||||
to_chat(user, "<span class='warning'>The acid on \the [parent_atom] burns your hand!</span>")
|
||||
playsound(parent_atom, 'sound/weapons/sear.ogg', 50, TRUE)
|
||||
user.update_damage_overlays()
|
||||
return COMPONENT_NO_ATTACK_HAND
|
||||
return COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
|
||||
|
||||
/// Handles searing the feet of whoever walks over this without protection. Only active if the parent is a turf.
|
||||
/datum/component/acid/proc/on_crossed(atom/parent_atom, mob/living/crosser)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
if(M.stat == DEAD && (M.butcher_results || M.guaranteed_butcher_results)) //can we butcher it?
|
||||
if(butchering_enabled && (can_be_blunt || source.get_sharpness()))
|
||||
INVOKE_ASYNC(src, .proc/startButcher, source, M, user)
|
||||
return COMPONENT_ITEM_NO_ATTACK
|
||||
return COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
|
||||
if(ishuman(M) && source.force && source.get_sharpness())
|
||||
var/mob/living/carbon/human/H = M
|
||||
@@ -38,9 +38,9 @@
|
||||
if(H.has_status_effect(/datum/status_effect/neck_slice))
|
||||
user.show_message("<span class='warning'>[H]'s neck has already been already cut, you can't make the bleeding any worse!</span>", MSG_VISUAL, \
|
||||
"<span class='warning'>Their neck has already been already cut, you can't make the bleeding any worse!</span>")
|
||||
return COMPONENT_ITEM_NO_ATTACK
|
||||
return COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
INVOKE_ASYNC(src, .proc/startNeckSlice, source, H, user)
|
||||
return COMPONENT_ITEM_NO_ATTACK
|
||||
return COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
|
||||
/datum/component/butchering/proc/startButcher(obj/item/source, mob/living/M, mob/living/user)
|
||||
to_chat(user, "<span class='notice'>You begin to butcher [M]...</span>")
|
||||
|
||||
@@ -276,7 +276,7 @@ Behavior that's still missing from this component that original food items had t
|
||||
return
|
||||
var/fullness = eater.get_fullness() + 10 //The theoretical fullness of the person eating if they were to eat this
|
||||
|
||||
. = COMPONENT_ITEM_NO_ATTACK //Point of no return I suppose
|
||||
. = COMPONENT_CANCEL_ATTACK_CHAIN //Point of no return I suppose
|
||||
|
||||
if(eater == feeder)//If you're eating it yourself.
|
||||
if(!do_mob(feeder, eater, eat_time)) //Gotta pass the minimal eat time
|
||||
@@ -416,7 +416,7 @@ Behavior that's still missing from this component that original food items had t
|
||||
if(bitecount == 0 || prob(50))
|
||||
L.manual_emote("nibbles away at \the [parent].")
|
||||
bitecount++
|
||||
. = COMPONENT_ITEM_NO_ATTACK
|
||||
. = COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
L.taste(owner.reagents) // why should carbons get all the fun?
|
||||
if(bitecount >= 5)
|
||||
var/satisfaction_text = pick("burps from enjoyment.", "yaps for more!", "woofs twice.", "looks at the area where \the [parent] was.")
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
"<span class='notice'>You start to insert the [inserted_item.name] into \the [parent].</span>")
|
||||
|
||||
INVOKE_ASYNC(src, .proc/insert_item, inserted_item, user)
|
||||
return COMPONENT_ITEM_NO_ATTACK
|
||||
return COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
|
||||
/** Begins the process of attempting to remove the stored item.
|
||||
*
|
||||
@@ -93,7 +93,7 @@
|
||||
"<span class='notice'>You start to rip into \the [parent].</span>")
|
||||
|
||||
INVOKE_ASYNC(src, .proc/begin_remove_item, user)
|
||||
return COMPONENT_ITEM_NO_ATTACK
|
||||
return COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
|
||||
/** Inserts the item into the food, after a do_after.
|
||||
*
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
|
||||
if(!isitem(O) || !click_gather || SEND_SIGNAL(O, COMSIG_CONTAINS_STORAGE))
|
||||
return FALSE
|
||||
. = COMPONENT_NO_ATTACK
|
||||
. = COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
if(locked)
|
||||
to_chat(M, "<span class='warning'>[parent] seems to be locked!</span>")
|
||||
return FALSE
|
||||
@@ -771,6 +771,7 @@
|
||||
return TRUE
|
||||
return TRUE
|
||||
|
||||
|
||||
/datum/component/storage/proc/on_attack_hand(datum/source, mob/user)
|
||||
SIGNAL_HANDLER_DOES_SLEEP
|
||||
|
||||
@@ -780,7 +781,7 @@
|
||||
if(user.active_storage == src && A.loc == user) //if you're already looking inside the storage item
|
||||
user.active_storage.close(user)
|
||||
close(user)
|
||||
. = COMPONENT_NO_ATTACK_HAND
|
||||
. = COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
return
|
||||
|
||||
if(rustle_sound)
|
||||
@@ -789,23 +790,24 @@
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.l_store == A && !H.get_active_held_item()) //Prevents opening if it's in a pocket.
|
||||
. = COMPONENT_NO_ATTACK_HAND
|
||||
. = COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
H.put_in_hands(A)
|
||||
H.l_store = null
|
||||
return
|
||||
if(H.r_store == A && !H.get_active_held_item())
|
||||
. = COMPONENT_NO_ATTACK_HAND
|
||||
. = COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
H.put_in_hands(A)
|
||||
H.r_store = null
|
||||
return
|
||||
|
||||
if(A.loc == user)
|
||||
. = COMPONENT_NO_ATTACK_HAND
|
||||
. = COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
if(locked)
|
||||
to_chat(user, "<span class='warning'>[parent] seems to be locked!</span>")
|
||||
else
|
||||
show_to(user)
|
||||
|
||||
|
||||
/datum/component/storage/proc/signal_on_pickup(datum/source, mob/user)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
var/mob/living/carbon/carbontarget
|
||||
var/obj/item/bodypart/affecting
|
||||
var/selected_zone = user.zone_selected
|
||||
. = COMPONENT_ITEM_NO_ATTACK
|
||||
. = COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
|
||||
if(iscarbon(livingtarget))
|
||||
carbontarget = livingtarget
|
||||
|
||||
@@ -84,12 +84,12 @@ This component is used in vat growing to swab for microbiological samples which
|
||||
var/obj/item/I = parent
|
||||
I.update_icon()
|
||||
|
||||
return COMPONENT_NO_ATTACK
|
||||
return COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
if(!can_swab(target))
|
||||
return NONE //Just do the normal attack.
|
||||
|
||||
|
||||
. = COMPONENT_NO_ATTACK //Point of no return. No more attacking after this.
|
||||
. = COMPONENT_CANCEL_ATTACK_CHAIN //Point of no return. No more attacking after this.
|
||||
|
||||
if(LAZYLEN(swabbed_items))
|
||||
to_chat(user, "<span class='warning'>You cannot collect another sample on [parent]!</span>")
|
||||
|
||||
@@ -122,7 +122,8 @@
|
||||
if(user)
|
||||
ui_interact(user)
|
||||
// an unlocked uplink blocks also opening the PDA or headset menu
|
||||
return COMPONENT_NO_INTERACT
|
||||
return COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
|
||||
|
||||
/datum/component/uplink/ui_state(mob/user)
|
||||
return GLOB.inventory_state
|
||||
|
||||
Reference in New Issue
Block a user