diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 28841e9c0e3..68e9978baa1 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -149,14 +149,6 @@ #define COMSIG_ATOM_ORBIT_BEGIN "atom_orbit_begin" ///called when an atom stops orbiting another atom: (atom) #define COMSIG_ATOM_ORBIT_STOP "atom_orbit_stop" -///////////////// -///from base of atom/attack_ghost(): (mob/dead/observer/ghost) -#define COMSIG_ATOM_ATTACK_GHOST "atom_attack_ghost" -///from base of atom/attack_hand(): (mob/user) -#define COMSIG_ATOM_ATTACK_HAND "atom_attack_hand" -///from base of atom/attack_paw(): (mob/user) -#define COMSIG_ATOM_ATTACK_PAW "atom_attack_paw" - #define COMPONENT_NO_ATTACK_HAND (1<<0) //works on all 3. ///from base of atom/set_opacity(): (new_opacity) #define COMSIG_ATOM_SET_OPACITY "atom_set_opacity" @@ -327,19 +319,9 @@ #define COMPONENT_BLOCK_MAGIC (1<<0) ///from base of mob/create_mob_hud(): () #define COMSIG_MOB_HUD_CREATED "mob_hud_created" -///from base of atom/attack_hand(): (mob/user) -#define COMSIG_MOB_ATTACK_HAND "mob_attack_hand" -///from base of /obj/item/attack(): (mob/M, mob/user) -#define COMSIG_MOB_ITEM_ATTACK "mob_item_attack" - #define COMPONENT_ITEM_NO_ATTACK (1<<0) + ///from base of /mob/living/proc/apply_damage(): (damage, damagetype, def_zone) #define COMSIG_MOB_APPLY_DAMGE "mob_apply_damage" -///from base of obj/item/afterattack(): (atom/target, mob/user, proximity_flag, click_parameters) -#define COMSIG_MOB_ITEM_AFTERATTACK "mob_item_afterattack" -///from base of obj/item/attack_qdeleted(): (atom/target, mob/user, proxiumity_flag, click_parameters) -#define COMSIG_MOB_ITEM_ATTACK_QDELETED "mob_item_attack_qdeleted" -///from base of mob/RangedAttack(): (atom/A, params) -#define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged" ///from base of /mob/throw_item(): (atom/target) #define COMSIG_MOB_THROW "mob_throw" ///from base of /mob/verb/examinate(): (atom/target) @@ -494,21 +476,6 @@ // /obj/item signals -///from base of obj/item/attack(): (/mob/living/target, /mob/living/user) -#define COMSIG_ITEM_ATTACK "item_attack" -///from base of obj/item/attack_self(): (/mob) -#define COMSIG_ITEM_ATTACK_SELF "item_attack_self" - #define COMPONENT_NO_INTERACT (1<<0) -///from base of obj/item/attack_obj(): (/obj, /mob) -#define COMSIG_ITEM_ATTACK_OBJ "item_attack_obj" - #define COMPONENT_NO_ATTACK_OBJ (1<<0) -///from base of obj/item/pre_attack(): (atom/target, mob/user, params) -#define COMSIG_ITEM_PRE_ATTACK "item_pre_attack" - #define COMPONENT_NO_ATTACK (1<<0) -///from base of obj/item/afterattack(): (atom/target, mob/user, params) -#define COMSIG_ITEM_AFTERATTACK "item_afterattack" -///from base of obj/item/attack_qdeleted(): (atom/target, mob/user, params) -#define COMSIG_ITEM_ATTACK_QDELETED "item_attack_qdeleted" ///from base of obj/item/equipped(): (/mob/equipper, slot) #define COMSIG_ITEM_EQUIPPED "item_equip" ///from base of obj/item/dropped(): (mob/user) @@ -649,12 +616,6 @@ // /mob/living/carbon/human signals -///from mob/living/carbon/human/UnarmedAttack(): (atom/target, proximity) -#define COMSIG_HUMAN_EARLY_UNARMED_ATTACK "human_early_unarmed_attack" -///from mob/living/carbon/human/UnarmedAttack(): (atom/target, proximity) -#define COMSIG_HUMAN_MELEE_UNARMED_ATTACK "human_melee_unarmed_attack" -///from mob/living/carbon/human/UnarmedAttack(): (mob/living/carbon/human/attacker) -#define COMSIG_HUMAN_MELEE_UNARMED_ATTACKBY "human_melee_unarmed_attackby" ///Hit by successful disarm attack (mob/living/carbon/human/attacker,zone_targeted) #define COMSIG_HUMAN_DISARM_HIT "human_disarm_hit" ///Whenever EquipRanked is called, called after job is set @@ -840,3 +801,38 @@ // /datum/component/container_item /// (atom/container, mob/user) - returns bool #define COMSIG_CONTAINER_TRY_ATTACH "container_try_attach" + +/* Attack signals. They should share the returned flags, to standardize the attack chain. */ + #define COMPONENT_CANCEL_ATTACK_CHAIN (1<<0) +///from base of atom/attack_ghost(): (mob/dead/observer/ghost) +#define COMSIG_ATOM_ATTACK_GHOST "atom_attack_ghost" +///from base of atom/attack_hand(): (mob/user) +#define COMSIG_ATOM_ATTACK_HAND "atom_attack_hand" +///from base of atom/attack_paw(): (mob/user) +#define COMSIG_ATOM_ATTACK_PAW "atom_attack_paw" +///from base of obj/item/attack(): (/mob/living/target, /mob/living/user) +#define COMSIG_ITEM_ATTACK "item_attack" +///from base of obj/item/attack_self(): (/mob) +#define COMSIG_ITEM_ATTACK_SELF "item_attack_self" +///from base of obj/item/attack_obj(): (/obj, /mob) +#define COMSIG_ITEM_ATTACK_OBJ "item_attack_obj" +///from base of obj/item/pre_attack(): (atom/target, mob/user, params) +#define COMSIG_ITEM_PRE_ATTACK "item_pre_attack" +///from base of obj/item/afterattack(): (atom/target, mob/user, params) +#define COMSIG_ITEM_AFTERATTACK "item_afterattack" +///from base of obj/item/attack_qdeleted(): (atom/target, mob/user, params) +#define COMSIG_ITEM_ATTACK_QDELETED "item_attack_qdeleted" +///from base of atom/attack_hand(): (mob/user) +#define COMSIG_MOB_ATTACK_HAND "mob_attack_hand" +///from base of /obj/item/attack(): (mob/M, mob/user) +#define COMSIG_MOB_ITEM_ATTACK "mob_item_attack" +///from base of obj/item/afterattack(): (atom/target, mob/user, proximity_flag, click_parameters) +#define COMSIG_MOB_ITEM_AFTERATTACK "mob_item_afterattack" +///from base of obj/item/attack_qdeleted(): (atom/target, mob/user, proxiumity_flag, click_parameters) +#define COMSIG_MOB_ITEM_ATTACK_QDELETED "mob_item_attack_qdeleted" +///from base of mob/RangedAttack(): (atom/A, params) +#define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged" +///from mob/living/carbon/human/UnarmedAttack(): (atom/target, proximity) +#define COMSIG_HUMAN_EARLY_UNARMED_ATTACK "human_early_unarmed_attack" +///from mob/living/carbon/human/UnarmedAttack(): (atom/target, proximity) +#define COMSIG_HUMAN_MELEE_UNARMED_ATTACK "human_melee_unarmed_attack" diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 9f252ad60f9..c7a26456c84 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -277,7 +277,8 @@ * animals lunging, etc. */ /mob/proc/RangedAttack(atom/A, params) - SEND_SIGNAL(src, COMSIG_MOB_ATTACK_RANGED, A, params) + if(SEND_SIGNAL(src, COMSIG_MOB_ATTACK_RANGED, A, params) & COMPONENT_CANCEL_ATTACK_CHAIN) + return TRUE /** diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 41167a0ccd7..c19a2afb280 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -21,7 +21,7 @@ /// Called when the item is in the active hand, and clicked; alternately, there is an 'activate held object' verb or you can hit pagedown. /obj/item/proc/attack_self(mob/user) - if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_SELF, user) & COMPONENT_NO_INTERACT) + if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_SELF, user) & COMPONENT_CANCEL_ATTACK_CHAIN) return SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK_SELF, src) //SKYRAT EDIT ADDITION - GUNPOINT interact(user) @@ -37,7 +37,7 @@ * See: [/obj/item/proc/melee_attack_chain] */ /obj/item/proc/pre_attack(atom/A, mob/living/user, params) //do stuff before attackby! - if(SEND_SIGNAL(src, COMSIG_ITEM_PRE_ATTACK, A, user, params) & COMPONENT_NO_ATTACK) + if(SEND_SIGNAL(src, COMSIG_ITEM_PRE_ATTACK, A, user, params) & COMPONENT_CANCEL_ATTACK_CHAIN) return TRUE return FALSE //return TRUE to avoid calling attackby after this proc does stuff @@ -73,21 +73,21 @@ * * mob/living/user - The mob hitting with this item */ /obj/item/proc/attack(mob/living/M, mob/living/user) - if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK, M, user) & COMPONENT_ITEM_NO_ATTACK) - return + if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK, M, user) & COMPONENT_CANCEL_ATTACK_CHAIN) + return TRUE SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, M, user) if(item_flags & NOBLUDGEON) return if(force && HAS_TRAIT(user, TRAIT_PACIFISM)) to_chat(user, "You don't want to harm other living beings!") - return + return TRUE if(item_flags & EYE_STAB && user.zone_selected == BODY_ZONE_PRECISE_EYES) if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) M = user if(eyestab(M,user)) - return + return TRUE if(!force) playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), TRUE, -1) else if(hitsound) @@ -104,11 +104,12 @@ log_combat(user, M, "attacked", src.name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])") add_fingerprint(user) + return TRUE /// The equivalent of the standard version of [/obj/item/proc/attack] but for object targets. /obj/item/proc/attack_obj(obj/O, mob/living/user) - if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_OBJ, O, user) & COMPONENT_NO_ATTACK_OBJ) + if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_OBJ, O, user) & COMPONENT_CANCEL_ATTACK_CHAIN) return if(item_flags & NOBLUDGEON) return diff --git a/code/_onclick/observer.dm b/code/_onclick/observer.dm index d5e0e63fb13..c01f75cb575 100644 --- a/code/_onclick/observer.dm +++ b/code/_onclick/observer.dm @@ -48,7 +48,7 @@ // Oh by the way this didn't work with old click code which is why clicking shit didn't spam you /atom/proc/attack_ghost(mob/dead/observer/user) - if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_GHOST, user) & COMPONENT_NO_ATTACK_HAND) + if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_GHOST, user) & COMPONENT_CANCEL_ATTACK_CHAIN) return TRUE if(user.client) if(user.gas_scan && atmosanalyzer_scan(user, src)) diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 35db4a23252..5be3c2f76d7 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -25,7 +25,7 @@ if(proximity && istype(G) && G.Touch(A,1)) return //This signal is needed to prevent gloves of the north star + hulk. - if(SEND_SIGNAL(src, COMSIG_HUMAN_EARLY_UNARMED_ATTACK, A, proximity) & COMPONENT_NO_ATTACK_HAND) + if(SEND_SIGNAL(src, COMSIG_HUMAN_EARLY_UNARMED_ATTACK, A, proximity) & COMPONENT_CANCEL_ATTACK_CHAIN) return SEND_SIGNAL(src, COMSIG_HUMAN_MELEE_UNARMED_ATTACK, A, proximity) A.attack_hand(src) @@ -35,7 +35,7 @@ . = FALSE if(!(interaction_flags_atom & INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND)) add_fingerprint(user) - if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_HAND, user) & COMPONENT_NO_ATTACK_HAND) + if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_HAND, user) & COMPONENT_CANCEL_ATTACK_CHAIN) . = TRUE if(interaction_flags_atom & INTERACT_ATOM_ATTACK_HAND) . = _try_interact(user) @@ -82,14 +82,16 @@ /mob/living/carbon/human/RangedAttack(atom/A, mouseparams) . = ..() + if(.) + return if(gloves) var/obj/item/clothing/gloves/G = gloves if(istype(G) && G.Touch(A,0)) // for magic gloves - return + return TRUE if(isturf(A) && get_dist(src,A) <= 1) - src.Move_Pulled(A) - return + Move_Pulled(A) + return TRUE /* Animals & All Unspecified @@ -135,7 +137,7 @@ /atom/proc/attack_paw(mob/user) - if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_PAW, user) & COMPONENT_NO_ATTACK_HAND) + if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_PAW, user) & COMPONENT_CANCEL_ATTACK_CHAIN) return TRUE return FALSE diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm index 56a010f14e6..2cb861ff34a 100644 --- a/code/_onclick/telekinesis.dm +++ b/code/_onclick/telekinesis.dm @@ -4,57 +4,74 @@ This needs more thinking out, but I might as well. */ -/* - Telekinetic attack: - - By default, emulate the user's unarmed attack -*/ - #define TK_MAXRANGE 15 + +/** + * Telekinesis attack act, happens when the TK user clicks on a non-adjacent target in range. + * + * * By default, emulates the user's unarmed attack. + * * Called indirectly by the `COMSIG_MOB_ATTACK_RANGED` signal. + * * Returns `COMPONENT_CANCEL_ATTACK_CHAIN` when it performs any action, to further acts on the attack chain. + */ /atom/proc/attack_tk(mob/user) if(user.stat || !tkMaxRangeCheck(user, src)) return new /obj/effect/temp_visual/telekinesis(get_turf(src)) - user.UnarmedAttack(src,0) // attack_hand, attack_paw, etc add_hiddenprint(user) - return + user.UnarmedAttack(src, FALSE) // attack_hand, attack_paw, etc + return COMPONENT_CANCEL_ATTACK_CHAIN + /obj/attack_tk(mob/user) if(user.stat) return if(anchored) return ..() - attack_tk_grab(user) + return attack_tk_grab(user) + /obj/item/attack_tk(mob/user) if(user.stat) return - attack_tk_grab(user) + return attack_tk_grab(user) + +/** + * Telekinesis object grab act. + * + * * Called by `/obj/attack_tk()`. + * * Returns `COMPONENT_CANCEL_ATTACK_CHAIN` when it performs any action, to further acts on the attack chain. + */ /obj/proc/attack_tk_grab(mob/user) var/obj/item/tk_grab/O = new(src) O.tk_user = user - if(O.focus_object(src)) - user.put_in_active_hand(O) - add_hiddenprint(user) + if(!O.focus_object(src)) + return + user.put_in_active_hand(O) + add_hiddenprint(user) + return COMPONENT_CANCEL_ATTACK_CHAIN + /mob/attack_tk(mob/user) return -/* - This is similar to item attack_self, but applies to anything - that you can grab with a telekinetic grab. - - It is used for manipulating things at range, for example, opening and closing closets. - There are not a lot of defaults at this time, add more where appropriate. -*/ +/** + * Telekinesis item attack_self act. + * + * * This is similar to item attack_self, but applies to anything that you can grab with a telekinetic grab. + * * It is used for manipulating things at range, for example, opening and closing closets.. + * * Defined at the `/atom` level but only used at the `/obj/item` one. + * * Returns `COMPONENT_CANCEL_ATTACK_CHAIN` when it performs any action, to further acts on the attack chain. + */ /atom/proc/attack_self_tk(mob/user) return + /obj/item/attack_self_tk(mob/user) - attack_self(user) + if(attack_self(user)) + return COMPONENT_CANCEL_ATTACK_CHAIN /* @@ -112,44 +129,53 @@ else return ..() + /obj/item/tk_grab/attack_self(mob/user) if(!focus) return - if(QDELETED(focus)) + if(QDELING(focus)) qdel(src) return - focus.attack_self_tk(user) + if(focus.attack_self_tk(user) & COMPONENT_CANCEL_ATTACK_CHAIN) + . = TRUE update_icon() + /obj/item/tk_grab/afterattack(atom/target, mob/living/carbon/user, proximity, params)//TODO: go over this . = ..() + if(.) + return + if(!target || !user) return if(!focus) focus_object(target) - return - else if(!check_if_focusable(focus)) + return TRUE + + if(!check_if_focusable(focus)) return if(target == focus) - target.attack_self_tk(user) + if(target.attack_self_tk(user) & COMPONENT_CANCEL_ATTACK_CHAIN) + . = TRUE update_icon() return - if(!isturf(target) && isitem(focus) && target.Adjacent(focus)) apply_focus_overlay() var/obj/item/I = focus - I.melee_attack_chain(tk_user, target, params) //isn't copying the attack chain fun. we should do it more often. + . = I.melee_attack_chain(tk_user, target, params) //isn't copying the attack chain fun. we should do it more often. if(check_if_focusable(focus)) focus.do_attack_animation(target, null, focus) else + . = TRUE apply_focus_overlay() focus.throw_at(target, 10, 1,user) user.changeNext_move(CLICK_CD_MELEE) update_icon() + /proc/tkMaxRangeCheck(mob/user, atom/target) var/d = get_dist(user, target) if(d > TK_MAXRANGE) diff --git a/code/datums/components/acid.dm b/code/datums/components/acid.dm index 341d51527df..36b5dc9236b 100644 --- a/code/datums/components/acid.dm +++ b/code/datums/components/acid.dm @@ -198,7 +198,8 @@ to_chat(user, "The acid on \the [parent_atom] burns your hand!") 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) diff --git a/code/datums/components/butchering.dm b/code/datums/components/butchering.dm index 4172ae52552..0d3c84ae0ce 100644 --- a/code/datums/components/butchering.dm +++ b/code/datums/components/butchering.dm @@ -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("[H]'s neck has already been already cut, you can't make the bleeding any worse!", MSG_VISUAL, \ "Their neck has already been already cut, you can't make the bleeding any worse!") - 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, "You begin to butcher [M]...") diff --git a/code/datums/components/food/edible.dm b/code/datums/components/food/edible.dm index be2352a17f5..da38c2431ee 100644 --- a/code/datums/components/food/edible.dm +++ b/code/datums/components/food/edible.dm @@ -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.") diff --git a/code/datums/components/storage/food_storage.dm b/code/datums/components/storage/food_storage.dm index a2a1e009143..4e8e695d064 100644 --- a/code/datums/components/storage/food_storage.dm +++ b/code/datums/components/storage/food_storage.dm @@ -71,7 +71,7 @@ "You start to insert the [inserted_item.name] into \the [parent].") 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 @@ "You start to rip into \the [parent].") 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. * diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 77093d15157..d034dcb98da 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -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, "[parent] seems to be locked!") 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, "[parent] seems to be locked!") else show_to(user) + /datum/component/storage/proc/signal_on_pickup(datum/source, mob/user) SIGNAL_HANDLER diff --git a/code/datums/components/surgery_initiator.dm b/code/datums/components/surgery_initiator.dm index e7c07bae450..4155e6959c0 100644 --- a/code/datums/components/surgery_initiator.dm +++ b/code/datums/components/surgery_initiator.dm @@ -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 diff --git a/code/datums/components/swabbing.dm b/code/datums/components/swabbing.dm index fbf8cf16071..71759689de9 100644 --- a/code/datums/components/swabbing.dm +++ b/code/datums/components/swabbing.dm @@ -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, "You cannot collect another sample on [parent]!") diff --git a/code/datums/components/uplink.dm b/code/datums/components/uplink.dm index 6c852382e19..fb9685492be 100644 --- a/code/datums/components/uplink.dm +++ b/code/datums/components/uplink.dm @@ -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 diff --git a/code/datums/mutations/hulk.dm b/code/datums/mutations/hulk.dm index c68d827ee69..7b75a34d2f4 100644 --- a/code/datums/mutations/hulk.dm +++ b/code/datums/mutations/hulk.dm @@ -41,7 +41,7 @@ source.do_attack_animation(target, ATTACK_EFFECT_SMASH) source.changeNext_move(CLICK_CD_MELEE) - return COMPONENT_NO_ATTACK_HAND + return COMPONENT_CANCEL_ATTACK_CHAIN /** diff --git a/code/datums/mutations/telekinesis.dm b/code/datums/mutations/telekinesis.dm index beee7f3537e..9a81e6fc7b2 100644 --- a/code/datums/mutations/telekinesis.dm +++ b/code/datums/mutations/telekinesis.dm @@ -29,7 +29,6 @@ return visual_indicators[type][1] ///Triggers on COMSIG_MOB_ATTACK_RANGED. Usually handles stuff like picking up items at range. -/datum/mutation/human/telekinesis/proc/on_ranged_attack(datum/source, atom/target) +/datum/mutation/human/telekinesis/proc/on_ranged_attack(mob/source, atom/target) SIGNAL_HANDLER - - INVOKE_ASYNC(target, /atom.proc/attack_tk, owner) + return target.attack_tk(source) diff --git a/code/datums/wounds/bones.dm b/code/datums/wounds/bones.dm index 58cda92cffe..a5d3e15454d 100644 --- a/code/datums/wounds/bones.dm +++ b/code/datums/wounds/bones.dm @@ -100,7 +100,8 @@ INVOKE_ASYNC(victim, /mob.proc/emote, "scream") victim.Stun(0.5 SECONDS) limb.receive_damage(brute=rand(3,7)) - return COMPONENT_NO_ATTACK_HAND + return COMPONENT_CANCEL_ATTACK_CHAIN + /datum/wound/blunt/receive_damage(wounding_type, wounding_dmg, wound_bonus) if(!victim || wounding_dmg < WOUND_MINIMUM_DAMAGE) diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index 746a7ddc373..a95bb001fe3 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -93,6 +93,7 @@ removecell() + /obj/machinery/cell_charger/attack_tk(mob/user) if(!charging) return @@ -101,6 +102,8 @@ to_chat(user, "You telekinetically remove [charging] from [src].") removecell() + return COMPONENT_CANCEL_ATTACK_CHAIN + /obj/machinery/cell_charger/attack_ai(mob/user) return diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 3293901299c..046e4f18726 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -177,10 +177,12 @@ return return try_to_activate_door(user) + /obj/machinery/door/attack_tk(mob/user) if(requiresID() && !allowed(null)) return - ..() + return ..() + /obj/machinery/door/proc/try_to_activate_door(mob/user) add_fingerprint(user) diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index 614cbefde6f..c044ffb97fb 100755 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -113,11 +113,15 @@ user.put_in_hands(charging) setCharging(null) + /obj/machinery/recharger/attack_tk(mob/user) - if(charging) - charging.update_icon() - charging.forceMove(drop_location()) - setCharging(null) + if(!charging) + return + charging.update_icon() + charging.forceMove(drop_location()) + setCharging(null) + return COMPONENT_CANCEL_ATTACK_CHAIN + /obj/machinery/recharger/process(delta_time) if(machine_stat & (NOPOWER|BROKEN) || !anchored) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 36a5f64e2c9..82d1586a3ce 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -192,9 +192,11 @@ GLOBAL_LIST_EMPTY(PDAs) return attack_self(M) return ..() + /obj/item/pda/attack_self_tk(mob/user) to_chat(user, "The PDA's capacitive touch screen doesn't seem to respond!") - return + return COMPONENT_CANCEL_ATTACK_CHAIN + /obj/item/pda/interact(mob/user) if(!user.IsAdvancedToolUser()) diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index 78864155969..56df3adcd6f 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -62,6 +62,8 @@ */ /obj/item/radio/intercom/attack_tk_grab(mob/user) interact(user) + return COMPONENT_CANCEL_ATTACK_CHAIN + /obj/item/radio/intercom/attack_ai(mob/user) interact(user) diff --git a/code/game/objects/items/theft_tools.dm b/code/game/objects/items/theft_tools.dm index 65361f79a1f..e9428885c06 100644 --- a/code/game/objects/items/theft_tools.dm +++ b/code/game/objects/items/theft_tools.dm @@ -124,8 +124,10 @@ inhand_icon_state = "supermattersliver" pulseicon = "supermatter_sliver_pulse" -/obj/item/nuke_core/supermatter_sliver/attack_tk() // no TK dusting memes - return FALSE + +/obj/item/nuke_core/supermatter_sliver/attack_tk(mob/user) // no TK dusting memes + return + /obj/item/nuke_core/supermatter_sliver/can_be_pulled(user) // no drag memes return FALSE diff --git a/code/game/objects/items/toy_mechs.dm b/code/game/objects/items/toy_mechs.dm index cfd537349dd..78c47279423 100644 --- a/code/game/objects/items/toy_mechs.dm +++ b/code/game/objects/items/toy_mechs.dm @@ -193,6 +193,8 @@ timer = world.time + cooldown if(!quiet) playsound(user, 'sound/mecha/mechstep.ogg', 20, TRUE) + return COMPONENT_CANCEL_ATTACK_CHAIN + /** * Resets the request for battle. diff --git a/code/game/objects/structures/beds_chairs/chair.dm b/code/game/objects/structures/beds_chairs/chair.dm index fddb5d5ebd6..b4fe9a9e81f 100644 --- a/code/game/objects/structures/beds_chairs/chair.dm +++ b/code/game/objects/structures/beds_chairs/chair.dm @@ -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() diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index 5915e17ee2b..04fa215aef6 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -393,8 +393,9 @@ LINEN BINS to_chat(user, "[hidden] falls out of [B]!") 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 diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 4f0fa2217f3..60697c4baef 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -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) diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm index 2a8b89dfcbd..196bdc72fc1 100644 --- a/code/game/objects/structures/extinguisher.dm +++ b/code/game/objects/structures/extinguisher.dm @@ -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, "You telekinetically remove [stored_extinguisher] from [src].") 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) diff --git a/code/game/objects/structures/fireaxe.dm b/code/game/objects/structures/fireaxe.dm index bc393ccbef1..dbe6be222f2 100644 --- a/code/game/objects/structures/fireaxe.dm +++ b/code/game/objects/structures/fireaxe.dm @@ -131,14 +131,15 @@ toggle_lock(user) return + /obj/structure/fireaxecabinet/attack_tk(mob/user) + . = COMPONENT_CANCEL_ATTACK_CHAIN if(locked) to_chat(user, "The [name] won't budge!") return - else - open = !open - update_icon() - return + open = !open + update_icon() + /obj/structure/fireaxecabinet/update_overlays() . = ..() diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index fd4e5e02c7a..af9f7c15fc7 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -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) . = ..() diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index d66f3b97c45..eb1e3158c4a 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -130,11 +130,14 @@ return FALSE return TRUE + /obj/structure/window/attack_tk(mob/user) user.changeNext_move(CLICK_CD_MELEE) user.visible_message("Something knocks on [src].") 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)) diff --git a/code/modules/antagonists/eldritch_cult/eldritch_effects.dm b/code/modules/antagonists/eldritch_cult/eldritch_effects.dm index be2c05ed7c5..343423f9db8 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_effects.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_effects.dm @@ -223,26 +223,29 @@ else to_chat(human_user,"You pull your hand away from the hole as the eldritch energy flails trying to catch onto the existance itself!") + /obj/effect/broken_illusion/attack_tk(mob/user) if(!ishuman(user)) return + . = COMPONENT_CANCEL_ATTACK_CHAIN var/mob/living/carbon/human/human_user = user if(IS_HERETIC(human_user)) to_chat(human_user,"You know better than to tempt forces out of your control!") + return + //a very elaborate way to suicide + to_chat(human_user,"Eldritch energy lashes out, piercing your fragile mind, tearing it to pieces!") + human_user.ghostize() + var/obj/item/bodypart/head/head = locate() in human_user.bodyparts + if(head) + head.dismember() + qdel(head) else - //a very elaborate way to suicide - to_chat(human_user,"Eldritch energy lashes out, piercing your fragile mind, tearing it to pieces!") - human_user.ghostize() - var/obj/item/bodypart/head/head = locate() in human_user.bodyparts - if(head) - head.dismember() - qdel(head) - else - human_user.gib() + human_user.gib() + + var/datum/effect_system/reagents_explosion/explosion = new() + explosion.set_up(1, get_turf(human_user), TRUE, 0) + explosion.start() - var/datum/effect_system/reagents_explosion/explosion = new() - explosion.set_up(1, get_turf(human_user), 1, 0) - explosion.start() /obj/effect/broken_illusion/examine(mob/user) . = ..() diff --git a/code/modules/antagonists/wizard/equipment/artefact.dm b/code/modules/antagonists/wizard/equipment/artefact.dm index c940cfc54f2..020fa6b59eb 100644 --- a/code/modules/antagonists/wizard/equipment/artefact.dm +++ b/code/modules/antagonists/wizard/equipment/artefact.dm @@ -119,17 +119,21 @@ eat() return + /obj/singularity/wizard/attack_tk(mob/user) - if(iscarbon(user)) - var/mob/living/carbon/C = user - var/datum/component/mood/insaneinthemembrane = C.GetComponent(/datum/component/mood) - if(insaneinthemembrane.sanity < 15) - return //they've already seen it and are about to die, or are just too insane to care - to_chat(C, "OH GOD! NONE OF IT IS REAL! NONE OF IT IS REEEEEEEEEEEEEEEEEEEEEEEEAL!") - insaneinthemembrane.sanity = 0 - for(var/lore in typesof(/datum/brain_trauma/severe)) - C.gain_trauma(lore) - addtimer(CALLBACK(src, /obj/singularity/wizard.proc/deranged, C), 100) + if(!iscarbon(user)) + return + . = COMPONENT_CANCEL_ATTACK_CHAIN + var/mob/living/carbon/jedi = user + var/datum/component/mood/insaneinthemembrane = jedi.GetComponent(/datum/component/mood) + if(insaneinthemembrane.sanity < 15) + return //they've already seen it and are about to die, or are just too insane to care + to_chat(jedi, "OH GOD! NONE OF IT IS REAL! NONE OF IT IS REEEEEEEEEEEEEEEEEEEEEEEEAL!") + insaneinthemembrane.sanity = 0 + for(var/lore in typesof(/datum/brain_trauma/severe)) + jedi.gain_trauma(lore) + addtimer(CALLBACK(src, /obj/singularity/wizard.proc/deranged, jedi), 10 SECONDS) + /obj/singularity/wizard/proc/deranged(mob/living/carbon/C) if(!C || C.stat == DEAD) diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index c858357f3dd..344184b6c84 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -685,10 +685,10 @@ UnregisterSignal(user, COMSIG_MOVABLE_BUMP) /obj/item/clothing/gloves/gauntlets/proc/rocksmash(mob/living/carbon/human/H, atom/A, proximity) - if(!istype(A, /turf/closed/mineral)) - return - A.attackby(src, H) - return COMPONENT_NO_ATTACK_HAND + if(!istype(A, /turf/closed/mineral)) + return + A.attackby(src, H) + return COMPONENT_CANCEL_ATTACK_CHAIN ///Bosses diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm index 5068397f9cd..c9f0796f7c9 100644 --- a/code/modules/mob/living/silicon/silicon_defense.dm +++ b/code/modules/mob/living/silicon/silicon_defense.dm @@ -62,7 +62,7 @@ //ATTACK HAND IGNORING PARENT RETURN VALUE /mob/living/silicon/attack_hand(mob/living/carbon/human/M) . = FALSE - if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_HAND, M) & COMPONENT_NO_ATTACK_HAND) + if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_HAND, M) & COMPONENT_CANCEL_ATTACK_CHAIN) . = TRUE switch(M.a_intent) if ("help") diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 8c74539e102..669c788b161 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -504,12 +504,12 @@ A.attack_animal(src) return 1 + /mob/living/simple_animal/hostile/RangedAttack(atom/A, params) //Player firing if(ranged && ranged_cooldown <= world.time) target = A OpenFire(A) - ..() - + return ..() ////// AI Status /////// diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index a9552b369d3..3ce52a269ab 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -79,13 +79,15 @@ dat += "" user << browse("