mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-01 04:21:42 +00:00
## About The Pull Request Refactors regenerate organs to be slightly more intelligent in handling organ changes and replacements. Noteably: - We don't remove organs that were modified by the owner; such as changing out your heart for a cybernetic - We early break out of the for loop if they aren't supposed to have an organ there and remove it - We check for the organ already being correct, and just healing it and continuing if it is Also changes the names of some of the organ helpers into snake_case ### Mapping March Ckey to receive rewards: N/A ## Why It's Good For The Game ## Changelog --------- Co-authored-by: Jacquerel <hnevard@gmail.com>
69 lines
2.5 KiB
Plaintext
69 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, params)
|
|
SIGNAL_HANDLER
|
|
|
|
var/list/modifiers = params2list(params)
|
|
|
|
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/internal/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/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/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/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
|