Files
Bubberstation/code/datums/elements/kneejerk.dm
SkyratBot 0a1f06a2d1 [MIRROR] This tail refactor turned into an organ refactor. Funny how that works. [MDB IGNORE] (#14017)
* This tail refactor turned into an organ refactor. Funny how that works.

* Firstly, fixing all the conflicts.

* Fixes all our maps (hopefully)

* Actually, this should fix pod people hair :)

* Almost everything is working, just two major things to fix

* Fixed a certain kind of external organ

* Cleaning up some more stuff

* Turned tail_cat into tail because why the fuck are they separate?

* Moved all the tails into tails.dmi because that was just dumb to have like 3 in a different file

* Adds relevant_layers to organs to help with rendering

* Makes stored_feature_id also check mutant_bodyparts

* Fixes the icon_state names of ALL the tails (pain)

* Fixes wagging, gotta refactor most mutant bodyparts later on

* I Love Added Failures

* Fixed some organs that slipped through my searches

* This could possibly fix the CI for this?

* It doesn't look like it did fix it

* This will make it pass, even if it's ugly as sin.

* Fixed Felinids having a weird ghost tail

* Fixes instances of snouts and tails not being properly colored

Co-authored-by: Kapu1178 <75460809+Kapu1178@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
2022-06-11 23:20:16 -04:00

70 lines
2.5 KiB
Plaintext

/// An element which enables certain items to tap people on their knees to measure brain health
/datum/element/kneejerk
element_flags = ELEMENT_DETACH
/datum/element/kneejerk/Attach(datum/target)
. = ..()
if (!isitem(target))
return ELEMENT_INCOMPATIBLE
RegisterSignal(target, COMSIG_ITEM_ATTACK, .proc/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/r_leg = target.get_bodypart(BODY_ZONE_R_LEG)
var/obj/item/bodypart/l_leg = target.get_bodypart(BODY_ZONE_L_LEG)
var/obj/item/organ/internal/brain/target_brain = target.getorganslot(ORGAN_SLOT_BRAIN)
if(!ishuman(target))
return
if((selected_zone == BODY_ZONE_R_LEG) && !r_leg)
return
if((selected_zone == BODY_ZONE_L_LEG) && !l_leg)
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