[MIRROR] Mob attackedby / check_block refactor, plus some minor cleanup of attack_x procs [MDB IGNORE] (#25079)

* Mob `attackedby` / `check_block` refactor, plus some minor cleanup of `attack_x` procs

* Fix the race condition

* Modular

* Ooops

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Giz <13398309+vinylspiders@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-11-18 02:19:31 -05:00
committed by GitHub
co-authored by MrMelbert Giz
parent b58ac45ef6
commit b237afa316
46 changed files with 585 additions and 586 deletions
+3 -3
View File
@@ -120,13 +120,13 @@
/obj/item/mod/module/energy_shield/on_suit_activation()
mod.AddComponent(/datum/component/shielded, max_charges = max_charges, recharge_start_delay = recharge_start_delay, charge_increment_delay = charge_increment_delay, \
charge_recovery = charge_recovery, lose_multiple_charges = lose_multiple_charges, recharge_path = recharge_path, starting_charges = charges, shield_icon_file = shield_icon_file, shield_icon = shield_icon)
RegisterSignal(mod.wearer, COMSIG_HUMAN_CHECK_SHIELDS, PROC_REF(shield_reaction))
RegisterSignal(mod.wearer, COMSIG_LIVING_CHECK_BLOCK, PROC_REF(shield_reaction))
/obj/item/mod/module/energy_shield/on_suit_deactivation(deleting = FALSE)
var/datum/component/shielded/shield = mod.GetComponent(/datum/component/shielded)
charges = shield.current_charges
qdel(shield)
UnregisterSignal(mod.wearer, COMSIG_HUMAN_CHECK_SHIELDS)
UnregisterSignal(mod.wearer, COMSIG_LIVING_CHECK_BLOCK)
/obj/item/mod/module/energy_shield/proc/shield_reaction(mob/living/carbon/human/owner,
atom/movable/hitby,
@@ -140,7 +140,7 @@
if(SEND_SIGNAL(mod, COMSIG_ITEM_HIT_REACT, owner, hitby, attack_text, 0, damage, attack_type, damage_type) & COMPONENT_HIT_REACTION_BLOCK)
drain_power(use_power_cost)
return SHIELD_BLOCK
return SUCCESSFUL_BLOCK
return NONE
/obj/item/mod/module/energy_shield/wizard
+3 -3
View File
@@ -67,10 +67,10 @@
overlay_state_use = "module_pepper_used"
/obj/item/mod/module/pepper_shoulders/on_suit_activation()
RegisterSignal(mod.wearer, COMSIG_HUMAN_CHECK_SHIELDS, PROC_REF(on_check_shields))
RegisterSignal(mod.wearer, COMSIG_LIVING_CHECK_BLOCK, PROC_REF(on_check_block))
/obj/item/mod/module/pepper_shoulders/on_suit_deactivation(deleting = FALSE)
UnregisterSignal(mod.wearer, COMSIG_HUMAN_CHECK_SHIELDS)
UnregisterSignal(mod.wearer, COMSIG_LIVING_CHECK_BLOCK)
/obj/item/mod/module/pepper_shoulders/on_use()
. = ..()
@@ -84,7 +84,7 @@
smoke.start(log = TRUE)
QDEL_NULL(capsaicin_holder) // Reagents have a ref to their holder which has a ref to them. No leaks please.
/obj/item/mod/module/pepper_shoulders/proc/on_check_shields()
/obj/item/mod/module/pepper_shoulders/proc/on_check_block()
SIGNAL_HANDLER
if(!COOLDOWN_FINISHED(src, cooldown_timer))