Files
Bubberstation/code/datums/elements/kneejerk.dm
T
GhomandGitHub 778ed9f1ab The death or internal/external organ pathing (ft. fixed fox ears and recoloring bodypart overlays with dye sprays) (#87434)
## About The Pull Request
This PR kills the abstract internal and external typepaths for organs,
now replaced by an EXTERNAL_ORGAN flag to distinguish the two kinds.

This PR also fixes fox ears (from #87162, no tail is added) and
mushpeople's caps (they should be red, the screenshot is a tad
outdated).

And yes, you can now use a hair dye spray to recolor body parts like
most tails, podpeople hair, mushpeople caps and cat ears. The process
can be reversed by using the spray again.

## Why It's Good For The Game
Time-Green put some effort during the last few months to untie functions
and mechanics from external/internal organ pathing. Now, all that this
pathing is good for are a few typechecks, easily replaceable with
bitflags.

Also podpeople and mushpeople need a way to recolor their "hair". This
kind of applies to fish tails from the fish infusion, which colors can't
be selected right now. The rest is just there if you ever want to
recolor your lizard tail for some reason.

Proof of testing btw (screenshot taken before mushpeople cap fix, right
side has dyed body parts, moth can't be dyed, they're already fabolous):

![immagine](https://github.com/user-attachments/assets/2bb625c9-9233-42eb-b9b8-e0bd6909ce89)

## Changelog

🆑
code: Removed internal/external pathing from organs in favor of a bit
flag. Hopefully this shouldn't break anything about organs.
fix: Fixed invisible fox ears.
fix: Fixed mushpeople caps not being colored red by default.
add: You can now dye most tails, podpeople hair, mushpeople caps etc.
with a hair dye spray.
/🆑
2024-10-30 08:03:02 +01:00

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/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