Skip to content

Commit

Permalink
[MIRROR] Afterattack is dead, long live Afterattack [MDB IGNORE] (#2986)
Browse files Browse the repository at this point in the history
* Afterattack is dead, long live Afterattack

* Modular updates pt 1

* Fixes blood magic applying wounds when casted  (#73170)

Fixes cult blood magic applying wounds to the users hand when casted

* afterattack is dead, aughhhh

* this is totally unrelated but whatever

* reset a couple diffs

---------

Co-authored-by: MrMelbert <[email protected]>
Co-authored-by: Mal <[email protected]>
Co-authored-by: SuperSlayer <[email protected]>
Co-authored-by: Fluffles <[email protected]>
  • Loading branch information
5 people authored and StealsThePRs committed Jun 16, 2024
1 parent 5d42af9 commit 217c68d
Show file tree
Hide file tree
Showing 285 changed files with 3,823 additions and 3,921 deletions.
13 changes: 11 additions & 2 deletions code/__DEFINES/cleaning.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@

// Cleaning flags

///Whether we should not attempt to clean.
#define DO_NOT_CLEAN "do_not_clean"
/// Return to prevent clean attempts
#define CLEAN_BLOCKED (1<<0)
/// Return to allow clean attempts
/// This is (currently) the same as returning null / none but more explicit
#define CLEAN_ALLOWED (1<<1)
/// Return to prevent XP gain
/// Only does anything if [CLEAN_ALLOWED] is also returned
#define CLEAN_NO_XP (1<<2)
/// Return to stop cleaner component from blocking interaction chain further
/// Only does anything if [CLEAN_BLOCKED] is also returned
#define CLEAN_DONT_BLOCK_INTERACTION (1<<3)

// Different kinds of things that can be cleaned.
// Use these when overriding the wash proc or registering for the clean signals to check if your thing should be cleaned
Expand Down
7 changes: 0 additions & 7 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,6 @@ GLOBAL_LIST_INIT(leg_zones, list(BODY_ZONE_R_LEG, BODY_ZONE_L_LEG))
/// Proceed with the attack chain, but don't call the normal methods.
#define SECONDARY_ATTACK_CONTINUE_CHAIN 3

/// Flag for when /afterattack potentially acts on an item.
/// Used for the swap hands/drop tutorials to know when you might just be trying to do something normally.
/// Does not necessarily imply success, or even that it did hit an item, just intent.
// This is intentionally not (1 << 0) because some stuff currently erroneously returns TRUE/FALSE for afterattack.
// Doesn't need to be set if proximity flag is FALSE.
#define AFTERATTACK_PROCESSED_ITEM (1 << 1)

//Autofire component
/// Compatible firemode is in the gun. Wait until it's held in the user hands.
#define AUTOFIRE_STAT_IDLE (1<<0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define COMSIG_ATOM_ATTACKBY "atom_attackby"
/// From base of [atom/proc/attacby_secondary()]: (/obj/item/weapon, /mob/user, params)
#define COMSIG_ATOM_ATTACKBY_SECONDARY "atom_attackby_secondary"
///from [/item/afterattack()], sent by an atom which was just attacked by an item: (/obj/item/weapon, /mob/user, proximity_flag, click_parameters)
/// From [/item/attack()], sent by an atom which was just attacked by an item: (/obj/item/weapon, /mob/user, proximity_flag, click_parameters)
#define COMSIG_ATOM_AFTER_ATTACKEDBY "atom_after_attackby"
/// From base of [/atom/proc/attack_hand_secondary]: (mob/user, list/modifiers) - Called when the atom receives a secondary unarmed attack.
#define COMSIG_ATOM_ATTACK_HAND_SECONDARY "atom_attack_hand_secondary"
Expand Down
21 changes: 21 additions & 0 deletions code/__DEFINES/dcs/signals/signals_atom/signals_atom_x_act.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
/// Args: (mob/living/user, obj/item/tool, list/modifiers)
/// Return any ITEM_INTERACT_ flags as relevant (see tools.dm)
#define COMSIG_ATOM_ITEM_INTERACTION_SECONDARY "atom_item_interaction_secondary"
/// Sent from [atom/proc/item_interaction], to a mob clicking on an atom with an item
#define COMSIG_USER_ITEM_INTERACTION "user_item_interaction"
/// Sent from [atom/proc/item_interaction], to an item clicking on an atom
/// Args: (mob/living/user, atom/interacting_with, list/modifiers)
/// Return any ITEM_INTERACT_ flags as relevant (see tools.dm)
Expand All @@ -64,6 +66,8 @@
/// Args: (mob/living/user, atom/interacting_with, list/modifiers)
/// Return any ITEM_INTERACT_ flags as relevant (see tools.dm)
#define COMSIG_ITEM_INTERACTING_WITH_ATOM_SECONDARY "item_interacting_with_atom_secondary"
/// Sent from [atom/proc/item_interaction], when this atom is right-clicked on by a mob with a tool
#define COMSIG_USER_ITEM_INTERACTION_SECONDARY "user_item_interaction_secondary"
/// Sent from [atom/proc/item_interaction], when this atom is left-clicked on by a mob with a tool of a specific tool type
/// Args: (mob/living/user, obj/item/tool, list/recipes)
/// Return any ITEM_INTERACT_ flags as relevant (see tools.dm)
Expand All @@ -72,3 +76,20 @@
/// Args: (mob/living/user, obj/item/tool)
/// Return any ITEM_INTERACT_ flags as relevant (see tools.dm)
#define COMSIG_ATOM_SECONDARY_TOOL_ACT(tooltype) "tool_secondary_act_[tooltype]"

/// Sent from [atom/proc/ranged_item_interaction], when this atom is left-clicked on by a mob with an item while not adjacent
#define COMSIG_ATOM_RANGED_ITEM_INTERACTION "atom_ranged_item_interaction"
/// Sent from [atom/proc/ranged_item_interaction], when this atom is right-clicked on by a mob with an item while not adjacent
#define COMSIG_ATOM_RANGED_ITEM_INTERACTION_SECONDARY "atom_ranged_item_interaction_secondary"
/// Sent from [atom/proc/ranged_item_interaction], when a mob is using this item while left-clicking on by an atom while not adjacent
#define COMSIG_RANGED_ITEM_INTERACTING_WITH_ATOM "ranged_item_interacting_with_atom"
/// Sent from [atom/proc/ranged_item_interaction], when a mob is using this item while right-clicking on by an atom while not adjacent
#define COMSIG_RANGED_ITEM_INTERACTING_WITH_ATOM_SECONDARY "ranged_item_interacting_with_atom_secondary"

/// Sent from [atom/proc/item_interaction], when this atom is used as a tool and an event occurs
#define COMSIG_ITEM_TOOL_ACTED "tool_item_acted"

/// This is sent via item interaction (IE, item clicking on atom) right before the item's inserted into the atom's storage
/// Args: (obj/item/inserting, mob/living/user)
#define COMSIG_ATOM_STORAGE_ITEM_INTERACT_INSERT "atom_storage_item_interact_insert"
#define BLOCK_STORAGE_INSERT (1<<0)
8 changes: 4 additions & 4 deletions code/__DEFINES/dcs/signals/signals_heretic.dm
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/// Heretic signals

/// From /obj/item/melee/touch_attack/mansus_fist/on_mob_hit : (mob/living/source, mob/living/target)
/// From /datum/action/cooldown/spell/touch/mansus_grasp/cast_on_hand_hit : (mob/living/source, mob/living/target)
#define COMSIG_HERETIC_MANSUS_GRASP_ATTACK "mansus_grasp_attack"
/// Default behavior is to use the hand, so return this to blocks the mansus fist from being consumed after use.
#define COMPONENT_BLOCK_HAND_USE (1<<0)
/// From /obj/item/melee/touch_attack/mansus_fist/afterattack_secondary : (mob/living/source, atom/target)
/// From /datum/action/cooldown/spell/touch/mansus_grasp/cast_on_secondary_hand_hit : (mob/living/source, atom/target)
#define COMSIG_HERETIC_MANSUS_GRASP_ATTACK_SECONDARY "mansus_grasp_attack_secondary"
/// Default behavior is to continue attack chain and do nothing else, so return this to use up the hand after use.
#define COMPONENT_USE_HAND (1<<0)

/// From /obj/item/melee/sickly_blade/afterattack (with proximity) : (mob/living/source, mob/living/target)
/// From /obj/item/melee/sickly_blade/afterattack : (mob/living/source, mob/living/target)
#define COMSIG_HERETIC_BLADE_ATTACK "blade_attack"
/// From /obj/item/melee/sickly_blade/afterattack (without proximity) : (mob/living/source, mob/living/target)
/// From /obj/item/melee/sickly_blade/ranged_interact_with_atom (without proximity) : (mob/living/source, mob/living/target)
#define COMSIG_HERETIC_RANGED_BLADE_ATTACK "ranged_blade_attack"
6 changes: 4 additions & 2 deletions code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
#define COMSIG_LIVING_SET_BUCKLED "living_set_buckled"
///from base of mob/living/set_body_position()
#define COMSIG_LIVING_SET_BODY_POSITION "living_set_body_position"
/// Sent to a mob being injected with a syringe when the do_after initiates
#define COMSIG_LIVING_TRY_SYRINGE_INJECT "living_try_syringe_inject"
/// Sent to a mob being withdrawn from with a syringe when the do_after initiates
#define COMSIG_LIVING_TRY_SYRINGE_WITHDRAW "living_try_syringe_withdraw"
///from base of mob/living/set_usable_legs()
#define COMSIG_LIVING_LIMBLESS_SLOWDOWN "living_limbless_slowdown"
///From post-can inject check of syringe after attack (mob/user)
#define COMSIG_LIVING_TRY_SYRINGE "living_try_syringe"
///From living/Life(). (deltatime, times_fired)
#define COMSIG_LIVING_LIFE "living_life"
/// Block the Life() proc from proceeding... this should really only be done in some really wacky situations.
Expand Down
4 changes: 0 additions & 4 deletions code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,6 @@
#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, obj/item/weapon, proximity_flag, click_parameters)
#define COMSIG_MOB_ITEM_AFTERATTACK "mob_item_afterattack"
///from base of obj/item/afterattack_secondary(): (atom/target, obj/item/weapon, proximity_flag, click_parameters)
#define COMSIG_MOB_ITEM_AFTERATTACK_SECONDARY "mob_item_afterattack_secondary"
///from base of mob/RangedAttack(): (atom/A, modifiers)
#define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged"
///from base of mob/ranged_secondary_attack(): (atom/target, modifiers)
Expand Down
19 changes: 4 additions & 15 deletions code/__DEFINES/dcs/signals/signals_object.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define COMSIG_OBJ_DEFAULT_UNFASTEN_WRENCH "obj_default_unfasten_wrench"
///from base of /turf/proc/levelupdate(). (intact) true to hide and false to unhide
#define COMSIG_OBJ_HIDE "obj_hide"
/// from /obj/item/toy/crayon/spraycan/afterattack: (user, spraycan, color_is_dark)
/// from /obj/item/toy/crayon/spraycan/use_on: (user, spraycan, color_is_dark)
#define COMSIG_OBJ_PAINTED "obj_painted"
#define DONT_USE_SPRAYCAN_CHARGES (1<<0)
/// from /obj/obj_reskin: (mob/user, skin)
Expand Down Expand Up @@ -161,9 +161,6 @@
/// Return to prevent the default behavior (attack_selfing) from ocurring.
#define COMPONENT_ITEM_ACTION_SLOT_INVALID (1<<0)

/// Sent from /obj/item/attack_atom(): (atom/attacked_atom, mob/living/user)
#define COMSIG_ITEM_POST_ATTACK_ATOM "item_post_attack_atom"

///from base of mob/living/carbon/attacked_by(): (mob/living/carbon/target, mob/living/user, hit_zone)
#define COMSIG_ITEM_ATTACK_ZONE "item_attack_zone"
///from base of obj/item/hit_reaction(): (owner, hitby, attack_text, final_block_chance, damage, attack_type, damage_type)
Expand Down Expand Up @@ -208,7 +205,7 @@
#define COMSIG_STACK_CAN_MERGE "stack_can_merge"
#define CANCEL_STACK_MERGE (1<<0)

///from /obj/item/book/bible/afterattack(): (mob/user, proximity)
///from /obj/item/book/bible/interact_with_atom(): (mob/user)
#define COMSIG_BIBLE_SMACKED "bible_smacked"
///stops the bible chain from continuing. When all of the effects of the bible smacking have been moved to a signal we can kill this
#define COMSIG_END_BIBLE_CHAIN (1<<0)
Expand Down Expand Up @@ -450,8 +447,6 @@

///from base of /obj/item/attack(): (mob/living, mob/living, params)
#define COMSIG_ITEM_ATTACK "item_attack"
///from base of /obj/item/attack(): (mob/living, mob/living, params)
#define COMSIG_ITEM_POST_ATTACK "item_post_attack" // called only if the attack was executed
///from base of obj/item/attack_self(): (/mob)
#define COMSIG_ITEM_ATTACK_SELF "item_attack_self"
//from base of obj/item/attack_self_secondary(): (/mob)
Expand All @@ -467,14 +462,8 @@
#define COMPONENT_SECONDARY_CALL_NORMAL_ATTACK_CHAIN (1<<2)
/// From base of [/obj/item/proc/attack_secondary()]: (atom/target, mob/user, params)
#define COMSIG_ITEM_ATTACK_SECONDARY "item_attack_secondary"
///from base of obj/item/afterattack(): (atom/target, mob/user, proximity_flag, click_parameters)
///from base of [obj/item/attack()]: (atom/target, mob/user, proximity_flag, click_parameters)
#define COMSIG_ITEM_AFTERATTACK "item_afterattack"
/// Flag for when /afterattack potentially acts on an item.
/// Used for the swap hands/drop tutorials to know when you might just be trying to do something normally.
/// Does not necessarily imply success, or even that it did hit an item, just intent.
#define COMPONENT_AFTERATTACK_PROCESSED_ITEM (1<<0)
///from base of obj/item/afterattack_secondary(): (atom/target, mob/user, proximity_flag, click_parameters)
#define COMSIG_ITEM_AFTERATTACK_SECONDARY "item_afterattack_secondary"
///from base of obj/item/embedded(): (atom/target, obj/item/bodypart/part)
#define COMSIG_ITEM_EMBEDDED "item_embedded"
///from base of datum/component/embedded/safeRemove(): (mob/living/carbon/victim)
Expand All @@ -495,7 +484,7 @@
///from base of /obj/item/mmi/set_brainmob(): (mob/living/brain/new_brainmob)
#define COMSIG_MMI_SET_BRAINMOB "mmi_set_brainmob"

/// from base of /obj/item/slimepotion/speed/afterattack(): (obj/target, /obj/src, mob/user)
/// from base of /obj/item/slimepotion/speed/interact_with_atom(): (obj/target, /obj/src, mob/user)
#define COMSIG_SPEED_POTION_APPLIED "speed_potion"
#define SPEED_POTION_STOP (1<<0)

Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
/// Return to prevent the rest of the attack chain from being executed / preventing the item user from thwacking the target.
/// Similar to [ITEM_INTERACT_SUCCESS], but does not necessarily indicate success.
#define ITEM_INTERACT_BLOCKING (1<<1)
/// Only for people who get confused by the naming scheme
#define ITEM_INTERACT_FAILURE ITEM_INTERACT_BLOCKING
/// Return to skip the rest of the interaction chain, going straight to attack.
#define ITEM_INTERACT_SKIP_TO_ATTACK (1<<2)

Expand Down
11 changes: 11 additions & 0 deletions code/__HELPERS/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -325,3 +325,14 @@ rough example of the "cone" made by the 3 dirs checked
"x" = icon_width > world.icon_size && pixel_x != 0 ? (icon_width - world.icon_size) * 0.5 : 0,
"y" = icon_height > world.icon_size && pixel_y != 0 ? (icon_height - world.icon_size) * 0.5 : 0,
)

/**
* Called before an item is put into this atom's storage datum via the item clicking on this atom
*
* This can be used to add item-atom interactions that you want handled before inserting something into storage
* (But it's also fairly snowflakey)
*
* Returning FALSE will block that item from being put into our storage
*/
/atom/proc/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user)
return TRUE
13 changes: 3 additions & 10 deletions code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@

