mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 13:05:36 +01:00
Adds mob bleeding overlays, tweaks some bleeding balance (#65371)
This commit is contained in:
@@ -10,65 +10,83 @@
|
||||
if(NOBLOOD in dna.species.species_traits || HAS_TRAIT(src, TRAIT_NOBLEED) || (HAS_TRAIT(src, TRAIT_FAKEDEATH)))
|
||||
return
|
||||
|
||||
if(bodytemperature >= TCRYO && !(HAS_TRAIT(src, TRAIT_HUSK))) //cryosleep or husked people do not pump the blood.
|
||||
if(bodytemperature < TCRYO || (HAS_TRAIT(src, TRAIT_HUSK))) //cryosleep or husked people do not pump the blood.
|
||||
return
|
||||
|
||||
//Blood regeneration if there is some space
|
||||
if(blood_volume < BLOOD_VOLUME_NORMAL && !HAS_TRAIT(src, TRAIT_NOHUNGER))
|
||||
var/nutrition_ratio = 0
|
||||
switch(nutrition)
|
||||
if(0 to NUTRITION_LEVEL_STARVING)
|
||||
nutrition_ratio = 0.2
|
||||
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
|
||||
nutrition_ratio = 0.4
|
||||
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
|
||||
nutrition_ratio = 0.6
|
||||
if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
|
||||
nutrition_ratio = 0.8
|
||||
else
|
||||
nutrition_ratio = 1
|
||||
if(satiety > 80)
|
||||
nutrition_ratio *= 1.25
|
||||
adjust_nutrition(-nutrition_ratio * HUNGER_FACTOR * delta_time)
|
||||
blood_volume = min(blood_volume + (BLOOD_REGEN_FACTOR * nutrition_ratio * delta_time), BLOOD_VOLUME_NORMAL)
|
||||
//Blood regeneration if there is some space
|
||||
if(blood_volume < BLOOD_VOLUME_NORMAL && !HAS_TRAIT(src, TRAIT_NOHUNGER))
|
||||
var/nutrition_ratio = 0
|
||||
switch(nutrition)
|
||||
if(0 to NUTRITION_LEVEL_STARVING)
|
||||
nutrition_ratio = 0.2
|
||||
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
|
||||
nutrition_ratio = 0.4
|
||||
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
|
||||
nutrition_ratio = 0.6
|
||||
if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
|
||||
nutrition_ratio = 0.8
|
||||
else
|
||||
nutrition_ratio = 1
|
||||
if(satiety > 80)
|
||||
nutrition_ratio *= 1.25
|
||||
adjust_nutrition(-nutrition_ratio * HUNGER_FACTOR * delta_time)
|
||||
blood_volume = min(blood_volume + (BLOOD_REGEN_FACTOR * nutrition_ratio * delta_time), BLOOD_VOLUME_NORMAL)
|
||||
|
||||
//Effects of bloodloss
|
||||
var/word = pick("dizzy","woozy","faint")
|
||||
switch(blood_volume)
|
||||
if(BLOOD_VOLUME_EXCESS to BLOOD_VOLUME_MAX_LETHAL)
|
||||
if(DT_PROB(7.5, delta_time))
|
||||
to_chat(src, span_userdanger("Blood starts to tear your skin apart. You're going to burst!"))
|
||||
inflate_gib()
|
||||
if(BLOOD_VOLUME_MAXIMUM to BLOOD_VOLUME_EXCESS)
|
||||
if(DT_PROB(5, delta_time))
|
||||
to_chat(src, span_warning("You feel terribly bloated."))
|
||||
if(BLOOD_VOLUME_OKAY to BLOOD_VOLUME_SAFE)
|
||||
if(DT_PROB(2.5, delta_time))
|
||||
to_chat(src, span_warning("You feel [word]."))
|
||||
adjustOxyLoss(round(0.005 * (BLOOD_VOLUME_NORMAL - blood_volume) * delta_time, 1))
|
||||
if(BLOOD_VOLUME_BAD to BLOOD_VOLUME_OKAY)
|
||||
adjustOxyLoss(round(0.01 * (BLOOD_VOLUME_NORMAL - blood_volume) * delta_time, 1))
|
||||
if(DT_PROB(2.5, delta_time))
|
||||
blur_eyes(6)
|
||||
to_chat(src, span_warning("You feel very [word]."))
|
||||
if(BLOOD_VOLUME_SURVIVE to BLOOD_VOLUME_BAD)
|
||||
adjustOxyLoss(2.5 * delta_time)
|
||||
if(DT_PROB(7.5, delta_time))
|
||||
Unconscious(rand(20,60))
|
||||
to_chat(src, span_warning("You feel extremely [word]."))
|
||||
if(-INFINITY to BLOOD_VOLUME_SURVIVE)
|
||||
if(!HAS_TRAIT(src, TRAIT_NODEATH))
|
||||
death()
|
||||
//Effects of bloodloss
|
||||
var/word = pick("dizzy","woozy","faint")
|
||||
switch(blood_volume)
|
||||
if(BLOOD_VOLUME_EXCESS to BLOOD_VOLUME_MAX_LETHAL)
|
||||
if(DT_PROB(7.5, delta_time))
|
||||
to_chat(src, span_userdanger("Blood starts to tear your skin apart. You're going to burst!"))
|
||||
inflate_gib()
|
||||
if(BLOOD_VOLUME_MAXIMUM to BLOOD_VOLUME_EXCESS)
|
||||
if(DT_PROB(5, delta_time))
|
||||
to_chat(src, span_warning("You feel terribly bloated."))
|
||||
if(BLOOD_VOLUME_OKAY to BLOOD_VOLUME_SAFE)
|
||||
if(DT_PROB(2.5, delta_time))
|
||||
to_chat(src, span_warning("You feel [word]."))
|
||||
adjustOxyLoss(round(0.005 * (BLOOD_VOLUME_NORMAL - blood_volume) * delta_time, 1))
|
||||
if(BLOOD_VOLUME_BAD to BLOOD_VOLUME_OKAY)
|
||||
adjustOxyLoss(round(0.01 * (BLOOD_VOLUME_NORMAL - blood_volume) * delta_time, 1))
|
||||
if(DT_PROB(2.5, delta_time))
|
||||
blur_eyes(6)
|
||||
to_chat(src, span_warning("You feel very [word]."))
|
||||
if(BLOOD_VOLUME_SURVIVE to BLOOD_VOLUME_BAD)
|
||||
adjustOxyLoss(2.5 * delta_time)
|
||||
if(DT_PROB(7.5, delta_time))
|
||||
Unconscious(rand(20,60))
|
||||
to_chat(src, span_warning("You feel extremely [word]."))
|
||||
if(-INFINITY to BLOOD_VOLUME_SURVIVE)
|
||||
if(!HAS_TRAIT(src, TRAIT_NODEATH))
|
||||
death()
|
||||
|
||||
var/temp_bleed = 0
|
||||
//Bleeding out
|
||||
for(var/X in bodyparts)
|
||||
var/obj/item/bodypart/BP = X
|
||||
temp_bleed += BP.get_bleed_rate() * delta_time
|
||||
BP.generic_bleedstacks = max(0, BP.generic_bleedstacks - 1)
|
||||
var/temp_bleed = 0
|
||||
var/update_bleed_icons = FALSE
|
||||
//Bleeding out
|
||||
for(var/obj/item/bodypart/iter_part as anything in bodyparts)
|
||||
var/iter_bleed_rate = iter_part.get_part_bleed_rate()
|
||||
temp_bleed += iter_bleed_rate * delta_time
|
||||
iter_part.generic_bleedstacks = max(0, iter_part.generic_bleedstacks - 1)
|
||||
if(iter_part.update_part_wound_overlay())
|
||||
update_bleed_icons = TRUE
|
||||
|
||||
if(temp_bleed)
|
||||
bleed(temp_bleed)
|
||||
bleed_warn(temp_bleed)
|
||||
if(update_bleed_icons)
|
||||
update_wound_overlays()
|
||||
|
||||
if(temp_bleed)
|
||||
bleed(temp_bleed)
|
||||
bleed_warn(temp_bleed)
|
||||
|
||||
/// Has each bodypart update its bleed/wound overlay icon states. If any have changed, it has the owner update wound overlays and returns TRUE
|
||||
/mob/living/carbon/proc/update_bodypart_bleed_overlays()
|
||||
var/update_bleed_icons
|
||||
for(var/obj/item/bodypart/iter_part as anything in bodyparts)
|
||||
if(iter_part.update_part_wound_overlay())
|
||||
update_bleed_icons = TRUE
|
||||
|
||||
if(update_bleed_icons)
|
||||
update_wound_overlays()
|
||||
return update_bleed_icons
|
||||
|
||||
//Makes a blood drop, leaking amt units of blood from the mob
|
||||
/mob/living/carbon/proc/bleed(amt)
|
||||
@@ -92,7 +110,7 @@
|
||||
var/bleed_amt = 0
|
||||
for(var/X in bodyparts)
|
||||
var/obj/item/bodypart/iter_bodypart = X
|
||||
bleed_amt += iter_bodypart.get_bleed_rate()
|
||||
bleed_amt += iter_bodypart.get_part_bleed_rate()
|
||||
return bleed_amt
|
||||
|
||||
/mob/living/carbon/human/get_bleed_rate()
|
||||
|
||||
@@ -1216,7 +1216,7 @@
|
||||
/mob/living/carbon/proc/is_bleeding()
|
||||
for(var/i in bodyparts)
|
||||
var/obj/item/bodypart/BP = i
|
||||
if(BP.get_bleed_rate())
|
||||
if(BP.get_part_bleed_rate())
|
||||
return TRUE
|
||||
|
||||
/// get our total bleedrate
|
||||
@@ -1224,7 +1224,7 @@
|
||||
var/total_bleed_rate = 0
|
||||
for(var/i in bodyparts)
|
||||
var/obj/item/bodypart/BP = i
|
||||
total_bleed_rate += BP.get_bleed_rate()
|
||||
total_bleed_rate += BP.get_part_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_bleed_rate())
|
||||
if (get_bodypart(human_user.zone_selected)?.get_part_bleed_rate())
|
||||
context[SCREENTIP_CONTEXT_CTRL_LMB] = "Grab limb"
|
||||
|
||||
if (human_user != src)
|
||||
|
||||
@@ -651,7 +651,7 @@
|
||||
return ..()
|
||||
|
||||
var/obj/item/bodypart/grasped_part = get_bodypart(zone_selected)
|
||||
if(!grasped_part?.get_bleed_rate())
|
||||
if(!grasped_part?.get_part_bleed_rate())
|
||||
return
|
||||
var/starting_hand_index = active_hand_index
|
||||
if(starting_hand_index == grasped_part.held_index)
|
||||
@@ -659,7 +659,7 @@
|
||||
return
|
||||
|
||||
to_chat(src, span_warning("You try grasping at your [grasped_part.name], trying to stop the bleeding..."))
|
||||
if(!do_after(src, 1.5 SECONDS))
|
||||
if(!do_after(src, 0.75 SECONDS))
|
||||
to_chat(src, span_danger("You fail to grasp your [grasped_part.name]."))
|
||||
return
|
||||
|
||||
@@ -676,7 +676,7 @@
|
||||
desc = "Sometimes all you can do is slow the bleeding."
|
||||
icon_state = "latexballon"
|
||||
inhand_icon_state = "nothing"
|
||||
slowdown = 1
|
||||
slowdown = 0.5
|
||||
item_flags = DROPDEL | ABSTRACT | NOBLUDGEON | SLOWS_WHILE_IN_HAND | HAND_ITEM
|
||||
/// The bodypart we're staunching bleeding on, which also has a reference to us in [/obj/item/bodypart/var/grasped_by]
|
||||
var/obj/item/bodypart/grasped_part
|
||||
|
||||
@@ -92,16 +92,26 @@
|
||||
var/mutable_appearance/damage_overlay = mutable_appearance('icons/mob/dam_mob.dmi', "blank", -DAMAGE_LAYER)
|
||||
overlays_standing[DAMAGE_LAYER] = damage_overlay
|
||||
|
||||
for(var/X in bodyparts)
|
||||
var/obj/item/bodypart/BP = X
|
||||
if(BP.dmg_overlay_type)
|
||||
if(BP.brutestate)
|
||||
damage_overlay.add_overlay("[BP.dmg_overlay_type]_[BP.body_zone]_[BP.brutestate]0") //we're adding icon_states of the base image as overlays
|
||||
if(BP.burnstate)
|
||||
damage_overlay.add_overlay("[BP.dmg_overlay_type]_[BP.body_zone]_0[BP.burnstate]")
|
||||
for(var/obj/item/bodypart/iter_part as anything in bodyparts)
|
||||
if(iter_part.dmg_overlay_type)
|
||||
if(iter_part.brutestate)
|
||||
damage_overlay.add_overlay("[iter_part.dmg_overlay_type]_[iter_part.body_zone]_[iter_part.brutestate]0") //we're adding icon_states of the base image as overlays
|
||||
if(iter_part.burnstate)
|
||||
damage_overlay.add_overlay("[iter_part.dmg_overlay_type]_[iter_part.body_zone]_0[iter_part.burnstate]")
|
||||
|
||||
apply_overlay(DAMAGE_LAYER)
|
||||
|
||||
/mob/living/carbon/update_wound_overlays()
|
||||
remove_overlay(WOUND_LAYER)
|
||||
|
||||
var/mutable_appearance/wound_overlay = mutable_appearance('icons/mob/bleed_overlays.dmi', "blank", -WOUND_LAYER)
|
||||
overlays_standing[WOUND_LAYER] = wound_overlay
|
||||
|
||||
for(var/obj/item/bodypart/iter_part as anything in bodyparts)
|
||||
if(iter_part.bleed_overlay_icon)
|
||||
wound_overlay.add_overlay(iter_part.bleed_overlay_icon)
|
||||
|
||||
apply_overlay(WOUND_LAYER)
|
||||
|
||||
/mob/living/carbon/update_inv_wear_mask()
|
||||
remove_overlay(FACEMASK_LAYER)
|
||||
@@ -254,6 +264,7 @@
|
||||
|
||||
apply_overlay(BODYPARTS_LAYER)
|
||||
update_damage_overlays()
|
||||
update_wound_overlays()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@
|
||||
|
||||
for(var/i in bodyparts)
|
||||
var/obj/item/bodypart/body_part = i
|
||||
if(body_part.get_bleed_rate())
|
||||
if(body_part.get_part_bleed_rate())
|
||||
bleeding_limbs += body_part
|
||||
if(body_part.grasped_by)
|
||||
grasped_limbs += body_part
|
||||
|
||||
@@ -809,7 +809,7 @@
|
||||
var/list/obj/item/bodypart/bleeding_limbs = list()
|
||||
for(var/i in bodyparts)
|
||||
var/obj/item/bodypart/BP = i
|
||||
if(BP.get_bleed_rate())
|
||||
if(BP.get_part_bleed_rate())
|
||||
bleeding_limbs += BP
|
||||
|
||||
var/num_bleeds = LAZYLEN(bleeding_limbs)
|
||||
|
||||
@@ -859,6 +859,10 @@
|
||||
/mob/living/proc/update_damage_overlays()
|
||||
return
|
||||
|
||||
/// Proc that only really gets called for humans, to handle bleeding overlays.
|
||||
/mob/living/proc/update_wound_overlays()
|
||||
return
|
||||
|
||||
/mob/living/Move(atom/newloc, direct, glide_size_override)
|
||||
if(lying_angle != 0)
|
||||
lying_angle_on_movement(direct)
|
||||
|
||||
Reference in New Issue
Block a user