mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-12 08:36:00 +01:00
a46e8282c9
* Voidwalker Balancing, Fixes and Additions * Update declarations.dm --------- Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com>
22 lines
607 B
Plaintext
22 lines
607 B
Plaintext
/// Stops a mob from hitting someone in crit. doesn't account for projectiles or spells
|
|
/datum/element/no_crit_hitting
|
|
|
|
/datum/element/no_crit_hitting/Attach(datum/target)
|
|
. = ..()
|
|
|
|
if(!isliving(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
RegisterSignals(target, list(COMSIG_MOB_ITEM_ATTACK), PROC_REF(check_attack))
|
|
|
|
/datum/element/no_crit_hitting/proc/check_attack(mob/living/attacker, atom/attacked)
|
|
SIGNAL_HANDLER
|
|
|
|
if(!isliving(attacked))
|
|
return
|
|
|
|
var/mob/living/liver = attacked
|
|
if(liver.stat == HARD_CRIT)
|
|
liver.balloon_alert(attacker, "they're in crit!")
|
|
return COMPONENT_CANCEL_ATTACK_CHAIN
|