/**
* Standard mob ClickOn()
* Handles exceptions: Buildmode, middle click, modified clicks, mech actions
*
* After that, mostly just check your state, check whether you're holding an item,
* check whether you're adjacent to the target, then pass off the click to whoever
* is receiving it.
* check whether you're adjacent to the target, then pass off the click to whoever is receiving it.
*
* The most common are:
* * [mob/proc/UnarmedAttack] (atom,adjacent) - used here only when adjacent, with no item in hand; in the case of humans, checks gloves
* * [atom/proc/attackby] (item,user) - used only when adjacent
Expand Down Expand Up @@ -167,13 +166,7 @@
UnarmedAttack(A, TRUE, modifiers)
else
if(W)
if(LAZYACCESS(modifiers, RIGHT_CLICK))
var/after_attack_secondary_result = W.afterattack_secondary(A, src, FALSE, params)

if(after_attack_secondary_result == SECONDARY_ATTACK_CALL_NORMAL)
W.afterattack(A, src, FALSE, params)
else
W.afterattack(A, src, FALSE, params)
A.base_ranged_item_interaction(src, W, modifiers)
else
if(LAZYACCESS(modifiers, RIGHT_CLICK))
ranged_secondary_attack(A, modifiers)
Expand Down
8 changes: 1 addition & 7 deletions code/_onclick/cyborg.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,7 @@
W.melee_attack_chain(src, A, params)
return
else if(isturf(A) || isturf(A.loc))
if(LAZYACCESS(modifiers, RIGHT_CLICK))
var/after_attack_secondary_result = W.afterattack_secondary(A, src, FALSE, params)

if(after_attack_secondary_result == SECONDARY_ATTACK_CALL_NORMAL)
W.afterattack(A, src, FALSE, params)
else
W.afterattack(A, src, FALSE, params)
A.base_ranged_item_interaction(src, W, modifiers)

//Give cyborgs hotkey clicks without breaking existing uses of hotkey clicks
// for non-doors/apcs
Expand Down
Loading

0 comments on commit 217c68d

Please sign in to comment.