mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-11 16:14:08 +01:00
11d82b7995
People can now pet held mothroaches and pugs if they want to, or use items on them, hopefully without causing many issues. After all, it only took about a couple dozen lines of code to make... ...Oh, did the 527 files changed or the 850~ lines added/removed perhaps catch your eye? Made you wonder if I accidentally pushed the wrong branch? or skewed something up big time? Well, nuh uh. I just happen to be fed up with the melee attack chain still using stringized params instead of an array/list. It was frankly revolting to see how I'd have had to otherwise call `list2params` for what I'm trying to accomplish here, and make this PR another tessera to the immense stupidity of our attack chain procs calling `params2list` over and over and over instead of just using that one call instance from `ClickOn` as an argument. It's 2025, honey, wake up! I also tried to replace some of those single letter vars/args but there are just way too many of them. Improving old code. And I want to be able to pet mobroaches while holding them too. 🆑 qol: You can now interact with held mobs in more ways beside wearing them. /🆑
67 lines
2.5 KiB
Plaintext
67 lines
2.5 KiB
Plaintext
/// An element which enables certain items to tap people on their knees to measure brain health
|
|
/datum/element/kneejerk
|
|
|
|
/datum/element/kneejerk/Attach(datum/target)
|
|
. = ..()
|
|
|
|
if (!isitem(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
RegisterSignal(target, COMSIG_ITEM_ATTACK, PROC_REF(on_item_attack))
|
|
|
|
/datum/element/kneejerk/Detach(datum/source, ...)
|
|
. = ..()
|
|
|
|
UnregisterSignal(source, COMSIG_ITEM_ATTACK)
|
|
|
|
/datum/element/kneejerk/proc/on_item_attack(datum/source, mob/living/target, mob/living/user, list/modifiers)
|
|
SIGNAL_HANDLER
|
|
|
|
if((user.zone_selected == BODY_ZONE_L_LEG || user.zone_selected == BODY_ZONE_R_LEG) && LAZYACCESS(modifiers, RIGHT_CLICK) && target.buckled)
|
|
tap_knee(source, target, user)
|
|
|
|
return COMPONENT_SKIP_ATTACK
|
|
|
|
/datum/element/kneejerk/proc/tap_knee(obj/item/item, mob/living/target, mob/living/user)
|
|
var/selected_zone = user.zone_selected
|
|
var/obj/item/bodypart/leg/right = target.get_bodypart(BODY_ZONE_R_LEG)
|
|
var/obj/item/bodypart/leg/left = target.get_bodypart(BODY_ZONE_L_LEG)
|
|
var/obj/item/organ/brain/target_brain = target.get_organ_slot(ORGAN_SLOT_BRAIN)
|
|
|
|
if(!ishuman(target))
|
|
return
|
|
|
|
if((selected_zone == BODY_ZONE_R_LEG) && !right)
|
|
return
|
|
if((selected_zone == BODY_ZONE_L_LEG) && !left)
|
|
return
|
|
|
|
user.do_attack_animation(target)
|
|
target.visible_message(span_warning("[user] gently taps [target]'s knee with [item]."), \
|
|
span_userdanger("[user] taps your knee with [item]."))
|
|
|
|
if(target.stat == DEAD) //dead men have no reflexes!
|
|
return
|
|
|
|
if(!target_brain)
|
|
return
|
|
|
|
var/target_brain_damage = target_brain.damage
|
|
|
|
if(target_brain_damage < BRAIN_DAMAGE_MILD) //a healthy brain produces a normal reaction
|
|
playsound(target, 'sound/items/weapons/punchmiss.ogg', 25, TRUE, -1)
|
|
target.visible_message(span_danger("[target]'s leg kicks out sharply!"), \
|
|
span_danger("Your leg kicks out sharply!"))
|
|
|
|
else if(target_brain_damage < BRAIN_DAMAGE_SEVERE) //a mildly damaged brain produces a delayed reaction
|
|
playsound(target, 'sound/items/weapons/punchmiss.ogg', 15, TRUE, -1)
|
|
target.visible_message(span_danger("After a moment, [target]'s leg kicks out sharply!"), \
|
|
span_danger("After a moment, your leg kicks out sharply!"))
|
|
|
|
else if(target_brain_damage < BRAIN_DAMAGE_DEATH) //a severely damaged brain produces a delayed + weaker reaction
|
|
playsound(target, 'sound/items/weapons/punchmiss.ogg', 5, TRUE, -1)
|
|
target.visible_message(span_danger("After a moment, [target]'s leg kicks out weakly!"), \
|
|
span_danger("After a moment, your leg kicks out weakly!"))
|
|
|
|
return
|