mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
Brains actually turn grey as damage progresses (#93739)
## About The Pull Request Damaged brains turns partially grey - the more damage, the more grey <img width="181" height="148" alt="image" src="https://github.com/user-attachments/assets/eee4e37e-46dd-4165-b1d6-468b967a1ba9" /> Top brain is fully damaged, left brain is undamaged, top left stool is the weapon I used to damage the brain ## Why It's Good For The Game Reflects the description visually ## Changelog 🆑 Melbert qol: Brains actually turn grey as damage progresses /🆑
This commit is contained in:
@@ -345,12 +345,20 @@
|
||||
owner.investigate_log("has been killed by brain damage.", INVESTIGATE_DEATHS)
|
||||
owner.death()
|
||||
|
||||
/obj/item/organ/brain/on_bodypart_remove(obj/item/bodypart/limb, movement_flags)
|
||||
. = ..()
|
||||
update_brain_color(animate = FALSE) // once it's out in the world we need to make sure it's the right color
|
||||
|
||||
/obj/item/organ/brain/apply_organ_damage(damage_amount, maximum = maxHealth, required_organ_flag = NONE)
|
||||
. = ..()
|
||||
var/delta_dam = . //for the sake of clarity
|
||||
if(delta_dam <= 0 || damage < BRAIN_DAMAGE_MILD)
|
||||
return
|
||||
if(isnull(bodypart_owner)) // no need to color it if it's in someone's noggin
|
||||
update_brain_color()
|
||||
if(delta_dam > 0 && damage > BRAIN_DAMAGE_MILD)
|
||||
roll_for_brain_trauma(delta_dam)
|
||||
|
||||
/// Rolls a random chance to gain a brain trauma based on damage taken and current damage level
|
||||
/obj/item/organ/brain/proc/roll_for_brain_trauma(delta_dam)
|
||||
if(prob(delta_dam * (1 + max(0, (damage - BRAIN_DAMAGE_MILD)/100)))) //Base chance is the hit damage; for every point of damage past the threshold the chance is increased by 1% //learn how to do your bloody math properly goddamnit
|
||||
gain_trauma_type(BRAIN_TRAUMA_MILD, natural_gain = TRUE)
|
||||
|
||||
@@ -363,6 +371,31 @@
|
||||
else
|
||||
gain_trauma_type(BRAIN_TRAUMA_SEVERE, natural_gain = TRUE)
|
||||
|
||||
#define BRAIN_DAMAGE_FILTER "brain_damage_color_filter"
|
||||
|
||||
/// Updates the brain's color based on damage level - the more damaged, the darker and grayer it gets
|
||||
/obj/item/organ/brain/proc/update_brain_color(animate = TRUE)
|
||||
if(damage <= 0)
|
||||
if(get_filter(BRAIN_DAMAGE_FILTER))
|
||||
if(animate)
|
||||
transition_filter(BRAIN_DAMAGE_FILTER, color_matrix_filter("#ffffff"), time = 1 SECONDS)
|
||||
addtimer(CALLBACK(src, TYPE_PROC_REF(/datum, remove_filter), "brain_damage_color_filter"), 1.2 SECONDS, TIMER_UNIQUE)
|
||||
else
|
||||
remove_filter(BRAIN_DAMAGE_FILTER)
|
||||
return
|
||||
|
||||
var/gradient = rgb_gradient(round(damage / maxHealth, 0.01), 0, "#ffffff", 1, "#7f7f7f")
|
||||
if(animate)
|
||||
if(!get_filter(BRAIN_DAMAGE_FILTER))
|
||||
add_filter(BRAIN_DAMAGE_FILTER, 1, color_matrix_filter("#ffffff"))
|
||||
transition_filter(BRAIN_DAMAGE_FILTER, color_matrix_filter(gradient), time = 1 SECONDS)
|
||||
else if(get_filter(BRAIN_DAMAGE_FILTER))
|
||||
modify_filter(BRAIN_DAMAGE_FILTER, color_matrix_filter(gradient))
|
||||
else
|
||||
add_filter(BRAIN_DAMAGE_FILTER, 1, color_matrix_filter(gradient))
|
||||
|
||||
#undef BRAIN_DAMAGE_FILTER
|
||||
|
||||
/obj/item/organ/brain/check_damage_thresholds()
|
||||
. = ..()
|
||||
if(!owner)
|
||||
|
||||
Reference in New Issue
Block a user