mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-09 16:05:07 +00:00
Nukes get_modified_bleed_rate() and just use cached_bleed_rate instead (#92621)
## About The Pull Request
Port of my changes from [Monkestation/Monkestation2.0@`c54fc87`
(#7295)](c54fc872bf)
This nukes `/obj/item/bodypart/proc/get_modified_bleed_rate()`, instead
everything just uses the `cache_bleed_rate` var - `refresh_bleed_rate()`
will now take into account body position and grasping in the same way
`get_modified_bleed_rate` did.
(Un)grasping a limb already called `refresh_bleed_rate()` anyways, so
the only other change needed was making
`COMSIG_LIVING_SET_BODY_POSITION` also call it.
This commit is contained in:
@@ -273,7 +273,7 @@
|
||||
|
||||
var/datum/wound/burn/flesh/any_burn_wound = locate() in affecting.wounds
|
||||
var/can_heal_burn_wounds = (flesh_regeneration || sanitization) && any_burn_wound?.can_be_ointmented_or_meshed()
|
||||
var/can_suture_bleeding = stop_bleeding && affecting.get_modified_bleed_rate() > 0
|
||||
var/can_suture_bleeding = stop_bleeding && affecting.cached_bleed_rate > 0
|
||||
var/brute_to_heal = heal_brute && affecting.brute_dam > 0
|
||||
var/burn_to_heal = heal_burn && affecting.burn_dam > 0
|
||||
|
||||
@@ -487,7 +487,7 @@
|
||||
if(heal_end_sound)
|
||||
playsound(patient, heal_end_sound, 75, TRUE, MEDIUM_RANGE_SOUND_EXTRARANGE)
|
||||
|
||||
if(limb.get_modified_bleed_rate())
|
||||
if(limb.cached_bleed_rate)
|
||||
add_mob_blood(patient)
|
||||
limb.apply_gauze(src)
|
||||
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
//Bloodloss from wounds
|
||||
var/temp_bleed = 0
|
||||
for(var/obj/item/bodypart/iter_part as anything in bodyparts)
|
||||
var/iter_bleed_rate = iter_part.get_modified_bleed_rate()
|
||||
temp_bleed += iter_bleed_rate * seconds_per_tick
|
||||
temp_bleed += iter_part.cached_bleed_rate * seconds_per_tick
|
||||
|
||||
if(iter_part.generic_bleedstacks) // If you don't have any bleedstacks, don't try and heal them
|
||||
iter_part.adjustBleedStacks(-1, 0)
|
||||
@@ -145,7 +144,7 @@
|
||||
var/bleed_amt = 0
|
||||
for(var/X in bodyparts)
|
||||
var/obj/item/bodypart/iter_bodypart = X
|
||||
bleed_amt += iter_bodypart.get_modified_bleed_rate()
|
||||
bleed_amt += iter_bodypart.cached_bleed_rate
|
||||
return bleed_amt
|
||||
|
||||
/mob/living/carbon/human/get_bleed_rate()
|
||||
|
||||
@@ -1141,14 +1141,14 @@
|
||||
/// if any of our bodyparts are bleeding
|
||||
/mob/living/carbon/proc/is_bleeding()
|
||||
for(var/obj/item/bodypart/part as anything in bodyparts)
|
||||
if(part.get_modified_bleed_rate())
|
||||
if(part.cached_bleed_rate)
|
||||
return TRUE
|
||||
|
||||
/// get our total bleedrate
|
||||
/mob/living/carbon/proc/get_total_bleed_rate()
|
||||
var/total_bleed_rate = 0
|
||||
for(var/obj/item/bodypart/part as anything in bodyparts)
|
||||
total_bleed_rate += part.get_modified_bleed_rate()
|
||||
total_bleed_rate += part.cached_bleed_rate
|
||||
|
||||
return total_bleed_rate
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
else if (human_user == src)
|
||||
context[SCREENTIP_CONTEXT_LMB] = "Check injuries"
|
||||
|
||||
if (get_bodypart(human_user.zone_selected)?.get_modified_bleed_rate())
|
||||
if (get_bodypart(human_user.zone_selected)?.cached_bleed_rate)
|
||||
context[SCREENTIP_CONTEXT_CTRL_LMB] = "Grab limb"
|
||||
|
||||
if (human_user != src)
|
||||
|
||||
@@ -602,7 +602,7 @@
|
||||
to_chat(src, span_danger("You can't grasp your [grasped_part.name] with itself!"))
|
||||
return
|
||||
|
||||
var/bleed_rate = grasped_part.get_modified_bleed_rate()
|
||||
var/bleed_rate = grasped_part.cached_bleed_rate
|
||||
var/bleeding_text = (bleed_rate ? ", trying to stop the bleeding" : "")
|
||||
to_chat(src, span_warning("You try grasping at your [grasped_part.name][bleeding_text]..."))
|
||||
if(!do_after(src, 0.75 SECONDS))
|
||||
@@ -618,7 +618,7 @@
|
||||
|
||||
/// If TRUE, the owner of this bodypart can try grabbing it to slow bleeding, as well as various other effects.
|
||||
/obj/item/bodypart/proc/can_be_grasped()
|
||||
if (get_modified_bleed_rate())
|
||||
if (cached_bleed_rate)
|
||||
return TRUE
|
||||
|
||||
for (var/datum/wound/iterated_wound as anything in wounds)
|
||||
@@ -671,7 +671,7 @@
|
||||
RegisterSignal(user, COMSIG_QDELETING, PROC_REF(qdel_void))
|
||||
RegisterSignals(grasped_part, list(COMSIG_CARBON_REMOVE_LIMB, COMSIG_QDELETING), PROC_REF(qdel_void))
|
||||
|
||||
var/bleed_rate = grasped_part.get_modified_bleed_rate()
|
||||
var/bleed_rate = grasped_part.cached_bleed_rate
|
||||
var/bleeding_text = (bleed_rate ? ", trying to stop the bleeding" : "")
|
||||
user.visible_message(span_danger("[user] grasps at [user.p_their()] [grasped_part.name][bleeding_text]."), span_notice("You grab hold of your [grasped_part.name] tightly."), vision_distance=COMBAT_MESSAGE_RANGE)
|
||||
playsound(get_turf(src), 'sound/items/weapons/thudswoosh.ogg', 50, TRUE, -1)
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
var/list/obj/item/bodypart/grasped_limbs = list()
|
||||
|
||||
for(var/obj/item/bodypart/body_part as anything in bodyparts)
|
||||
if(body_part.get_modified_bleed_rate())
|
||||
if(body_part.cached_bleed_rate)
|
||||
bleeding_limbs += body_part.plaintext_zone
|
||||
if(body_part.grasped_by)
|
||||
grasped_limbs += body_part.plaintext_zone
|
||||
|
||||
@@ -390,7 +390,7 @@
|
||||
if(current_gauze)
|
||||
check_list += span_notice("\tThere is some [current_gauze.name] wrapped around it.")
|
||||
else if(can_bleed())
|
||||
switch(get_modified_bleed_rate())
|
||||
switch(cached_bleed_rate)
|
||||
if(0.2 to 1)
|
||||
check_list += span_warning("\tIt's lightly bleeding.")
|
||||
if(1 to 2)
|
||||
@@ -821,7 +821,7 @@
|
||||
SIGNAL_ADDTRAIT(TRAIT_NOBLOOD),
|
||||
))
|
||||
|
||||
UnregisterSignal(old_owner, list(COMSIG_ATOM_RESTYLE, COMSIG_COMPONENT_CLEAN_ACT))
|
||||
UnregisterSignal(old_owner, list(COMSIG_ATOM_RESTYLE, COMSIG_COMPONENT_CLEAN_ACT, COMSIG_LIVING_SET_BODY_POSITION))
|
||||
|
||||
/// Apply ownership of a limb to someone, giving the appropriate traits, updates and signals
|
||||
/obj/item/bodypart/proc/apply_ownership(mob/living/carbon/new_owner)
|
||||
@@ -851,6 +851,7 @@
|
||||
|
||||
RegisterSignal(owner, COMSIG_ATOM_RESTYLE, PROC_REF(on_attempt_feature_restyle_mob))
|
||||
RegisterSignal(owner, COMSIG_COMPONENT_CLEAN_ACT, PROC_REF(on_owner_clean))
|
||||
RegisterSignal(owner, COMSIG_LIVING_SET_BODY_POSITION, PROC_REF(refresh_bleed_rate))
|
||||
|
||||
forceMove(owner)
|
||||
RegisterSignal(src, COMSIG_MOVABLE_MOVED, PROC_REF(on_forced_removal)) //this must be set after we moved, or we insta gib
|
||||
@@ -1276,6 +1277,7 @@
|
||||
/// Refresh the cache of our rate of bleeding sans any modifiers
|
||||
/// ANYTHING ADDED TO THIS PROC NEEDS TO CALL IT WHEN ITS EFFECT CHANGES
|
||||
/obj/item/bodypart/proc/refresh_bleed_rate()
|
||||
SIGNAL_HANDLER
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
|
||||
var/old_bleed_rate = cached_bleed_rate
|
||||
@@ -1298,21 +1300,18 @@
|
||||
for(var/datum/wound/iter_wound as anything in wounds)
|
||||
cached_bleed_rate += iter_wound.blood_flow
|
||||
|
||||
if(owner.body_position == LYING_DOWN)
|
||||
cached_bleed_rate *= 0.75
|
||||
|
||||
if(grasped_by)
|
||||
cached_bleed_rate *= 0.7
|
||||
|
||||
// Our bleed overlay is based directly off bleed_rate, so go aheead and update that would you?
|
||||
if(cached_bleed_rate != old_bleed_rate)
|
||||
update_part_wound_overlay()
|
||||
|
||||
return cached_bleed_rate
|
||||
|
||||
/// Returns our bleed rate, taking into account laying down and grabbing the limb
|
||||
/obj/item/bodypart/proc/get_modified_bleed_rate()
|
||||
var/bleed_rate = cached_bleed_rate
|
||||
if(owner.body_position == LYING_DOWN)
|
||||
bleed_rate *= 0.75
|
||||
if(grasped_by)
|
||||
bleed_rate *= 0.7
|
||||
return bleed_rate
|
||||
|
||||
/obj/item/bodypart/proc/update_part_wound_overlay()
|
||||
if(!owner)
|
||||
return FALSE
|
||||
|
||||
Reference in New Issue
Block a user