From a447b170394a4a010ef880ee394c948da70d9d11 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Tue, 12 Mar 2024 00:20:55 -0400 Subject: [PATCH 01/29] initial bleeding changes --- code/_onclick/item_attack.dm | 2 +- code/modules/mob/living/blood.dm | 5 +---- code/modules/mob/living/carbon/damage_procs.dm | 6 +++--- .../mob/living/carbon/human/damage_procs.dm | 2 +- code/modules/mob/living/carbon/human/examine.dm | 15 +++++++++++++++ code/modules/mob/living/damage_procs.dm | 2 +- code/modules/mob/living/silicon/damage_procs.dm | 2 +- code/modules/surgery/bodyparts/bodyparts.dm | 17 ++++++++++++++++- 8 files changed, 39 insertions(+), 12 deletions(-) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 1cf0585c0ed4..58b9604e585a 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -153,7 +153,7 @@ var/armor_value = run_armor_check(attack_flag = "melee", armour_penetration = I.armour_penetration) //WS Edit - Simplemobs can have armor send_item_attack_message(I, user) if(I.force) - apply_damage(I.force, I.damtype, break_modifier = I.force, blocked = armor_value) //Bone break modifier = item force + apply_damage(I.force, I.damtype, break_modifier = I.force, blocked = armor_value, sharpness = I.get_sharpness()) //Bone break modifier = item force if(I.damtype == BRUTE) if(prob(33)) I.add_mob_blood(src) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index aec75960989d..675722ce52f4 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -86,7 +86,7 @@ var/temp_bleed = 0 //Bleeding out for(var/obj/item/bodypart/BP as anything in bodyparts) - var/brutedamage = BP.brute_dam + temp_bleed += BP.bleeding //We want an accurate reading of .len listclearnulls(BP.embedded_objects) @@ -94,9 +94,6 @@ if(!embeddies.isEmbedHarmless()) temp_bleed += 0.5 - if(brutedamage >= 20) - temp_bleed += (brutedamage * 0.013) - bleed_rate = max(bleed_rate - 0.5, temp_bleed)//if no wounds, other bleed effects (heparin) naturally decreases if(bleed_rate && !bleedsuppress && !(HAS_TRAIT(src, TRAIT_FAKEDEATH))) diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index 2045bfe4aa18..9ad1f4673f97 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -1,6 +1,6 @@ -/mob/living/carbon/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE, spread_damage = FALSE, break_modifier = 1) +/mob/living/carbon/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE, spread_damage = FALSE, break_modifier = 1, sharpness = FALSE) SEND_SIGNAL(src, COMSIG_MOB_APPLY_DAMGE, damage, damagetype, def_zone) var/hit_percent = (100-blocked)/100 if(!damage || (!forced && hit_percent <= 0)) @@ -21,7 +21,7 @@ switch(damagetype) if(BRUTE) if(BP) - if(BP.receive_damage(damage_amount, 0, break_modifier)) + if(BP.receive_damage(damage_amount, 0, break_modifier, sharpness = sharpness)) update_damage_overlays() else //no bodypart, we deal damage with a more general method. adjustBruteLoss(damage_amount, forced = forced) @@ -29,7 +29,7 @@ shake_animation(damage_amount) if(BURN) if(BP) - if(BP.receive_damage(0, damage_amount, break_modifier)) + if(BP.receive_damage(0, damage_amount, break_modifier, sharpness = sharpness)) update_damage_overlays() else adjustFireLoss(damage_amount, forced = forced) diff --git a/code/modules/mob/living/carbon/human/damage_procs.dm b/code/modules/mob/living/carbon/human/damage_procs.dm index 4883446b7cb1..825ef2f6e193 100644 --- a/code/modules/mob/living/carbon/human/damage_procs.dm +++ b/code/modules/mob/living/carbon/human/damage_procs.dm @@ -1,6 +1,6 @@ /// depending on the species, it will run the corresponding apply_damage code there -/mob/living/carbon/human/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE, spread_damage = FALSE, break_modifier = 1) //WS Edit - Breakable Bones +/mob/living/carbon/human/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE, spread_damage = FALSE, break_modifier = 1, sharpness = FALSE) //WS Edit - Breakable Bones return dna.species.apply_damage(damage, damagetype, def_zone, blocked, src, forced, spread_damage) /mob/living/carbon/human/revive(full_heal = 0, admin_revive = 0) diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index ceda44284f46..e9eaa3e54d16 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -401,6 +401,21 @@ /mob/living/carbon/human/examine_more(mob/user) . = ..() + for(var/obj/item/bodypart/BP as anything in bodyparts) + var/bleed_text + switch(BP.bleeding) + if(0) + continue + if(1-3) + bleed_text = "lightly." + if(4-6) + bleed_text = "moderately." + if(7-10) + bleed_text = "heavily!" + else + bleed_text = "significantly!!" + . += span_warning("Their [BP] is bleeding [bleed_text]") + if ((wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))) return var/age_text diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index 76daa5ba21d4..bcb2090b2688 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -14,7 +14,7 @@ * * Returns TRUE if damage applied */ -/mob/living/proc/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE, spread_damage = FALSE, break_modifier = 1)//WS Edit - Breakable Bones +/mob/living/proc/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE, spread_damage = FALSE, break_modifier = 1, sharpness = FALSE)//WS Edit - Breakable Bones SEND_SIGNAL(src, COMSIG_MOB_APPLY_DAMGE, damage, damagetype, def_zone) var/hit_percent = (100-blocked)/100 if(!damage || (!forced && hit_percent <= 0) || !(flags_1 & INITIALIZED_1)) diff --git a/code/modules/mob/living/silicon/damage_procs.dm b/code/modules/mob/living/silicon/damage_procs.dm index a6d86d1507ba..80c643e0ceef 100644 --- a/code/modules/mob/living/silicon/damage_procs.dm +++ b/code/modules/mob/living/silicon/damage_procs.dm @@ -1,5 +1,5 @@ -/mob/living/silicon/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE, break_modifier = 1) +/mob/living/silicon/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE, break_modifier = 1, sharpness = FALSE) var/hit_percent = (100-blocked)/100 if((!damage || (!forced && hit_percent <= 0))) return 0 diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 366fb41790ab..2165008575af 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -50,6 +50,16 @@ /// Is it fine, broken, splinted, or just straight up fucking gone var/bone_status = BONE_FLAG_NO_BONES var/bone_break_threshold = 30 + /// Threshold at which the limb will start bleeding if damaged by sharp items or projectiles + var/bleed_threshold = 10 + /// Threshold at which the limb will start bleeding if damaged by blunt items + var/bleed_threshold_blunt = 40 + /// Minimum damage of an incoming attack to cause bleeding + var/bleed_damage_min = 5 + /// Minimum damage of an incoming blunt attack to cause bleeding + var/bleed_damage_min_blunt = 10 + /// Current limb bleeding, increased when the limb takes brute damage over certain thresholds, decreased through bandages and cauterization + var/bleeding = 0 /// So we know if we need to scream if this limb hits max damage var/last_maxed @@ -206,7 +216,7 @@ //Applies brute and burn damage to the organ. Returns 1 if the damage-icon states changed at all. //Damage will not exceed max_damage using this proc //Cannot apply negative damage -/obj/item/bodypart/proc/receive_damage(brute = 0, burn = 0, stamina = 0, blocked = 0, updating_health = TRUE, required_status = null, break_modifier = 1) +/obj/item/bodypart/proc/receive_damage(brute = 0, burn = 0, stamina = 0, blocked = 0, updating_health = TRUE, required_status = null, break_modifier = 1, sharpness = FALSE) var/hit_percent = (100-blocked)/100 if((!brute && !burn && !stamina) || hit_percent <= 0) return FALSE @@ -231,6 +241,11 @@ if(ALIEN_BODYPART,LARVA_BODYPART) //aliens take double burn //nothing can burn with so much snowflake code around burn *= 2 + + // Bleeding is applied here + if(brute && ((brute_dam > bleed_threshold && sharpness) || (brute_dam > bleed_threshold_blunt))) + bleeding++ + // Is the damage greater than the threshold, and if so, probability of damage + item force if((brute_dam > bone_break_threshold) && prob(brute_dam + break_modifier)) break_bone() From 2568a57a9b546e06cfb05f572e8824fa70889ae2 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Tue, 12 Mar 2024 22:55:38 -0400 Subject: [PATCH 02/29] Things what cause bleeding --- code/datums/components/butchering.dm | 3 ++- code/modules/mob/living/blood.dm | 9 ++++++--- code/modules/mob/living/carbon/damage_procs.dm | 6 ++++++ code/modules/mob/living/carbon/human/damage_procs.dm | 2 +- code/modules/mob/living/carbon/human/examine.dm | 12 ++++++------ code/modules/mob/living/carbon/human/species.dm | 8 ++++---- .../mob/living/carbon/human/species_types/zombies.dm | 2 +- code/modules/mob/living/damage_procs.dm | 2 ++ .../reagents/chemistry/reagents/toxin_reagents.dm | 3 ++- code/modules/surgery/bodyparts/bodyparts.dm | 9 ++++----- 10 files changed, 34 insertions(+), 22 deletions(-) diff --git a/code/datums/components/butchering.dm b/code/datums/components/butchering.dm index 6923760a7705..d47b0267e54d 100644 --- a/code/datums/components/butchering.dm +++ b/code/datums/components/butchering.dm @@ -73,7 +73,8 @@ "[user] slits your throat...") log_combat(user, H, "finishes slicing the throat of") H.apply_damage(source.force, BRUTE, BODY_ZONE_HEAD) - H.bleed_rate = clamp(H.bleed_rate + 20, 0, 30) + var/obj/item/bodypart/throat_in_question = H.get_bodypart(BODY_ZONE_HEAD) + throat_in_question.bleeding = clamp(throat_in_question.bleeding + 20, 0, 30) H.apply_status_effect(/datum/status_effect/neck_slice) /datum/component/butchering/proc/Butcher(mob/living/butcher, mob/living/meat) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 675722ce52f4..c24617027934 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -85,8 +85,9 @@ var/temp_bleed = 0 //Bleeding out + var/limb_bleed = 0 for(var/obj/item/bodypart/BP as anything in bodyparts) - temp_bleed += BP.bleeding + limb_bleed += BP.bleeding //We want an accurate reading of .len listclearnulls(BP.embedded_objects) @@ -96,8 +97,8 @@ bleed_rate = max(bleed_rate - 0.5, temp_bleed)//if no wounds, other bleed effects (heparin) naturally decreases - if(bleed_rate && !bleedsuppress && !(HAS_TRAIT(src, TRAIT_FAKEDEATH))) - bleed(bleed_rate) + if((bleed_rate || limb_bleed) && !bleedsuppress && !(HAS_TRAIT(src, TRAIT_FAKEDEATH))) + bleed(bleed_rate + limb_bleed) //Makes a blood drop, leaking amt units of blood from the mob /mob/living/carbon/proc/bleed(amt) @@ -122,6 +123,8 @@ /mob/living/carbon/human/restore_blood() blood_volume = BLOOD_VOLUME_NORMAL + for(var/obj/item/bodypart/BP as anything in bodyparts) + BP.bleeding = 0 bleed_rate = 0 /**************************************************** diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index 9ad1f4673f97..d35ec2d39cc3 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -267,3 +267,9 @@ if(update) update_damage_overlays() update_stamina() + +/// Gets a list of bleeding bodyparts +/mob/living/carbon/proc/get_bleeding_parts() + for(var/obj/item/bodypart/BP as anything in bodyparts) + if(BP.bleeding) + . += BP diff --git a/code/modules/mob/living/carbon/human/damage_procs.dm b/code/modules/mob/living/carbon/human/damage_procs.dm index 825ef2f6e193..d7f6834030b3 100644 --- a/code/modules/mob/living/carbon/human/damage_procs.dm +++ b/code/modules/mob/living/carbon/human/damage_procs.dm @@ -1,7 +1,7 @@ /// depending on the species, it will run the corresponding apply_damage code there /mob/living/carbon/human/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE, spread_damage = FALSE, break_modifier = 1, sharpness = FALSE) //WS Edit - Breakable Bones - return dna.species.apply_damage(damage, damagetype, def_zone, blocked, src, forced, spread_damage) + return dna.species.apply_damage(damage, damagetype, def_zone, blocked, src, forced, spread_damage, sharpness = sharpness) /mob/living/carbon/human/revive(full_heal = 0, admin_revive = 0) if(..()) diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index e9eaa3e54d16..34b16fdce22b 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -245,7 +245,7 @@ if(bleedsuppress) msg += "[t_He] [t_is] bandaged with something.\n" - else if(bleed_rate) + else if(bleed_rate || LAZYLEN(get_bleeding_parts())) if(reagents.has_reagent(/datum/reagent/toxin/heparin, needs_metabolizing = TRUE)) msg += "[t_He] [t_is] bleeding uncontrollably!\n" else @@ -403,14 +403,14 @@ . = ..() for(var/obj/item/bodypart/BP as anything in bodyparts) var/bleed_text + if(!BP.bleeding) + continue switch(BP.bleeding) - if(0) - continue - if(1-3) + if(0 to 1) bleed_text = "lightly." - if(4-6) + if(1 to 2) bleed_text = "moderately." - if(7-10) + if(2 to 3) bleed_text = "heavily!" else bleed_text = "significantly!!" diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index eda9c8c3db64..596ec44a5591 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1609,7 +1609,7 @@ GLOBAL_LIST_EMPTY(roundstart_races) armor_block = min(90,armor_block) //cap damage reduction at 90% var/weakness = H.check_weakness(I, user) - apply_damage(I.force * weakness, I.damtype, def_zone, armor_block, H) + apply_damage(I.force * weakness, I.damtype, def_zone, armor_block, H, sharpness = I.get_sharpness()) H.send_item_attack_message(I, user, hit_area) @@ -1678,7 +1678,7 @@ GLOBAL_LIST_EMPTY(roundstart_races) return TRUE -/datum/species/proc/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked, mob/living/carbon/human/H, forced = FALSE, spread_damage = FALSE, break_modifier = 1) +/datum/species/proc/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked, mob/living/carbon/human/H, forced = FALSE, spread_damage = FALSE, break_modifier = 1, sharpness = FALSE) SEND_SIGNAL(H, COMSIG_MOB_APPLY_DAMGE, damage, damagetype, def_zone) var/hit_percent = (100-(blocked+armor))/100 hit_percent = (hit_percent * (100-H.physiology.damage_resistance))/100 @@ -1701,7 +1701,7 @@ GLOBAL_LIST_EMPTY(roundstart_races) H.damageoverlaytemp = 20 var/damage_amount = forced ? damage : damage * hit_percent * brutemod * H.physiology.brute_mod if(BP) - if(BP.receive_damage(damage_amount, 0, break_modifier = break_modifier)) + if(BP.receive_damage(damage_amount, 0, break_modifier = break_modifier, sharpness = sharpness)) H.update_damage_overlays() else//no bodypart, we deal damage with a more general method. H.adjustBruteLoss(damage_amount) @@ -1711,7 +1711,7 @@ GLOBAL_LIST_EMPTY(roundstart_races) H.damageoverlaytemp = 20 var/damage_amount = forced ? damage : damage * hit_percent * burnmod * H.physiology.burn_mod if(BP) - if(BP.receive_damage(0, damage_amount, break_modifier = break_modifier)) + if(BP.receive_damage(0, damage_amount, break_modifier = break_modifier, sharpness = sharpness)) H.update_damage_overlays() else H.adjustFireLoss(damage_amount) diff --git a/code/modules/mob/living/carbon/human/species_types/zombies.dm b/code/modules/mob/living/carbon/human/species_types/zombies.dm index 702adfb224a2..c90cbd0dbc8f 100644 --- a/code/modules/mob/living/carbon/human/species_types/zombies.dm +++ b/code/modules/mob/living/carbon/human/species_types/zombies.dm @@ -46,7 +46,7 @@ /datum/species/zombie/infectious/spec_stun(mob/living/carbon/human/H,amount) . = min(20, amount) -/datum/species/zombie/infectious/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked, mob/living/carbon/human/H, forced = FALSE) +/datum/species/zombie/infectious/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked, mob/living/carbon/human/H, forced = FALSE, sharpness = FALSE) . = ..() if(.) regen_cooldown = world.time + REGENERATION_DELAY diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index bcb2090b2688..430d02f7f1ea 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -11,6 +11,8 @@ * * blocked - armor value applied * * forced - bypass hit percentage * * spread_damage - used in overrides + * * break_modifier - increases bone breaking chance + * * sharpness - used for bleeding * * Returns TRUE if damage applied */ diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index d95bd68759c7..b35d1482ae81 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -766,7 +766,8 @@ /datum/reagent/toxin/heparin/on_mob_life(mob/living/carbon/M) if(ishuman(M)) var/mob/living/carbon/human/H = M - H.bleed_rate = min(H.bleed_rate + 2, 8) + var/obj/item/bodypart/BP = pick(H.get_bleeding_parts()) + BP.bleeding *= 1.1 H.adjustBruteLoss(1, 0) //Brute damage increases with the amount they're bleeding . = 1 return ..() || . diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 2165008575af..99195e66f5c0 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -241,11 +241,6 @@ if(ALIEN_BODYPART,LARVA_BODYPART) //aliens take double burn //nothing can burn with so much snowflake code around burn *= 2 - - // Bleeding is applied here - if(brute && ((brute_dam > bleed_threshold && sharpness) || (brute_dam > bleed_threshold_blunt))) - bleeding++ - // Is the damage greater than the threshold, and if so, probability of damage + item force if((brute_dam > bone_break_threshold) && prob(brute_dam + break_modifier)) break_bone() @@ -263,6 +258,10 @@ brute_dam += brute burn_dam += burn + // Bleeding is applied here + if((sharpness && brute_dam > bleed_threshold && brute > bleed_damage_min) || (brute_dam > bleed_threshold_blunt && brute > bleed_damage_min_blunt)) + bleeding += brute_dam/max_damage + //We've dealt the physical damages, if there's room lets apply the stamina damage. if(stamina) set_stamina_dam(stamina_dam + round(clamp(stamina, 0, max_stamina_damage - stamina_dam), DAMAGE_PRECISION)) From b4db414a18bf4b174084e244d42e69820d298429 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Wed, 13 Mar 2024 00:41:48 -0400 Subject: [PATCH 03/29] scope 1: bandages and bandage-based healing --- code/game/objects/items/stacks/medical.dm | 24 +++++++++++++------ code/modules/mob/living/blood.dm | 2 ++ .../modules/mob/living/carbon/damage_procs.dm | 4 +++- .../mob/living/carbon/human/examine.dm | 19 +++++++++++++-- code/modules/surgery/bodyparts/bodyparts.dm | 5 ++++ 5 files changed, 44 insertions(+), 10 deletions(-) diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index de636902eb52..3e47e06bb9ee 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -137,12 +137,15 @@ /obj/item/stack/medical/gauze name = "medical gauze" - desc = "A roll of elastic cloth that is extremely effective at stopping bleeding, but does not heal wounds." + desc = "A roll of elastic cloth that is extremely effective at stopping bleeding and slowly heals wounds." gender = PLURAL singular_name = "medical gauze" icon_state = "gauze" apply_sounds = list('sound/effects/rip1.ogg', 'sound/effects/rip2.ogg') - var/stop_bleeding = 1800 + var/healing_rate = 0.2 + var/bleed_reduction = 0.75 + + var/lifespan = 1800 self_delay = 20 max_amount = 12 grind_results = list(/datum/reagent/cellulose = 2) @@ -154,10 +157,16 @@ /obj/item/stack/medical/gauze/heal(mob/living/target, mob/user) if(ishuman(target)) var/mob/living/carbon/human/H = target - if(!H.bleedsuppress && H.bleed_rate) //so you can't stack bleed suppression - H.suppress_bloodloss(stop_bleeding) + var/obj/item/bodypart/BP = H.get_bodypart(check_zone(user.zone_selected)) + if(!BP || !(BP in H.get_damaged_bodyparts(TRUE, TRUE))) + return + BP.dressing = new type(BP, 1, FALSE) + use(1) + user.visible_message(span_notice("[user] wraps [target]'s [BP] with [src]."), span_notice("You wrap [target]'s [BP] with [src]."), span_hear("You hear ruffling cloth.")) + return TRUE + /*if(!H.bleedsuppress && H.bleed_rate) //so you can't stack bleed suppression to_chat(user, "You stop the bleeding of [target]!") - return TRUE + return TRUE*/ to_chat(user, "You can not use \the [src] on [target]!") /obj/item/stack/medical/gauze/attackby(obj/item/I, mob/user, params) @@ -178,8 +187,9 @@ /obj/item/stack/medical/gauze/improvised name = "improvised gauze" singular_name = "improvised gauze" - desc = "A roll of cloth roughly cut from something that can stop bleeding, but does not heal wounds." - stop_bleeding = 900 + desc = "A roll of cloth roughly cut from something that can stop bleeding and slowly heal wounds." + healing_rate = 0.1 + lifespan = 900 /obj/item/stack/medical/gauze/cyborg custom_materials = null diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index c24617027934..01877ebb1e3a 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -87,6 +87,8 @@ //Bleeding out var/limb_bleed = 0 for(var/obj/item/bodypart/BP as anything in bodyparts) + if(BP.dressing) + continue limb_bleed += BP.bleeding //We want an accurate reading of .len diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index d35ec2d39cc3..d298f80aee09 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -270,6 +270,8 @@ /// Gets a list of bleeding bodyparts /mob/living/carbon/proc/get_bleeding_parts() + var/list/obj/item/bodypart/parts = list() for(var/obj/item/bodypart/BP as anything in bodyparts) if(BP.bleeding) - . += BP + parts += BP + return parts diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 34b16fdce22b..5d928a4a5970 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -243,13 +243,25 @@ if(blood_volume < BLOOD_VOLUME_SAFE || skin_tone == "albino") msg += "[t_He] [t_has] pale skin.\n" - if(bleedsuppress) + + var/list/obj/item/bodypart/bleed_check = get_bleeding_parts() + if(LAZYLEN(bleed_check)) + if(reagents.has_reagent(/datum/reagent/toxin/heparin, needs_metabolizing = TRUE)) + msg += "[t_He] [t_is] bleeding uncontrollably!\n" + else + var/bleed_msg = "[t_He] [t_is] bandaged with something.\n" + for(var/obj/item/bodypart/BP in bleed_check) + if(!BP.dressing) + bleed_msg = "[t_He] [t_is] bleeding!\n" + break + msg += bleed_msg + /*if(bleedsuppress) msg += "[t_He] [t_is] bandaged with something.\n" else if(bleed_rate || LAZYLEN(get_bleeding_parts())) if(reagents.has_reagent(/datum/reagent/toxin/heparin, needs_metabolizing = TRUE)) msg += "[t_He] [t_is] bleeding uncontrollably!\n" else - msg += "[t_He] [t_is] bleeding!\n" + msg += "[t_He] [t_is] bleeding!\n"*/ if(reagents.has_reagent(/datum/reagent/teslium, needs_metabolizing = TRUE)) msg += "[t_He] [t_is] emitting a gentle blue glow!\n" @@ -403,6 +415,9 @@ . = ..() for(var/obj/item/bodypart/BP as anything in bodyparts) var/bleed_text + if(BP.dressing) + . += span_notice("Their [BP] is dressed with [BP.dressing.name]") + continue if(!BP.bleeding) continue switch(BP.bleeding) diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 99195e66f5c0..df4927188965 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -60,6 +60,8 @@ var/bleed_damage_min_blunt = 10 /// Current limb bleeding, increased when the limb takes brute damage over certain thresholds, decreased through bandages and cauterization var/bleeding = 0 + /// Currently applied bandage, used for healing + var/obj/item/stack/medical/gauze/dressing = null /// So we know if we need to scream if this limb hits max damage var/last_maxed @@ -212,6 +214,9 @@ if(stamina_dam > DAMAGE_PRECISION && owner.stam_regen_start_time <= world.time) //DO NOT update health here, it'll be done in the carbon's life. heal_damage(0, 0, INFINITY, null, FALSE) . |= BODYPART_LIFE_UPDATE_HEALTH + if(dressing) + heal_damage(dressing.healing_rate, dressing.healing_rate, required_status = BODYTYPE_ORGANIC, updating_health = FALSE) + //Applies brute and burn damage to the organ. Returns 1 if the damage-icon states changed at all. //Damage will not exceed max_damage using this proc From 167ae2eb449fc8be19b82cfc990ccaf1409c723d Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Wed, 20 Mar 2024 05:13:57 -0400 Subject: [PATCH 04/29] bandage component & blood stuff (again!) --- code/__DEFINES/dcs/signals.dm | 3 + code/__DEFINES/mobs.dm | 4 ++ code/datums/components/bandage.dm | 58 +++++++++++++++++++ code/datums/components/butchering.dm | 2 +- code/game/objects/items/devices/scanners.dm | 2 +- code/game/objects/items/stacks/medical.dm | 24 ++++---- code/modules/mob/living/blood.dm | 2 +- .../mob/living/carbon/human/examine.dm | 18 +++--- code/modules/mob/living/life.dm | 2 + .../chemistry/reagents/toxin_reagents.dm | 4 +- code/modules/surgery/bodyparts/bodyparts.dm | 22 +++---- shiptest.dme | 1 + 12 files changed, 107 insertions(+), 35 deletions(-) create mode 100644 code/datums/components/bandage.dm diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 2b8dc67cb684..4fd754481d0c 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -377,6 +377,9 @@ /* #define SPEECH_IGNORE_SPAM 6 #define SPEECH_FORCED 7 */ +///from /mob/living/life() +#define COMSIG_MOB_LIFE "mob_life" + ///from /mob/say_dead(): (mob/speaker, message) #define COMSIG_MOB_DEADSAY "mob_deadsay" #define MOB_DEADSAY_SIGNAL_INTERCEPT (1<<0) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index ad9d5ae5abc8..d370a6e07dcc 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -28,6 +28,10 @@ #define BLOOD_VOLUME_BAD 224 #define BLOOD_VOLUME_SURVIVE 122 +// Bloodloss +#define BLOOD_LOSS_MAXIMUM 30 +#define BLOOD_LOSS_DAMAGE_CAP 2 + //Sizes of mobs, used by mob/living/var/mob_size #define MOB_SIZE_TINY 0 #define MOB_SIZE_SMALL 1 diff --git a/code/datums/components/bandage.dm b/code/datums/components/bandage.dm new file mode 100644 index 000000000000..913c3f166828 --- /dev/null +++ b/code/datums/components/bandage.dm @@ -0,0 +1,58 @@ +#define BANDAGE_DAMAGE_COEFF 5 + +/datum/component/bandage + /// How much damage do we heal? + var/healing_speed = 0.2 + /// How many healing ticks will this bandage apply? Reduced by incoming damage and other nasties + var/cleanliness = 300 + /// What is dropped when the bandage is removed? + var/trash_item = /obj/effect/decal/cleanable/wrapping + var/bandage_name = "bandage" + ///a + var/mob/living/mummy + +/datum/component/bandage/Initialize(_healing_speed, _cleanliness, _bandage_name, _trash_item) + if(!istype(parent, /obj/item/bodypart)) + return COMPONENT_INCOMPATIBLE + var/obj/item/bodypart/BP = parent + mummy = BP.owner + if(!mummy) + return COMPONENT_INCOMPATIBLE + if(_healing_speed) + healing_speed = _healing_speed + if(_cleanliness) + cleanliness = _cleanliness + if(_bandage_name) + bandage_name = _bandage_name + if(_trash_item) + trash_item = _trash_item + RegisterSignal(mummy, COMSIG_MOB_APPLY_DAMGE, PROC_REF(check_damage)) + RegisterSignal(mummy, COMSIG_MOB_LIFE, PROC_REF(bandage_effects)) + +/datum/component/bandage/proc/check_damage(damage, damagetype = BRUTE, def_zone = null) + if(parent != mummy.get_bodypart(check_zone(def_zone))) + return + cleanliness = cleanliness - damage * BANDAGE_DAMAGE_COEFF + if(cleanliness <= 0) + drop_bandage() + + +/datum/component/bandage/proc/bandage_effects() + var/obj/item/bodypart/heal_target = parent + var/actual_heal_speed = healing_speed //TODO: add modifiers to this (scope 2) + heal_target.heal_damage(actual_heal_speed, actual_heal_speed) + cleanliness -- + if(heal_target.bleeding) + cleanliness = round(cleanliness - max(heal_target.bleeding, 1)) + heal_target.adjust_bleeding(actual_heal_speed) + if(cleanliness <= 0 || (!heal_target.bleeding && !heal_target.get_damage())) + drop_bandage() + +/datum/component/bandage/proc/drop_bandage() + + if(trash_item) + new trash_item(get_turf(parent)) + mummy.visible_message(span_notice("The [bandage_name] on [mummy]'s [parent] falls to the floor."), span_notice("The [bandage_name] on your [parent] falls to the floor.")) + else + to_chat(mummy, span_notice("The [bandage_name] on your [parent] has healed what it can.")) + qdel(src) diff --git a/code/datums/components/butchering.dm b/code/datums/components/butchering.dm index d47b0267e54d..710921d6ef14 100644 --- a/code/datums/components/butchering.dm +++ b/code/datums/components/butchering.dm @@ -74,7 +74,7 @@ log_combat(user, H, "finishes slicing the throat of") H.apply_damage(source.force, BRUTE, BODY_ZONE_HEAD) var/obj/item/bodypart/throat_in_question = H.get_bodypart(BODY_ZONE_HEAD) - throat_in_question.bleeding = clamp(throat_in_question.bleeding + 20, 0, 30) + throat_in_question.adjust_bleeding(20) H.apply_status_effect(/datum/status_effect/neck_slice) /datum/component/butchering/proc/Butcher(mob/living/butcher, mob/living/meat) diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 6f11fe4ebac1..59b0e37ad8eb 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -357,7 +357,7 @@ GENE SCANNER if(blood_id) if(ishuman(C)) var/mob/living/carbon/human/H = C - if(H.bleed_rate) + if(LAZYLEN(H.get_bleeding_parts())) render_list += "Subject is bleeding!\n" var/blood_percent = round((C.blood_volume / BLOOD_VOLUME_NORMAL)*100) var/blood_type = C.dna.blood_type.name diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 3e47e06bb9ee..a906b8fb1256 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -155,19 +155,21 @@ amount = 12 /obj/item/stack/medical/gauze/heal(mob/living/target, mob/user) - if(ishuman(target)) - var/mob/living/carbon/human/H = target - var/obj/item/bodypart/BP = H.get_bodypart(check_zone(user.zone_selected)) - if(!BP || !(BP in H.get_damaged_bodyparts(TRUE, TRUE))) + if(iscarbon(target)) + var/mob/living/carbon/C = target + var/obj/item/bodypart/BP = C.get_bodypart(check_zone(user.zone_selected)) + if(!BP) + to_chat(user, span_warning("[C] doesn't have \a [parse_zone(user.zone_selected)]!")) return - BP.dressing = new type(BP, 1, FALSE) - use(1) - user.visible_message(span_notice("[user] wraps [target]'s [BP] with [src]."), span_notice("You wrap [target]'s [BP] with [src]."), span_hear("You hear ruffling cloth.")) + if(!BP.get_damage() && !BP.bleeding) + to_chat(user, span_warning("[C]'s [BP] is already fully healed!")) + return + if(BP.GetComponent(/datum/component/bandage)) + to_chat(user, span_warning("[C] is already bandaged!")) + return + BP.AddComponent( /datum/component/bandage, healing_rate, lifespan, "gauze") + user.visible_message(span_notice("[user] wraps [C]'s [BP] with [src]."), span_notice("You wrap [C]'s [BP] with [src]."), span_hear("You hear ruffling cloth.")) return TRUE - /*if(!H.bleedsuppress && H.bleed_rate) //so you can't stack bleed suppression - to_chat(user, "You stop the bleeding of [target]!") - return TRUE*/ - to_chat(user, "You can not use \the [src] on [target]!") /obj/item/stack/medical/gauze/attackby(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WIRECUTTER || I.get_sharpness()) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 01877ebb1e3a..db5d16c9c84a 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -87,7 +87,7 @@ //Bleeding out var/limb_bleed = 0 for(var/obj/item/bodypart/BP as anything in bodyparts) - if(BP.dressing) + if(BP.GetComponent(/datum/component/bandage)) continue limb_bleed += BP.bleeding diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 5d928a4a5970..3966a03c851f 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -251,9 +251,9 @@ else var/bleed_msg = "[t_He] [t_is] bandaged with something.\n" for(var/obj/item/bodypart/BP in bleed_check) - if(!BP.dressing) - bleed_msg = "[t_He] [t_is] bleeding!\n" - break + //if(!BP.dressing) + //bleed_msg = "[t_He] [t_is] bleeding!\n" + //break msg += bleed_msg /*if(bleedsuppress) msg += "[t_He] [t_is] bandaged with something.\n" @@ -415,17 +415,17 @@ . = ..() for(var/obj/item/bodypart/BP as anything in bodyparts) var/bleed_text - if(BP.dressing) - . += span_notice("Their [BP] is dressed with [BP.dressing.name]") - continue + //if(BP.dressing) + //. += span_notice("Their [BP] is dressed with [BP.dressing.name]") + //continue if(!BP.bleeding) continue switch(BP.bleeding) - if(0 to 1) + if(0 to 0.5) bleed_text = "lightly." - if(1 to 2) + if(0.5 to 1) bleed_text = "moderately." - if(2 to 3) + if(1 to 1.5) bleed_text = "heavily!" else bleed_text = "significantly!!" diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 47fc5bd82ecb..a25025294497 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -38,6 +38,8 @@ if (QDELETED(src)) // diseases can qdel the mob via transformations return + SEND_SIGNAL(src, COMSIG_MOB_LIFE) + if(stat != DEAD) //Random events (vomiting etc) handle_random_events() diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index b35d1482ae81..6e7989572ef0 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -766,8 +766,8 @@ /datum/reagent/toxin/heparin/on_mob_life(mob/living/carbon/M) if(ishuman(M)) var/mob/living/carbon/human/H = M - var/obj/item/bodypart/BP = pick(H.get_bleeding_parts()) - BP.bleeding *= 1.1 + for(var/obj/item/bodypart/BP in H.get_bleeding_parts()) + BP.adjust_bleeding(BP.bleeding * 0.1) H.adjustBruteLoss(1, 0) //Brute damage increases with the amount they're bleeding . = 1 return ..() || . diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index df4927188965..9b20f4a431c9 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -54,14 +54,12 @@ var/bleed_threshold = 10 /// Threshold at which the limb will start bleeding if damaged by blunt items var/bleed_threshold_blunt = 40 - /// Minimum damage of an incoming attack to cause bleeding + /// Minimum damage of an incoming attack for it to cause bleeding var/bleed_damage_min = 5 - /// Minimum damage of an incoming blunt attack to cause bleeding + /// Minimum damage of an incoming blunt attack for it to cause bleeding var/bleed_damage_min_blunt = 10 /// Current limb bleeding, increased when the limb takes brute damage over certain thresholds, decreased through bandages and cauterization var/bleeding = 0 - /// Currently applied bandage, used for healing - var/obj/item/stack/medical/gauze/dressing = null /// So we know if we need to scream if this limb hits max damage var/last_maxed @@ -214,8 +212,6 @@ if(stamina_dam > DAMAGE_PRECISION && owner.stam_regen_start_time <= world.time) //DO NOT update health here, it'll be done in the carbon's life. heal_damage(0, 0, INFINITY, null, FALSE) . |= BODYPART_LIFE_UPDATE_HEALTH - if(dressing) - heal_damage(dressing.healing_rate, dressing.healing_rate, required_status = BODYTYPE_ORGANIC, updating_health = FALSE) //Applies brute and burn damage to the organ. Returns 1 if the damage-icon states changed at all. @@ -250,6 +246,10 @@ if((brute_dam > bone_break_threshold) && prob(brute_dam + break_modifier)) break_bone() + // Bleeding is applied here + if((sharpness && brute_dam+brute > bleed_threshold && brute > bleed_damage_min) || (brute_dam+brute > bleed_threshold_blunt && brute > bleed_damage_min_blunt)) + adjust_bleeding(brute/max_damage) + var/can_inflict = max_damage - get_damage() if(can_inflict <= 0) return FALSE @@ -263,10 +263,6 @@ brute_dam += brute burn_dam += burn - // Bleeding is applied here - if((sharpness && brute_dam > bleed_threshold && brute > bleed_damage_min) || (brute_dam > bleed_threshold_blunt && brute > bleed_damage_min_blunt)) - bleeding += brute_dam/max_damage - //We've dealt the physical damages, if there's room lets apply the stamina damage. if(stamina) set_stamina_dam(stamina_dam + round(clamp(stamina, 0, max_stamina_damage - stamina_dam), DAMAGE_PRECISION)) @@ -293,6 +289,7 @@ if(brute) set_brute_dam(round(max(brute_dam - brute, 0), DAMAGE_PRECISION)) + adjust_bleeding(brute/max_damage, BLOOD_LOSS_DAMAGE_CAP) if(burn) set_burn_dam(round(max(burn_dam - burn, 0), DAMAGE_PRECISION)) if(stamina) @@ -334,6 +331,11 @@ . = stamina_dam stamina_dam = new_value +/// Adjusts bodypart bleeding, value = amount of change, maximum = maximum current bloodloss amount this can modify +/obj/item/bodypart/proc/adjust_bleeding(value, maximum = BLOOD_LOSS_MAXIMUM) + if(bleeding > maximum) + return + bleeding = round(clamp(bleeding+value, 0, maximum), 0.01) //Returns total damage. /obj/item/bodypart/proc/get_damage(include_stamina = FALSE) diff --git a/shiptest.dme b/shiptest.dme index bb107a1f00f2..7c33acd2d605 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -451,6 +451,7 @@ #include "code\datums\components\anti_magic.dm" #include "code\datums\components\armor_plate.dm" #include "code\datums\components\art.dm" +#include "code\datums\components\bandage.dm" #include "code\datums\components\bane.dm" #include "code\datums\components\beetlejuice.dm" #include "code\datums\components\bloodysoles.dm" From d98ca6032fd776a85880ce50a8239070949b2d1d Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Fri, 22 Mar 2024 21:03:07 -0400 Subject: [PATCH 05/29] scrapping --- code/datums/components/bandage.dm | 4 ++-- code/game/objects/items/stacks/medical.dm | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/datums/components/bandage.dm b/code/datums/components/bandage.dm index 913c3f166828..fd3224fc958f 100644 --- a/code/datums/components/bandage.dm +++ b/code/datums/components/bandage.dm @@ -44,14 +44,14 @@ cleanliness -- if(heal_target.bleeding) cleanliness = round(cleanliness - max(heal_target.bleeding, 1)) - heal_target.adjust_bleeding(actual_heal_speed) + heal_target.adjust_bleeding(-actual_heal_speed) if(cleanliness <= 0 || (!heal_target.bleeding && !heal_target.get_damage())) drop_bandage() /datum/component/bandage/proc/drop_bandage() if(trash_item) - new trash_item(get_turf(parent)) + new trash_item(get_turf(mummy)) mummy.visible_message(span_notice("The [bandage_name] on [mummy]'s [parent] falls to the floor."), span_notice("The [bandage_name] on your [parent] falls to the floor.")) else to_chat(mummy, span_notice("The [bandage_name] on your [parent] has healed what it can.")) diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index a906b8fb1256..34515a888ed9 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -162,13 +162,13 @@ to_chat(user, span_warning("[C] doesn't have \a [parse_zone(user.zone_selected)]!")) return if(!BP.get_damage() && !BP.bleeding) - to_chat(user, span_warning("[C]'s [BP] is already fully healed!")) + to_chat(user, span_warning("[C]'s [parse_zone(BP.body_zone)] is already fully healed!")) return if(BP.GetComponent(/datum/component/bandage)) - to_chat(user, span_warning("[C] is already bandaged!")) + to_chat(user, span_warning("[C] is already being treated!")) return - BP.AddComponent( /datum/component/bandage, healing_rate, lifespan, "gauze") - user.visible_message(span_notice("[user] wraps [C]'s [BP] with [src]."), span_notice("You wrap [C]'s [BP] with [src]."), span_hear("You hear ruffling cloth.")) + BP.AddComponent(/datum/component/bandage, healing_rate, lifespan, "gauze") + user.visible_message(span_notice("[user] wraps [C]'s [parse_zone(BP.body_zone)] with [src]."), span_notice("You wrap [C]'s [parse_zone(check_zone(user.zone_selected))] with [src]."), span_hear("You hear ruffling cloth.")) return TRUE /obj/item/stack/medical/gauze/attackby(obj/item/I, mob/user, params) From 67d2c3d476f63f2839b94b7ece1af127c003ed39 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Fri, 22 Mar 2024 21:03:50 -0400 Subject: [PATCH 06/29] starting on new structure --- code/datums/components/bandage.dm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/code/datums/components/bandage.dm b/code/datums/components/bandage.dm index fd3224fc958f..911287b55b6d 100644 --- a/code/datums/components/bandage.dm +++ b/code/datums/components/bandage.dm @@ -1,3 +1,21 @@ +/datum/healing_surface + // What this is referred to in player-facing terms, can be a combination + var/name = "scab" + /// Layer this applies stuff to, higher layers will impede interacting with lower layers + var/layer + /// List of items this will drop when healing is finished + var/list/trash_items = list() + /// Amount of healing this directs to brute damage + var/brute_coeff = 0 + /// Amount of healing this directs to burn damage + var/burn_coeff = 0 + +/datum/healing_surface/ + + + + + #define BANDAGE_DAMAGE_COEFF 5 /datum/component/bandage From dd6dfd1e839668644030bdaa5d2014e56737f8dd Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Sun, 7 Apr 2024 00:38:24 -0400 Subject: [PATCH 07/29] fix --- code/modules/surgery/bodyparts/bodyparts.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 9b20f4a431c9..356e852358f2 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -289,7 +289,7 @@ if(brute) set_brute_dam(round(max(brute_dam - brute, 0), DAMAGE_PRECISION)) - adjust_bleeding(brute/max_damage, BLOOD_LOSS_DAMAGE_CAP) + adjust_bleeding(-brute/max_damage, BLOOD_LOSS_DAMAGE_CAP) if(burn) set_burn_dam(round(max(burn_dam - burn, 0), DAMAGE_PRECISION)) if(stamina) From 15fbb4b3da291024c4724ab46cb1564f5e8dde6c Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 29 Apr 2024 18:19:39 -0400 Subject: [PATCH 08/29] Standardized proc start, tape handling, better examine stuff & surgery bleeding bits --- code/datums/components/bandage.dm | 44 ++++++------------- code/game/machinery/medical_kiosk.dm | 2 +- code/game/objects/items/stacks/medical.dm | 12 ++--- code/game/objects/items/stacks/tape.dm | 23 +++++----- .../modules/mob/living/carbon/damage_procs.dm | 7 +++ .../mob/living/carbon/human/examine.dm | 30 +++++-------- .../mob/living/carbon/human/human_defense.dm | 2 +- code/modules/surgery/bodyparts/bodyparts.dm | 11 +++++ code/modules/surgery/coronary_bypass.dm | 9 ++-- code/modules/surgery/organic_steps.dm | 9 ++-- code/modules/surgery/surgery_helpers.dm | 3 +- 11 files changed, 73 insertions(+), 79 deletions(-) diff --git a/code/datums/components/bandage.dm b/code/datums/components/bandage.dm index 911287b55b6d..99ff77368d04 100644 --- a/code/datums/components/bandage.dm +++ b/code/datums/components/bandage.dm @@ -1,35 +1,17 @@ -/datum/healing_surface - // What this is referred to in player-facing terms, can be a combination - var/name = "scab" - /// Layer this applies stuff to, higher layers will impede interacting with lower layers - var/layer - /// List of items this will drop when healing is finished - var/list/trash_items = list() - /// Amount of healing this directs to brute damage - var/brute_coeff = 0 - /// Amount of healing this directs to burn damage - var/burn_coeff = 0 - -/datum/healing_surface/ - - - - - #define BANDAGE_DAMAGE_COEFF 5 /datum/component/bandage /// How much damage do we heal? var/healing_speed = 0.2 /// How many healing ticks will this bandage apply? Reduced by incoming damage and other nasties - var/cleanliness = 300 + var/durability = 300 /// What is dropped when the bandage is removed? - var/trash_item = /obj/effect/decal/cleanable/wrapping - var/bandage_name = "bandage" - ///a + var/trash_item = null + var/bandage_name = "gauze" + /// The person this bandage is applied to var/mob/living/mummy -/datum/component/bandage/Initialize(_healing_speed, _cleanliness, _bandage_name, _trash_item) +/datum/component/bandage/Initialize(_healing_speed, _durability, _bandage_name, _trash_item) if(!istype(parent, /obj/item/bodypart)) return COMPONENT_INCOMPATIBLE var/obj/item/bodypart/BP = parent @@ -38,8 +20,8 @@ return COMPONENT_INCOMPATIBLE if(_healing_speed) healing_speed = _healing_speed - if(_cleanliness) - cleanliness = _cleanliness + if(_durability) + durability = _durability if(_bandage_name) bandage_name = _bandage_name if(_trash_item) @@ -50,8 +32,8 @@ /datum/component/bandage/proc/check_damage(damage, damagetype = BRUTE, def_zone = null) if(parent != mummy.get_bodypart(check_zone(def_zone))) return - cleanliness = cleanliness - damage * BANDAGE_DAMAGE_COEFF - if(cleanliness <= 0) + durability = durability - damage * BANDAGE_DAMAGE_COEFF + if(durability <= 0) drop_bandage() @@ -59,11 +41,11 @@ var/obj/item/bodypart/heal_target = parent var/actual_heal_speed = healing_speed //TODO: add modifiers to this (scope 2) heal_target.heal_damage(actual_heal_speed, actual_heal_speed) - cleanliness -- + durability-- if(heal_target.bleeding) - cleanliness = round(cleanliness - max(heal_target.bleeding, 1)) + durability = round(durability - max(heal_target.bleeding, 1)) heal_target.adjust_bleeding(-actual_heal_speed) - if(cleanliness <= 0 || (!heal_target.bleeding && !heal_target.get_damage())) + if(durability <= 0 || (!heal_target.bleeding && !heal_target.get_damage())) drop_bandage() /datum/component/bandage/proc/drop_bandage() @@ -74,3 +56,5 @@ else to_chat(mummy, span_notice("The [bandage_name] on your [parent] has healed what it can.")) qdel(src) + +#undef BANDAGE_DAMAGE_COEFF diff --git a/code/game/machinery/medical_kiosk.dm b/code/game/machinery/medical_kiosk.dm index d7be7fea98ee..7c282849ee64 100644 --- a/code/game/machinery/medical_kiosk.dm +++ b/code/game/machinery/medical_kiosk.dm @@ -170,7 +170,7 @@ sickness_data = "\nName: [D.name].\nType: [D.spread_text].\nStage: [D.stage]/[D.max_stages].\nPossible Cure: [D.cure_text]" if(altPatient.has_dna()) //Blood levels Information - if(altPatient.bleed_rate) + if(LAZYLEN(altPatient.get_bleeding_parts())) bleed_status = "Patient is currently bleeding!" if(blood_percent <= 80) blood_warning = " Patient has low blood levels. Seek a large meal, or iron supplements." diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 45b9a3751866..4745a8c06369 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -161,15 +161,9 @@ if(!BP) to_chat(user, span_warning("[C] doesn't have \a [parse_zone(user.zone_selected)]!")) return - if(!BP.get_damage() && !BP.bleeding) - to_chat(user, span_warning("[C]'s [parse_zone(BP.body_zone)] is already fully healed!")) - return - if(BP.GetComponent(/datum/component/bandage)) - to_chat(user, span_warning("[C] is already being treated!")) - return - BP.AddComponent(/datum/component/bandage, healing_rate, lifespan, "gauze") - user.visible_message(span_notice("[user] wraps [C]'s [parse_zone(BP.body_zone)] with [src]."), span_notice("You wrap [C]'s [parse_zone(check_zone(user.zone_selected))] with [src]."), span_hear("You hear ruffling cloth.")) - return TRUE + if(BP.apply_dressing(healing_rate, lifespan, "gauze", user)) + user.visible_message(span_notice("[user] wraps [C]'s [parse_zone(BP.body_zone)] with [src]."), span_notice("You wrap [C]'s [parse_zone(check_zone(user.zone_selected))] with [src]."), span_hear("You hear ruffling cloth.")) + return TRUE /obj/item/stack/medical/gauze/attackby(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WIRECUTTER || I.get_sharpness()) diff --git a/code/game/objects/items/stacks/tape.dm b/code/game/objects/items/stacks/tape.dm index d22b1be85344..57f7a9b792de 100644 --- a/code/game/objects/items/stacks/tape.dm +++ b/code/game/objects/items/stacks/tape.dm @@ -80,7 +80,8 @@ grind_results = list(/datum/reagent/cellulose = 5) usesound = 'sound/items/tape.ogg' - var/stop_bleed = 600 + var/lifespan = 600 + var/healing_rate = 0.1 var/nonorganic_heal = 5 var/self_delay = 30 //! Also used for the tapecuff delay var/other_delay = 10 @@ -173,15 +174,11 @@ if(!affecting) //Missing limb? to_chat(user, "[C] doesn't have \a [parse_zone(user.zone_selected)]!") return - if(!IS_ORGANIC_LIMB(affecting)) - if(ishuman(C)) - var/mob/living/carbon/human/H = C - if(!H.bleedsuppress && H.bleed_rate) - H.suppress_bloodloss(stop_bleed) - to_chat(user, "You tape up the bleeding of [C]!") - return TRUE - to_chat(user, "[C] has a problem \the [src] won't fix!") - else //Robotic patch-up + if(ishuman(C)) + if(affecting.apply_dressing(healing_rate, lifespan, name, user)) + to_chat(user, "You tape up [C]'s [parse_zone(affecting.body_zone)]!") + return TRUE + if(IS_ROBOTIC_LIMB(affecting)) //Robotic patch-up if(affecting.brute_dam) user.visible_message("[user] applies \the [src] on [C]'s [affecting.name].", "You apply \the [src] on [C]'s [affecting.name].") if(affecting.heal_damage(nonorganic_heal)) @@ -272,7 +269,7 @@ desc = "This roll of silver sorcery can fix just about anything." icon_state = "tape_d" - stop_bleed = 800 + lifespan = 800 nonorganic_heal = 20 prefix = "super sticky" conferred_embed = EMBED_HARMLESS_SUPERIOR @@ -297,7 +294,7 @@ desc = "Specialty insulated strips of adhesive plastic. Made for securing cables." icon_state = "tape_e" - stop_bleed = 400 + lifespan = 400 nonorganic_heal = 10 prefix = "insulated sticky" siemens_coefficient = 0 @@ -321,6 +318,6 @@ desc = "Now THIS is engineering." icon_state = "tape_y" - stop_bleed = 1000 + lifespan = 1000 nonorganic_heal = 30 prefix = "industry-standard sticky" diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index d298f80aee09..0f2749db2104 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -275,3 +275,10 @@ if(BP.bleeding) parts += BP return parts + +/mob/living/carbon/proc/get_bandaged_parts() + var/list/obj/item/bodypart/parts = list() + for(var/obj/item/bodypart/BP as anything in bodyparts) + if(BP.GetComponent(/datum/component/bandage)) + parts += BP + return parts diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 9a8a0c9f2d61..d32997215032 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -244,24 +244,18 @@ msg += "[t_He] [t_has] pale skin.\n" + if(LAZYLEN(get_bandaged_parts())) + . += "[t_He] [t_is] bandaged with something.\n" + var/list/obj/item/bodypart/bleed_check = get_bleeding_parts() if(LAZYLEN(bleed_check)) if(reagents.has_reagent(/datum/reagent/toxin/heparin, needs_metabolizing = TRUE)) msg += "[t_He] [t_is] bleeding uncontrollably!\n" - else - var/bleed_msg = "[t_He] [t_is] bandaged with something.\n" + else for(var/obj/item/bodypart/BP in bleed_check) - //if(!BP.dressing) - //bleed_msg = "[t_He] [t_is] bleeding!\n" - //break - msg += bleed_msg - /*if(bleedsuppress) - msg += "[t_He] [t_is] bandaged with something.\n" - else if(bleed_rate || LAZYLEN(get_bleeding_parts())) - if(reagents.has_reagent(/datum/reagent/toxin/heparin, needs_metabolizing = TRUE)) - msg += "[t_He] [t_is] bleeding uncontrollably!\n" - else - msg += "[t_He] [t_is] bleeding!\n"*/ + if(!BP.GetComponent(/datum/component/bandage)) + . += "[t_He] [t_is] bleeding!\n" + break if(reagents.has_reagent(/datum/reagent/teslium, needs_metabolizing = TRUE)) msg += "[t_He] [t_is] emitting a gentle blue glow!\n" @@ -412,12 +406,12 @@ /mob/living/carbon/human/examine_more(mob/user) . = ..() - for(var/obj/item/bodypart/BP as anything in bodyparts) + for(var/obj/item/bodypart/BP as anything in get_bandaged_parts()) + var/datum/component/bandage/B = BP.GetComponent(/datum/component/bandage) + . += span_notice("Their [BP] is dressed with [B.bandage_name]") + for(var/obj/item/bodypart/BP as anything in get_bleeding_parts()) var/bleed_text - //if(BP.dressing) - //. += span_notice("Their [BP] is dressed with [BP.dressing.name]") - //continue - if(!BP.bleeding) + if(BP.GetComponent(/datum/component/bandage)) continue switch(BP.bleeding) if(0 to 0.5) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 123ecf6d4fba..e8034dcf13f0 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -778,7 +778,7 @@ for(var/t in missing) combined_msg += "Your [parse_zone(t)] is missing!" - if(bleed_rate) + if(LAZYLEN(get_bleeding_parts())) combined_msg += "You are bleeding!" if(getStaminaLoss()) if(getStaminaLoss() > 30) diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 356e852358f2..00b401be4b69 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -337,6 +337,17 @@ return bleeding = round(clamp(bleeding+value, 0, maximum), 0.01) +/obj/item/bodypart/proc/apply_dressing(heal_amt, lifespan, bandage_name, user) + if(is_pseudopart) + return FALSE + if(!get_damage() && !bleeding) + to_chat(user, span_warning("[owner]'s [parse_zone(body_zone)] is already fully healed!")) + return FALSE + if(GetComponent(/datum/component/bandage)) + to_chat(user, span_warning("[owner]'s [parse_zone(body_zone)] has already been dressed!")) + return FALSE + return AddComponent(/datum/component/bandage, heal_amt, lifespan, bandage_name) + //Returns total damage. /obj/item/bodypart/proc/get_damage(include_stamina = FALSE) var/total = brute_dam + burn_dam diff --git a/code/modules/surgery/coronary_bypass.dm b/code/modules/surgery/coronary_bypass.dm index 4c416c31c633..a4628d19efff 100644 --- a/code/modules/surgery/coronary_bypass.dm +++ b/code/modules/surgery/coronary_bypass.dm @@ -41,7 +41,8 @@ display_results(user, target, "Blood pools around the incision in [H]'s heart.", "Blood pools around the incision in [H]'s heart.", "") - H.bleed_rate += 10 + var/obj/item/bodypart/BP = H.get_bodypart(check_zone(surgery.location)) + BP.adjust_bleeding(10) target.apply_damage(15, BRUTE, "[target_zone]") return ..() @@ -51,7 +52,8 @@ display_results(user, target, "You screw up, cutting too deeply into the heart!", "[user] screws up, causing blood to spurt out of [H]'s chest!", "[user] screws up, causing blood to spurt out of [H]'s chest!") - H.bleed_rate += 20 + var/obj/item/bodypart/BP = H.get_bodypart(check_zone(surgery.location)) + BP.adjust_bleeding(20) H.adjustOrganLoss(ORGAN_SLOT_HEART, 10) target.apply_damage(15, BRUTE, "[target_zone]") @@ -90,5 +92,6 @@ "[user] screws up, causing blood to spurt out of [H]'s chest profusely!", "[user] screws up, causing blood to spurt out of [H]'s chest profusely!") H.adjustOrganLoss(ORGAN_SLOT_HEART, 30) - H.bleed_rate += 30 + var/obj/item/bodypart/BP = H.get_bodypart(check_zone(surgery.location)) + BP.adjust_bleeding(30) return FALSE diff --git a/code/modules/surgery/organic_steps.dm b/code/modules/surgery/organic_steps.dm index 5167bb3a4517..da05176a2a7c 100644 --- a/code/modules/surgery/organic_steps.dm +++ b/code/modules/surgery/organic_steps.dm @@ -30,7 +30,8 @@ display_results(user, target, "Blood pools around the incision in [H]'s [parse_zone(target_zone)].", "Blood pools around the incision in [H]'s [parse_zone(target_zone)].", "") - H.bleed_rate += 3 + var/obj/item/bodypart/BP = H.get_bodypart(check_zone(surgery.location)) + BP.adjust_bleeding(3) return ..() /datum/surgery_step/incise/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) @@ -74,7 +75,8 @@ target.heal_bodypart_damage(20,0) if (ishuman(target)) var/mob/living/carbon/human/H = target - H.bleed_rate = max((H.bleed_rate - 3), 0) + var/obj/item/bodypart/BP = H.get_bodypart(check_zone(surgery.location)) + BP.adjust_bleeding(-3) return ..() /datum/surgery_step/clamp_bleeders/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) @@ -137,7 +139,8 @@ target.heal_bodypart_damage(15,0) if (ishuman(target)) var/mob/living/carbon/human/H = target - H.bleed_rate = max((H.bleed_rate - 3), 0) + var/obj/item/bodypart/BP = H.get_bodypart(check_zone(surgery.location)) + BP.adjust_bleeding(-3) return ..() //saw bone diff --git a/code/modules/surgery/surgery_helpers.dm b/code/modules/surgery/surgery_helpers.dm index c4a769c43ed5..709975ecd518 100644 --- a/code/modules/surgery/surgery_helpers.dm +++ b/code/modules/surgery/surgery_helpers.dm @@ -115,7 +115,8 @@ if(ishuman(M)) var/mob/living/carbon/human/H = M - H.bleed_rate = max((H.bleed_rate - 3), 0) + var/obj/item/bodypart/BP = H.get_bodypart(check_zone(S.location)) + BP.adjust_bleeding(-3) M.surgeries -= S user.visible_message("[user] closes [M]'s [parse_zone(selected_zone)] with [close_tool] and stops the surgery.", \ "You close [M]'s [parse_zone(selected_zone)] with [close_tool] and stop the surgery.") From 47f32070082b3ce62cc327d01acf877baff0696b Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 29 Apr 2024 21:14:27 -0400 Subject: [PATCH 09/29] Mess cleaning --- code/datums/components/bandage.dm | 2 +- code/datums/components/butchering.dm | 8 +++++++- code/datums/status_effects/debuffs.dm | 3 ++- code/game/objects/items/stacks/tape.dm | 10 +++++----- code/modules/surgery/bodyparts/bodyparts.dm | 5 +++-- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/code/datums/components/bandage.dm b/code/datums/components/bandage.dm index 99ff77368d04..563ec6a7a1ed 100644 --- a/code/datums/components/bandage.dm +++ b/code/datums/components/bandage.dm @@ -54,7 +54,7 @@ new trash_item(get_turf(mummy)) mummy.visible_message(span_notice("The [bandage_name] on [mummy]'s [parent] falls to the floor."), span_notice("The [bandage_name] on your [parent] falls to the floor.")) else - to_chat(mummy, span_notice("The [bandage_name] on your [parent] has healed what it can.")) + to_chat(mummy, span_notice("The [bandage_name] on your [parent] finished healing.")) qdel(src) #undef BANDAGE_DAMAGE_COEFF diff --git a/code/datums/components/butchering.dm b/code/datums/components/butchering.dm index 710921d6ef14..a79083f1a318 100644 --- a/code/datums/components/butchering.dm +++ b/code/datums/components/butchering.dm @@ -69,11 +69,17 @@ "Their neck has already been already cut, you can't make the bleeding any worse!") return + var/obj/item/bodypart/throat_in_question = H.get_bodypart(BODY_ZONE_HEAD) + if(!throat_in_question) + user.show_message("[H]... doesn't have a neck.", MSG_VISUAL, \ + "They don't seem to have a neck to cut.") + return + H.visible_message("[user] slits [H]'s throat!", \ "[user] slits your throat...") log_combat(user, H, "finishes slicing the throat of") H.apply_damage(source.force, BRUTE, BODY_ZONE_HEAD) - var/obj/item/bodypart/throat_in_question = H.get_bodypart(BODY_ZONE_HEAD) + throat_in_question.adjust_bleeding(20) H.apply_status_effect(/datum/status_effect/neck_slice) diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index 52087f03174c..86b2f85198f2 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -334,7 +334,8 @@ /datum/status_effect/neck_slice/tick() var/mob/living/carbon/human/H = owner - if(H.stat == DEAD || H.bleed_rate <= 8) + var/obj/item/bodypart/throat_in_question = H.get_bodypart(BODY_ZONE_HEAD) + if(H.stat == DEAD || throat_in_question?.bleeding <= 8) H.remove_status_effect(/datum/status_effect/neck_slice) if(prob(10)) H.emote(pick("gasp", "gag", "choke")) diff --git a/code/game/objects/items/stacks/tape.dm b/code/game/objects/items/stacks/tape.dm index 57f7a9b792de..841c4ff6f522 100644 --- a/code/game/objects/items/stacks/tape.dm +++ b/code/game/objects/items/stacks/tape.dm @@ -174,17 +174,17 @@ if(!affecting) //Missing limb? to_chat(user, "[C] doesn't have \a [parse_zone(user.zone_selected)]!") return - if(ishuman(C)) - if(affecting.apply_dressing(healing_rate, lifespan, name, user)) - to_chat(user, "You tape up [C]'s [parse_zone(affecting.body_zone)]!") - return TRUE if(IS_ROBOTIC_LIMB(affecting)) //Robotic patch-up if(affecting.brute_dam) user.visible_message("[user] applies \the [src] on [C]'s [affecting.name].", "You apply \the [src] on [C]'s [affecting.name].") if(affecting.heal_damage(nonorganic_heal)) C.update_damage_overlays() return TRUE - to_chat(user, "[src] can't patch what [C] has...") + if(affecting.can_bandage(user)) + affecting.AddComponent(/datum/component/bandage, healing_rate, lifespan, bandage_name) + to_chat(user, "You tape up [C]'s [parse_zone(affecting.body_zone)]!") + return TRUE + to_chat(user, "[src] can't patch what [C] has...") /obj/item/stack/tape/proc/apply_gag(mob/living/carbon/target, mob/user) if(target.is_muzzled() || target.is_mouth_covered()) diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 00b401be4b69..36be4357ca5f 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -337,7 +337,8 @@ return bleeding = round(clamp(bleeding+value, 0, maximum), 0.01) -/obj/item/bodypart/proc/apply_dressing(heal_amt, lifespan, bandage_name, user) +/obj/item/bodypart/proc/can_bandage(user) + . = TRUE if(is_pseudopart) return FALSE if(!get_damage() && !bleeding) @@ -346,7 +347,7 @@ if(GetComponent(/datum/component/bandage)) to_chat(user, span_warning("[owner]'s [parse_zone(body_zone)] has already been dressed!")) return FALSE - return AddComponent(/datum/component/bandage, heal_amt, lifespan, bandage_name) + return //Returns total damage. /obj/item/bodypart/proc/get_damage(include_stamina = FALSE) From 52a5c8b218b36cccfb3004af123fd2814d426c5c Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 29 Apr 2024 21:16:30 -0400 Subject: [PATCH 10/29] cleaning --- code/game/objects/items/stacks/medical.dm | 3 ++- code/game/objects/items/stacks/tape.dm | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 4745a8c06369..4d0f2d2af036 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -161,7 +161,8 @@ if(!BP) to_chat(user, span_warning("[C] doesn't have \a [parse_zone(user.zone_selected)]!")) return - if(BP.apply_dressing(healing_rate, lifespan, "gauze", user)) + if(BP.can_bandage(user)) + AddComponent(/datum/component/bandage, healing_rate, lifespan, "gauze") user.visible_message(span_notice("[user] wraps [C]'s [parse_zone(BP.body_zone)] with [src]."), span_notice("You wrap [C]'s [parse_zone(check_zone(user.zone_selected))] with [src]."), span_hear("You hear ruffling cloth.")) return TRUE diff --git a/code/game/objects/items/stacks/tape.dm b/code/game/objects/items/stacks/tape.dm index 841c4ff6f522..b64657d960b0 100644 --- a/code/game/objects/items/stacks/tape.dm +++ b/code/game/objects/items/stacks/tape.dm @@ -181,7 +181,7 @@ C.update_damage_overlays() return TRUE if(affecting.can_bandage(user)) - affecting.AddComponent(/datum/component/bandage, healing_rate, lifespan, bandage_name) + affecting.AddComponent(/datum/component/bandage, healing_rate, lifespan, name) to_chat(user, "You tape up [C]'s [parse_zone(affecting.body_zone)]!") return TRUE to_chat(user, "[src] can't patch what [C] has...") From 4d4b34c69bfa7643346098035e97fef6cce77540 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Thu, 2 May 2024 20:21:48 -0400 Subject: [PATCH 11/29] Moves all bleeding stuff to new system, general damage procs, making everything infinitely better, seperating bandage bleed suppression from healing --- code/datums/components/bandage.dm | 8 ++-- .../diseases/advance/symptoms/flesh_eating.dm | 2 +- code/game/objects/items/stacks/medical.dm | 2 +- .../objects/structures/petrified_statue.dm | 5 +- code/modules/mob/living/blood.dm | 9 ++-- .../modules/mob/living/carbon/damage_procs.dm | 48 +++++++++++++++++-- .../mob/living/carbon/human/examine.dm | 20 ++++---- .../mob/living/carbon/human/human_defines.dm | 2 +- code/modules/mob/living/living.dm | 2 +- code/modules/mob/living/living_defense.dm | 2 +- .../simple_animal/hostile/cat_butcher.dm | 4 +- .../chemistry/reagents/medicine_reagents.dm | 4 +- .../chemistry/reagents/trickwine_reagents.dm | 2 +- code/modules/surgery/bodyparts/bodyparts.dm | 7 +-- code/modules/surgery/organs/vocal_cords.dm | 2 +- 15 files changed, 81 insertions(+), 38 deletions(-) diff --git a/code/datums/components/bandage.dm b/code/datums/components/bandage.dm index 563ec6a7a1ed..6f4bca2f4111 100644 --- a/code/datums/components/bandage.dm +++ b/code/datums/components/bandage.dm @@ -3,6 +3,8 @@ /datum/component/bandage /// How much damage do we heal? var/healing_speed = 0.2 + /// How fast do we stop bleeding? + var/bleed_reduction = 0.2 /// How many healing ticks will this bandage apply? Reduced by incoming damage and other nasties var/durability = 300 /// What is dropped when the bandage is removed? @@ -44,15 +46,15 @@ durability-- if(heal_target.bleeding) durability = round(durability - max(heal_target.bleeding, 1)) - heal_target.adjust_bleeding(-actual_heal_speed) + heal_target.adjust_bleeding(-bleed_reduction) if(durability <= 0 || (!heal_target.bleeding && !heal_target.get_damage())) drop_bandage() /datum/component/bandage/proc/drop_bandage() - + var/obj/item/bodypart/BP = parent if(trash_item) new trash_item(get_turf(mummy)) - mummy.visible_message(span_notice("The [bandage_name] on [mummy]'s [parent] falls to the floor."), span_notice("The [bandage_name] on your [parent] falls to the floor.")) + mummy.visible_message(span_notice("The [bandage_name] on [mummy]'s [parse_zone(BP.body_zone)] falls to the floor."), span_notice("The [bandage_name] on your [parse_zone(BP.body_zone)] falls to the floor.")) else to_chat(mummy, span_notice("The [bandage_name] on your [parent] finished healing.")) qdel(src) diff --git a/code/datums/diseases/advance/symptoms/flesh_eating.dm b/code/datums/diseases/advance/symptoms/flesh_eating.dm index f6cd5698d73d..5f18f6c78a91 100644 --- a/code/datums/diseases/advance/symptoms/flesh_eating.dm +++ b/code/datums/diseases/advance/symptoms/flesh_eating.dm @@ -63,7 +63,7 @@ Bonus if(bleed) if(ishuman(M)) var/mob/living/carbon/human/H = M - H.bleed_rate += 5 * power + H.cause_bleeding(5 * power) return 1 /* diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 4d0f2d2af036..efb3fb6e38ca 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -162,7 +162,7 @@ to_chat(user, span_warning("[C] doesn't have \a [parse_zone(user.zone_selected)]!")) return if(BP.can_bandage(user)) - AddComponent(/datum/component/bandage, healing_rate, lifespan, "gauze") + BP.AddComponent(/datum/component/bandage, healing_rate, lifespan, "gauze") user.visible_message(span_notice("[user] wraps [C]'s [parse_zone(BP.body_zone)] with [src]."), span_notice("You wrap [C]'s [parse_zone(check_zone(user.zone_selected))] with [src]."), span_hear("You hear ruffling cloth.")) return TRUE diff --git a/code/game/objects/structures/petrified_statue.dm b/code/game/objects/structures/petrified_statue.dm index c8b804469255..1be0a2517bd6 100644 --- a/code/game/objects/structures/petrified_statue.dm +++ b/code/game/objects/structures/petrified_statue.dm @@ -58,6 +58,9 @@ if(petrified_mob) petrified_mob.status_flags &= ~GODMODE + if(ishuman(petrified_mob)) + var/mob/living/carbon/human/H = petrified_mob + H.bleedsuppress = FALSE petrified_mob.forceMove(loc) REMOVE_TRAIT(petrified_mob, TRAIT_MUTE, STATUE_MUTE) petrified_mob.take_overall_damage((petrified_mob.health - obj_integrity + 100)) //any new damage the statue incurred is transfered to the mob @@ -80,7 +83,7 @@ return 0 var/obj/structure/statue/petrified/S = new(loc, src, statue_timer) S.name = "statue of [name]" - bleedsuppress = 1 + bleedsuppress = TRUE S.copy_overlays(src) var/newcolor = list(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) S.add_atom_colour(newcolor, FIXED_COLOUR_PRIORITY) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index db5d16c9c84a..d65e21a5910b 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -4,7 +4,7 @@ BLOOD SYSTEM ****************************************************/ -/mob/living/carbon/human/proc/suppress_bloodloss(amount) +/*mob/living/carbon/human/proc/suppress_bloodloss(amount) //KILLING these if(bleedsuppress) return else @@ -12,9 +12,8 @@ addtimer(CALLBACK(src, PROC_REF(resume_bleeding)), amount) /mob/living/carbon/human/proc/resume_bleeding() - bleedsuppress = 0 if(stat != DEAD && bleed_rate) - to_chat(src, "The blood soaks through your bandage.") + to_chat(src, "The blood soaks through your bandage.")*/ /mob/living/carbon/monkey/handle_blood() @@ -97,7 +96,7 @@ if(!embeddies.isEmbedHarmless()) temp_bleed += 0.5 - bleed_rate = max(bleed_rate - 0.5, temp_bleed)//if no wounds, other bleed effects (heparin) naturally decreases + bleed_rate = max(bleed_rate - 0.5, temp_bleed)//if no wounds, other bleed effects naturally decrease if((bleed_rate || limb_bleed) && !bleedsuppress && !(HAS_TRAIT(src, TRAIT_FAKEDEATH))) bleed(bleed_rate + limb_bleed) @@ -125,7 +124,7 @@ /mob/living/carbon/human/restore_blood() blood_volume = BLOOD_VOLUME_NORMAL - for(var/obj/item/bodypart/BP as anything in bodyparts) + for(var/obj/item/bodypart/BP as anything in get_bleeding_parts()) BP.bleeding = 0 bleed_rate = 0 diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index 0f2749db2104..333af2964b04 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -268,17 +268,59 @@ update_damage_overlays() update_stamina() -/// Gets a list of bleeding bodyparts -/mob/living/carbon/proc/get_bleeding_parts() +/// Gets a list of bleeding bodyparts, argument ignore_staunched = are we actively bleeding (no treatment) +/mob/living/carbon/proc/get_bleeding_parts(ignore_staunched = FALSE) var/list/obj/item/bodypart/parts = list() for(var/obj/item/bodypart/BP as anything in bodyparts) - if(BP.bleeding) + if(BP.bleeding && (!ignore_staunched || !BP.GetComponent(/datum/component/bandage))) parts += BP return parts +/// Gets a list of bandaged parts /mob/living/carbon/proc/get_bandaged_parts() var/list/obj/item/bodypart/parts = list() for(var/obj/item/bodypart/BP as anything in bodyparts) if(BP.GetComponent(/datum/component/bandage)) parts += BP return parts + +/// Apply bleeding to one random bodypart. +/mob/living/carbon/proc/cause_bleeding(amt) + var/list/obj/item/bodypart/parts = bodyparts.Copy() + if(!length(parts)) + return + var/obj/item/bodypart/part_in_question = pick(parts) + part_in_question.adjust_bleeding(amt) + +/// Heal bleeding from one random bodypart +/mob/living/carbon/proc/heal_bodypart_bleeding(amt) + var/list/obj/item/bodypart/parts = get_bleeding_parts() + if(!length(parts)) + return + var/obj/item/bodypart/part_in_question = pick(parts) + part_in_question.adjust_bleeding(-amt) + var/bleed_calc = part_in_question.bleeding + return min(bleed_calc - part_in_question.bleeding, 0) + +/// Apply bleeding to all bodyparts +/mob/living/carbon/proc/cause_overall_bleeding(amt) + var/list/obj/item/bodypart/parts = bodyparts.Copy() + while(length(parts)) + var/obj/item/bodypart/part_in_question = pick(parts) + if(part_in_question.is_pseudopart) + parts -= part_in_question + continue + var/amount_to_take = min(part_in_question.bleeding, amt / length(parts)) + part_in_question.adjust_bleeding(amount_to_take) + amt -= amount_to_take + parts -= part_in_question + +/// Heal bleeding from all bodyparts +/mob/living/carbon/proc/heal_overall_bleeding(amt) + var/list/obj/item/bodypart/parts = get_bleeding_parts() + while(length(parts)) + var/obj/item/bodypart/part_in_question = pick(parts) + var/amount_to_take = min(part_in_question.bleeding, amt / length(parts)) + part_in_question.adjust_bleeding(-amount_to_take) + amt -= amount_to_take + parts -= part_in_question diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index d32997215032..822d87b9cca6 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -245,17 +245,15 @@ if(LAZYLEN(get_bandaged_parts())) - . += "[t_He] [t_is] bandaged with something.\n" + msg += "[t_He] [t_is] bandaged with something.\n" - var/list/obj/item/bodypart/bleed_check = get_bleeding_parts() + var/list/obj/item/bodypart/bleed_check = get_bleeding_parts(TRUE) if(LAZYLEN(bleed_check)) if(reagents.has_reagent(/datum/reagent/toxin/heparin, needs_metabolizing = TRUE)) msg += "[t_He] [t_is] bleeding uncontrollably!\n" - else - for(var/obj/item/bodypart/BP in bleed_check) - if(!BP.GetComponent(/datum/component/bandage)) - . += "[t_He] [t_is] bleeding!\n" - break + else + msg += "[t_He] [t_is] bleeding!\n" + if(reagents.has_reagent(/datum/reagent/teslium, needs_metabolizing = TRUE)) msg += "[t_He] [t_is] emitting a gentle blue glow!\n" @@ -408,11 +406,9 @@ . = ..() for(var/obj/item/bodypart/BP as anything in get_bandaged_parts()) var/datum/component/bandage/B = BP.GetComponent(/datum/component/bandage) - . += span_notice("Their [BP] is dressed with [B.bandage_name]") - for(var/obj/item/bodypart/BP as anything in get_bleeding_parts()) + . += span_notice("Their [parse_zone(BP.body_zone)] is dressed with [B.bandage_name]") + for(var/obj/item/bodypart/BP as anything in get_bleeding_parts(TRUE)) var/bleed_text - if(BP.GetComponent(/datum/component/bandage)) - continue switch(BP.bleeding) if(0 to 0.5) bleed_text = "lightly." @@ -422,7 +418,7 @@ bleed_text = "heavily!" else bleed_text = "significantly!!" - . += span_warning("Their [BP] is bleeding [bleed_text]") + . += span_warning("Their [parse_zone(BP.body_zone)] is bleeding [bleed_text]") if ((wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))) return diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 5b638d330690..902cfaddc7df 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -62,7 +62,7 @@ var/special_voice = "" // For changing our voice. Used by a symptom. var/bleed_rate = 0 //how much are we bleeding - var/bleedsuppress = 0 //for stopping bloodloss, eventually this will be limb-based like bleeding + var/bleedsuppress = 0 //for stopping bloodloss body-wide var/name_override //For temporary visible name changes diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index b240836b55e7..21bf34d8cb58 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -820,7 +820,7 @@ TH.transfer_mob_blood_dna(src) /mob/living/carbon/human/makeTrail(turf/T) - if((NOBLOOD in dna.species.species_traits) || !bleed_rate || bleedsuppress) + if((NOBLOOD in dna.species.species_traits) || bleedsuppress || !LAZYLEN(get_bleeding_parts(TRUE))) return ..() diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 86c85d27360a..563833822c05 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -54,7 +54,7 @@ var/armor = run_armor_check(def_zone, P.flag, P.armour_penetration, silent = TRUE) var/on_hit_state = P.on_hit(src, armor, piercing_hit) if(!P.nodamage && on_hit_state != BULLET_ACT_BLOCK && !QDELETED(src)) //QDELETED literally just for the instagib rifle. Yeah. - apply_damage(P.damage, P.damage_type, def_zone, armor) + apply_damage(P.damage, P.damage_type, def_zone, armor, sharpness = TRUE) recoil_camera(src, clamp((P.damage-armor)/4,0.5,10), clamp((P.damage-armor)/4,0.5,10), P.damage/8, P.Angle) apply_effects(P.stun, P.knockdown, P.unconscious, P.irradiate, P.slur, P.stutter, P.eyeblur, P.drowsy, armor, P.stamina, P.jitter, P.paralyze, P.immobilize) if(P.dismemberment) diff --git a/code/modules/mob/living/simple_animal/hostile/cat_butcher.dm b/code/modules/mob/living/simple_animal/hostile/cat_butcher.dm index 8da384aaca4b..c97f412730c5 100644 --- a/code/modules/mob/living/simple_animal/hostile/cat_butcher.dm +++ b/code/modules/mob/living/simple_animal/hostile/cat_butcher.dm @@ -82,11 +82,11 @@ L.adjustOxyLoss(-50)// do CPR first if(L.blood_volume <= 500) //bandage them up and give em some blood if they're bleeding L.blood_volume += 30 - L.suppress_bloodloss(1800) + L.heal_bodypart_bleeding(10) if(L.getBruteLoss() >= 50)// first, did we beat them into crit? if so, heal that var/healing = min(L.getBruteLoss(), 120) L.adjustBruteLoss(-healing) - L.suppress_bloodloss(1800)//bandage their ass + L.heal_bodypart_bleeding(10) return else if(L.getFireLoss() >= 50) // are they still down from other damage? fix it, but not as fast as the burns var/healing = min(L.getFireLoss(), 50) diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 24be546cb3f6..79977165231b 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -1090,7 +1090,7 @@ M.adjustBruteLoss(-2*REM, 0) if(ishuman(M)) var/mob/living/carbon/human/H = M - H.bleed_rate = max(H.bleed_rate - 0.25, 0) + H.heal_bodypart_bleeding(0.25) ..() . = 1 @@ -1637,7 +1637,7 @@ if(prob(50)) if(ishuman(M)) var/mob/living/carbon/human/H = M - H.bleed_rate = max(H.bleed_rate - 2, 0) + H.heal_bodypart_bleeding(2) ..() . = 1 diff --git a/code/modules/reagents/chemistry/reagents/trickwine_reagents.dm b/code/modules/reagents/chemistry/reagents/trickwine_reagents.dm index df76f85b1f64..e3ac9992b625 100644 --- a/code/modules/reagents/chemistry/reagents/trickwine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/trickwine_reagents.dm @@ -115,7 +115,7 @@ M.adjust_bodytemperature(5 * TEMPERATURE_DAMAGE_COEFFICIENT, M.get_body_temp_normal()) if(ishuman(M)) var/mob/living/carbon/human/H = M - H.bleed_rate = max(H.bleed_rate - 0.25, 0) + H.heal_bodypart_bleeding(0.25) return ..() /datum/reagent/consumable/ethanol/trickwine/hearth_wine/expose_mob(mob/living/M, method=TOUCH, reac_volume) diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 36be4357ca5f..9d852a7c4761 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -247,8 +247,8 @@ break_bone() // Bleeding is applied here - if((sharpness && brute_dam+brute > bleed_threshold && brute > bleed_damage_min) || (brute_dam+brute > bleed_threshold_blunt && brute > bleed_damage_min_blunt)) - adjust_bleeding(brute/max_damage) + if(brute_dam+brute > (sharpness ? bleed_threshold : bleed_threshold_blunt) && brute > (sharpness ? bleed_damage_min : bleed_damage_min_blunt)) + adjust_bleeding(brute/max_damage, BLOOD_LOSS_DAMAGE_CAP) var/can_inflict = max_damage - get_damage() if(can_inflict <= 0) @@ -335,6 +335,8 @@ /obj/item/bodypart/proc/adjust_bleeding(value, maximum = BLOOD_LOSS_MAXIMUM) if(bleeding > maximum) return + if(owner.dna && (NOBLOOD in owner.dna.species.species_traits)) + return bleeding = round(clamp(bleeding+value, 0, maximum), 0.01) /obj/item/bodypart/proc/can_bandage(user) @@ -347,7 +349,6 @@ if(GetComponent(/datum/component/bandage)) to_chat(user, span_warning("[owner]'s [parse_zone(body_zone)] has already been dressed!")) return FALSE - return //Returns total damage. /obj/item/bodypart/proc/get_damage(include_stamina = FALSE) diff --git a/code/modules/surgery/organs/vocal_cords.dm b/code/modules/surgery/organs/vocal_cords.dm index 5eed8abc46be..c0313adb2539 100644 --- a/code/modules/surgery/organs/vocal_cords.dm +++ b/code/modules/surgery/organs/vocal_cords.dm @@ -286,7 +286,7 @@ else if((findtext(message, bleed_words))) cooldown = COOLDOWN_DAMAGE for(var/mob/living/carbon/human/H in listeners) - H.bleed_rate += (5 * power_multiplier) + H.cause_overall_bleeding(5*power_multiplier) //FIRE else if((findtext(message, burn_words))) From c381e897bba7920c7c3d2f8de24cefb5334b9f8f Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Thu, 2 May 2024 20:22:15 -0400 Subject: [PATCH 12/29] pretend this is in the last commit --- code/datums/components/bandage.dm | 6 +++--- code/game/objects/items/stacks/medical.dm | 2 +- code/game/objects/items/stacks/tape.dm | 3 ++- code/modules/mob/living/blood.dm | 5 ++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/datums/components/bandage.dm b/code/datums/components/bandage.dm index 6f4bca2f4111..e2175bcd350a 100644 --- a/code/datums/components/bandage.dm +++ b/code/datums/components/bandage.dm @@ -2,9 +2,9 @@ /datum/component/bandage /// How much damage do we heal? - var/healing_speed = 0.2 + var/healing_speed = 0 /// How fast do we stop bleeding? - var/bleed_reduction = 0.2 + var/bleed_reduction = 0 /// How many healing ticks will this bandage apply? Reduced by incoming damage and other nasties var/durability = 300 /// What is dropped when the bandage is removed? @@ -13,7 +13,7 @@ /// The person this bandage is applied to var/mob/living/mummy -/datum/component/bandage/Initialize(_healing_speed, _durability, _bandage_name, _trash_item) +/datum/component/bandage/Initialize(_healing_speed, bleed_reduction, _durability, _bandage_name, _trash_item) if(!istype(parent, /obj/item/bodypart)) return COMPONENT_INCOMPATIBLE var/obj/item/bodypart/BP = parent diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index efb3fb6e38ca..bdcf66f805a6 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -162,7 +162,7 @@ to_chat(user, span_warning("[C] doesn't have \a [parse_zone(user.zone_selected)]!")) return if(BP.can_bandage(user)) - BP.AddComponent(/datum/component/bandage, healing_rate, lifespan, "gauze") + BP.AddComponent(/datum/component/bandage, healing_rate, bleed_reduction, lifespan, "gauze") user.visible_message(span_notice("[user] wraps [C]'s [parse_zone(BP.body_zone)] with [src]."), span_notice("You wrap [C]'s [parse_zone(check_zone(user.zone_selected))] with [src]."), span_hear("You hear ruffling cloth.")) return TRUE diff --git a/code/game/objects/items/stacks/tape.dm b/code/game/objects/items/stacks/tape.dm index b64657d960b0..fe1792aa7b85 100644 --- a/code/game/objects/items/stacks/tape.dm +++ b/code/game/objects/items/stacks/tape.dm @@ -82,6 +82,7 @@ var/lifespan = 600 var/healing_rate = 0.1 + var/bleed_reduction = 0.1 var/nonorganic_heal = 5 var/self_delay = 30 //! Also used for the tapecuff delay var/other_delay = 10 @@ -181,7 +182,7 @@ C.update_damage_overlays() return TRUE if(affecting.can_bandage(user)) - affecting.AddComponent(/datum/component/bandage, healing_rate, lifespan, name) + affecting.AddComponent(/datum/component/bandage, healing_rate, bleed_reduction, lifespan, name) to_chat(user, "You tape up [C]'s [parse_zone(affecting.body_zone)]!") return TRUE to_chat(user, "[src] can't patch what [C] has...") diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index d65e21a5910b..fcefdc478f03 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -88,13 +88,12 @@ for(var/obj/item/bodypart/BP as anything in bodyparts) if(BP.GetComponent(/datum/component/bandage)) continue - limb_bleed += BP.bleeding - //We want an accurate reading of .len listclearnulls(BP.embedded_objects) for(var/obj/item/embeddies in BP.embedded_objects) if(!embeddies.isEmbedHarmless()) - temp_bleed += 0.5 + BP.adjust_bleeding(0.5, BLOOD_LOSS_DAMAGE_CAP) + limb_bleed += BP.bleeding bleed_rate = max(bleed_rate - 0.5, temp_bleed)//if no wounds, other bleed effects naturally decrease From bf948a4688fcacca607ed49f9c3848e29d72e736 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Fri, 3 May 2024 14:19:46 -0400 Subject: [PATCH 13/29] removes bleed_rate because it's unnecessary --- code/modules/mob/living/blood.dm | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index fcefdc478f03..653cb33c4fb2 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -12,7 +12,7 @@ addtimer(CALLBACK(src, PROC_REF(resume_bleeding)), amount) /mob/living/carbon/human/proc/resume_bleeding() - if(stat != DEAD && bleed_rate) + if(stat != DEAD && get_bleeding_parts(TRUE)) to_chat(src, "The blood soaks through your bandage.")*/ @@ -28,7 +28,6 @@ /mob/living/carbon/human/handle_blood() if(NOBLOOD in dna.species.species_traits) - bleed_rate = 0 return if(bodytemperature >= TCRYO && !(HAS_TRAIT(src, TRAIT_HUSK))) //cryosleep or husked people do not pump the blood. @@ -82,7 +81,6 @@ if(!HAS_TRAIT(src, TRAIT_NODEATH)) death() - var/temp_bleed = 0 //Bleeding out var/limb_bleed = 0 for(var/obj/item/bodypart/BP as anything in bodyparts) @@ -95,10 +93,8 @@ BP.adjust_bleeding(0.5, BLOOD_LOSS_DAMAGE_CAP) limb_bleed += BP.bleeding - bleed_rate = max(bleed_rate - 0.5, temp_bleed)//if no wounds, other bleed effects naturally decrease - - if((bleed_rate || limb_bleed) && !bleedsuppress && !(HAS_TRAIT(src, TRAIT_FAKEDEATH))) - bleed(bleed_rate + limb_bleed) + if((limb_bleed) && !bleedsuppress && !(HAS_TRAIT(src, TRAIT_FAKEDEATH))) + bleed(limb_bleed) //Makes a blood drop, leaking amt units of blood from the mob /mob/living/carbon/proc/bleed(amt) @@ -125,7 +121,6 @@ blood_volume = BLOOD_VOLUME_NORMAL for(var/obj/item/bodypart/BP as anything in get_bleeding_parts()) BP.bleeding = 0 - bleed_rate = 0 /**************************************************** BLOOD TRANSFERS From 98f5ea47a71803d36bc17ad970ff1faa7a6a6aa1 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 6 May 2024 01:57:19 -0400 Subject: [PATCH 14/29] Cauterization support --- code/__DEFINES/mobs.dm | 2 ++ code/datums/components/bandage.dm | 2 +- .../kitchen_machinery/microwave.dm | 6 +++++ code/modules/mob/living/blood.dm | 2 +- .../mob/living/carbon/carbon_defense.dm | 24 +++++++++++++++++++ .../mob/living/carbon/human/human_defines.dm | 1 - code/modules/surgery/bodyparts/bodyparts.dm | 6 +++-- 7 files changed, 38 insertions(+), 5 deletions(-) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index d370a6e07dcc..2bddc8133cbf 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -31,6 +31,8 @@ // Bloodloss #define BLOOD_LOSS_MAXIMUM 30 #define BLOOD_LOSS_DAMAGE_CAP 2 +#define BLOOD_CAUTERIZATION_RATIO 10 +#define BLOOD_CAUTERIZATION_DAMAGE_RATIO 300 //Sizes of mobs, used by mob/living/var/mob_size #define MOB_SIZE_TINY 0 diff --git a/code/datums/components/bandage.dm b/code/datums/components/bandage.dm index e2175bcd350a..b9544c5c2b15 100644 --- a/code/datums/components/bandage.dm +++ b/code/datums/components/bandage.dm @@ -45,7 +45,7 @@ heal_target.heal_damage(actual_heal_speed, actual_heal_speed) durability-- if(heal_target.bleeding) - durability = round(durability - max(heal_target.bleeding, 1)) + durability = round(durability - clamp(heal_target.bleeding, 1, 5)) //heavier bleeding reduces bandage lifespan heal_target.adjust_bleeding(-bleed_reduction) if(durability <= 0 || (!heal_target.bleeding && !heal_target.get_damage())) drop_bandage() diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm index 4a739d2ab7fc..4bfbfbfa9790 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -382,6 +382,12 @@ playsound(src, 'sound/items/cig_light.ogg', 50, 1) moveToNullspace() + +/obj/item/ration_heater/get_temperature() + if(!uses) + return 0 + . = ..() + /obj/item/ration_heater/proc/clear_cooking(datum/source) SIGNAL_HANDLER UnregisterSignal(tocook, COMSIG_PARENT_QDELETING) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 653cb33c4fb2..e4ab59b27c76 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -93,7 +93,7 @@ BP.adjust_bleeding(0.5, BLOOD_LOSS_DAMAGE_CAP) limb_bleed += BP.bleeding - if((limb_bleed) && !bleedsuppress && !(HAS_TRAIT(src, TRAIT_FAKEDEATH))) + if(limb_bleed && !bleedsuppress && !HAS_TRAIT(src, TRAIT_FAKEDEATH)) bleed(limb_bleed) //Makes a blood drop, leaking amt units of blood from the mob diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 9b50d1827724..fb2ca1838fd3 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -1,3 +1,27 @@ +/mob/living/carbon/attackby(obj/item/W, mob/user, params) + var/obj/item/bodypart/BP = get_bodypart(check_zone(user.zone_selected)) + var/has_painkillers = user.reagents.has_reagent(/datum/reagent/medicine/morphine, needs_metabolizing = TRUE) + if(!user.a_intent == INTENT_HELP || !W.get_temperature() || !BP?.bleeding) + return ..() + if(W.tool_behaviour == TOOL_WELDER && IS_ROBOTIC_LIMB(BP) && BP.brute_dam > 5) //prioritize healing if we're synthetic + return ..() + . = TRUE + var/heal_time = 2 SECONDS + playsound(user, 'sound/surgery/cautery1.ogg', 20) + balloon_alert(user, "cauterizing...") + if(src == user && !has_painkillers) + heal_time *= 2 //oof ouch owie + user.visible_message(span_nicegreen("[user] holds [W] up to [user == src ? "their" : "[src]'s"] [parse_zone(BP.body_zone)], trying to slow [p_their()] bleeding..."), span_nicegreen("You hold [W] up to [user == src ? "your" : "[src]'s"] [parse_zone(BP.body_zone)], trying to slow [user == src ? "your" : p_their()] bleeding...")) + if(do_after(user, heal_time, target = src)) + playsound(user, 'sound/surgery/cautery2.ogg', 20) + BP.AddComponent(/datum/component/bandage, 0, 0.02, W.get_temperature()/BLOOD_CAUTERIZATION_RATIO, "cauterization") // this is the "I would really rather not be bleeding right now" option + BP.receive_damage(burn = W.get_temperature()/BLOOD_CAUTERIZATION_DAMAGE_RATIO) //my body is a MACHINE that turns BLEEDING into BURN DAMAGE + user.visible_message(span_nicegreen("[user] cauterizes some of [user == src ? "their" : "[src]'s"] bleeding!"), span_nicegreen("You cauterize some of [user == src ? "your" : "[src]'s"] bleeding!")) + else + to_chat(user, span_warning("You were interrupted!")) + + + /mob/living/carbon/get_eye_protection() . = ..() var/obj/item/organ/eyes/E = getorganslot(ORGAN_SLOT_EYES) diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 902cfaddc7df..ea3560098235 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -61,7 +61,6 @@ var/special_voice = "" // For changing our voice. Used by a symptom. - var/bleed_rate = 0 //how much are we bleeding var/bleedsuppress = 0 //for stopping bloodloss body-wide var/name_override //For temporary visible name changes diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 9d852a7c4761..53354b119c2e 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -344,10 +344,12 @@ if(is_pseudopart) return FALSE if(!get_damage() && !bleeding) - to_chat(user, span_warning("[owner]'s [parse_zone(body_zone)] is already fully healed!")) + if(user) + to_chat(user, span_warning("[owner]'s [parse_zone(body_zone)] is already fully healed!")) return FALSE if(GetComponent(/datum/component/bandage)) - to_chat(user, span_warning("[owner]'s [parse_zone(body_zone)] has already been dressed!")) + if(user) + to_chat(user, span_warning("[owner]'s [parse_zone(body_zone)] has already been dressed!")) return FALSE //Returns total damage. From 3c0fc452e18b40bb0d020bd48e409c9f0a07d808 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Sat, 11 May 2024 17:39:41 -0400 Subject: [PATCH 15/29] tweaks and fix bleeding healing for bandages --- code/datums/components/bandage.dm | 16 ++++++---------- code/game/objects/items/stacks/medical.dm | 7 ++++--- code/game/objects/items/stacks/tape.dm | 4 ++-- code/modules/surgery/bodyparts/bodyparts.dm | 2 +- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/code/datums/components/bandage.dm b/code/datums/components/bandage.dm index b9544c5c2b15..94569431edca 100644 --- a/code/datums/components/bandage.dm +++ b/code/datums/components/bandage.dm @@ -1,5 +1,3 @@ -#define BANDAGE_DAMAGE_COEFF 5 - /datum/component/bandage /// How much damage do we heal? var/healing_speed = 0 @@ -13,7 +11,7 @@ /// The person this bandage is applied to var/mob/living/mummy -/datum/component/bandage/Initialize(_healing_speed, bleed_reduction, _durability, _bandage_name, _trash_item) +/datum/component/bandage/Initialize(_healing_speed, _bleed_reduction, _durability, _bandage_name, _trash_item) if(!istype(parent, /obj/item/bodypart)) return COMPONENT_INCOMPATIBLE var/obj/item/bodypart/BP = parent @@ -22,6 +20,8 @@ return COMPONENT_INCOMPATIBLE if(_healing_speed) healing_speed = _healing_speed + if(_bleed_reduction) + bleed_reduction = _bleed_reduction if(_durability) durability = _durability if(_bandage_name) @@ -34,7 +34,7 @@ /datum/component/bandage/proc/check_damage(damage, damagetype = BRUTE, def_zone = null) if(parent != mummy.get_bodypart(check_zone(def_zone))) return - durability = durability - damage * BANDAGE_DAMAGE_COEFF + durability = durability - damage / 100 * initial(durability) //take incoming damage as a % of durability if(durability <= 0) drop_bandage() @@ -44,10 +44,8 @@ var/actual_heal_speed = healing_speed //TODO: add modifiers to this (scope 2) heal_target.heal_damage(actual_heal_speed, actual_heal_speed) durability-- - if(heal_target.bleeding) - durability = round(durability - clamp(heal_target.bleeding, 1, 5)) //heavier bleeding reduces bandage lifespan - heal_target.adjust_bleeding(-bleed_reduction) - if(durability <= 0 || (!heal_target.bleeding && !heal_target.get_damage())) + heal_target.adjust_bleeding(-bleed_reduction) + if(durability <= 0 || ((!heal_target.bleeding || !bleed_reduction) && (!heal_target.get_damage() || !healing_speed))) //remove treatment once it's no longer able to treat drop_bandage() /datum/component/bandage/proc/drop_bandage() @@ -58,5 +56,3 @@ else to_chat(mummy, span_notice("The [bandage_name] on your [parent] finished healing.")) qdel(src) - -#undef BANDAGE_DAMAGE_COEFF diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index bdcf66f805a6..b2d53a275fc2 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -143,9 +143,9 @@ icon_state = "gauze" apply_sounds = list('sound/effects/rip1.ogg', 'sound/effects/rip2.ogg') var/healing_rate = 0.2 - var/bleed_reduction = 0.75 + var/bleed_reduction = 0.1 - var/lifespan = 1800 + var/lifespan = 180 self_delay = 20 max_amount = 12 grind_results = list(/datum/reagent/cellulose = 2) @@ -186,7 +186,8 @@ singular_name = "improvised gauze" desc = "A roll of cloth roughly cut from something that can stop bleeding and slowly heal wounds." healing_rate = 0.1 - lifespan = 900 + bleed_reduction = 0.05 + lifespan = 90 /obj/item/stack/medical/gauze/cyborg custom_materials = null diff --git a/code/game/objects/items/stacks/tape.dm b/code/game/objects/items/stacks/tape.dm index fe1792aa7b85..05d9255f0967 100644 --- a/code/game/objects/items/stacks/tape.dm +++ b/code/game/objects/items/stacks/tape.dm @@ -80,7 +80,7 @@ grind_results = list(/datum/reagent/cellulose = 5) usesound = 'sound/items/tape.ogg' - var/lifespan = 600 + var/lifespan = 300 var/healing_rate = 0.1 var/bleed_reduction = 0.1 var/nonorganic_heal = 5 @@ -319,6 +319,6 @@ desc = "Now THIS is engineering." icon_state = "tape_y" - lifespan = 1000 + lifespan = 800 nonorganic_heal = 30 prefix = "industry-standard sticky" diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 53354b119c2e..297281d83105 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -289,7 +289,7 @@ if(brute) set_brute_dam(round(max(brute_dam - brute, 0), DAMAGE_PRECISION)) - adjust_bleeding(-brute/max_damage, BLOOD_LOSS_DAMAGE_CAP) + adjust_bleeding(-brute/max_damage) if(burn) set_burn_dam(round(max(burn_dam - burn, 0), DAMAGE_PRECISION)) if(stamina) From 2c566c777717d18edc2d535f44bc1f72a275b211 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Sun, 19 May 2024 23:20:19 -0400 Subject: [PATCH 16/29] minimums on bleed adjusts and rebrand heal_bodypart_bleeding to heal_bleeding --- code/modules/mob/living/carbon/damage_procs.dm | 10 +++++++++- .../mob/living/simple_animal/hostile/cat_butcher.dm | 4 ++-- .../reagents/chemistry/reagents/medicine_reagents.dm | 4 ++-- .../reagents/chemistry/reagents/trickwine_reagents.dm | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index 333af2964b04..8c023299baed 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -286,6 +286,8 @@ /// Apply bleeding to one random bodypart. /mob/living/carbon/proc/cause_bleeding(amt) + if(amt <= 0) + return var/list/obj/item/bodypart/parts = bodyparts.Copy() if(!length(parts)) return @@ -293,7 +295,9 @@ part_in_question.adjust_bleeding(amt) /// Heal bleeding from one random bodypart -/mob/living/carbon/proc/heal_bodypart_bleeding(amt) +/mob/living/carbon/proc/heal_bleeding(amt) + if(amt <= 0) + return var/list/obj/item/bodypart/parts = get_bleeding_parts() if(!length(parts)) return @@ -304,6 +308,8 @@ /// Apply bleeding to all bodyparts /mob/living/carbon/proc/cause_overall_bleeding(amt) + if(amt <= 0) + return var/list/obj/item/bodypart/parts = bodyparts.Copy() while(length(parts)) var/obj/item/bodypart/part_in_question = pick(parts) @@ -317,6 +323,8 @@ /// Heal bleeding from all bodyparts /mob/living/carbon/proc/heal_overall_bleeding(amt) + if(amt <= 0) + return var/list/obj/item/bodypart/parts = get_bleeding_parts() while(length(parts)) var/obj/item/bodypart/part_in_question = pick(parts) diff --git a/code/modules/mob/living/simple_animal/hostile/cat_butcher.dm b/code/modules/mob/living/simple_animal/hostile/cat_butcher.dm index c97f412730c5..67d7d3e00040 100644 --- a/code/modules/mob/living/simple_animal/hostile/cat_butcher.dm +++ b/code/modules/mob/living/simple_animal/hostile/cat_butcher.dm @@ -82,11 +82,11 @@ L.adjustOxyLoss(-50)// do CPR first if(L.blood_volume <= 500) //bandage them up and give em some blood if they're bleeding L.blood_volume += 30 - L.heal_bodypart_bleeding(10) + L.heal_bleeding(10) if(L.getBruteLoss() >= 50)// first, did we beat them into crit? if so, heal that var/healing = min(L.getBruteLoss(), 120) L.adjustBruteLoss(-healing) - L.heal_bodypart_bleeding(10) + L.heal_bleeding(10) return else if(L.getFireLoss() >= 50) // are they still down from other damage? fix it, but not as fast as the burns var/healing = min(L.getFireLoss(), 50) diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index abca1c57d00c..4c4ad36b2413 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -1091,7 +1091,7 @@ M.adjustBruteLoss(-2*REM, 0) if(ishuman(M)) var/mob/living/carbon/human/H = M - H.heal_bodypart_bleeding(0.25) + H.heal_bleeding(0.25) ..() . = 1 @@ -1638,7 +1638,7 @@ if(prob(50)) if(ishuman(M)) var/mob/living/carbon/human/H = M - H.heal_bodypart_bleeding(2) + H.heal_bleeding(2) ..() . = 1 diff --git a/code/modules/reagents/chemistry/reagents/trickwine_reagents.dm b/code/modules/reagents/chemistry/reagents/trickwine_reagents.dm index e3ac9992b625..ac5fd7a35a92 100644 --- a/code/modules/reagents/chemistry/reagents/trickwine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/trickwine_reagents.dm @@ -115,7 +115,7 @@ M.adjust_bodytemperature(5 * TEMPERATURE_DAMAGE_COEFFICIENT, M.get_body_temp_normal()) if(ishuman(M)) var/mob/living/carbon/human/H = M - H.heal_bodypart_bleeding(0.25) + H.heal_bleeding(0.25) return ..() /datum/reagent/consumable/ethanol/trickwine/hearth_wine/expose_mob(mob/living/M, method=TOUCH, reac_volume) From c04cbd52b81b800876b35e62ee935647adfceb41 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 20 May 2024 00:06:05 -0400 Subject: [PATCH 17/29] Suit storage cauterization (funny), numbers, removing bandage healing bc lmao, other stuff --- code/datums/components/bandage.dm | 38 +++++++------------ code/game/machinery/suit_storage_unit.dm | 6 +++ code/game/objects/items/stacks/medical.dm | 11 ++---- code/game/objects/items/stacks/tape.dm | 10 ++--- .../mob/living/carbon/carbon_defense.dm | 6 +-- code/modules/surgery/bodyparts/bodyparts.dm | 11 ++++-- 6 files changed, 38 insertions(+), 44 deletions(-) diff --git a/code/datums/components/bandage.dm b/code/datums/components/bandage.dm index 94569431edca..3d2eab39da5d 100644 --- a/code/datums/components/bandage.dm +++ b/code/datums/components/bandage.dm @@ -1,58 +1,48 @@ +#define TREATMENT_DAMAGE_MOD 2 + /datum/component/bandage - /// How much damage do we heal? - var/healing_speed = 0 /// How fast do we stop bleeding? var/bleed_reduction = 0 - /// How many healing ticks will this bandage apply? Reduced by incoming damage and other nasties - var/durability = 300 - /// What is dropped when the bandage is removed? - var/trash_item = null + /// How many healing ticks will this bandage apply? Reduced by incoming damage and current bleeding + var/lifespan = 300 var/bandage_name = "gauze" /// The person this bandage is applied to var/mob/living/mummy -/datum/component/bandage/Initialize(_healing_speed, _bleed_reduction, _durability, _bandage_name, _trash_item) +/datum/component/bandage/Initialize(_bleed_reduction, _lifespan, _bandage_name) if(!istype(parent, /obj/item/bodypart)) return COMPONENT_INCOMPATIBLE var/obj/item/bodypart/BP = parent mummy = BP.owner if(!mummy) return COMPONENT_INCOMPATIBLE - if(_healing_speed) - healing_speed = _healing_speed if(_bleed_reduction) bleed_reduction = _bleed_reduction - if(_durability) - durability = _durability + if(_lifespan) + lifespan = _lifespan if(_bandage_name) bandage_name = _bandage_name - if(_trash_item) - trash_item = _trash_item RegisterSignal(mummy, COMSIG_MOB_APPLY_DAMGE, PROC_REF(check_damage)) RegisterSignal(mummy, COMSIG_MOB_LIFE, PROC_REF(bandage_effects)) /datum/component/bandage/proc/check_damage(damage, damagetype = BRUTE, def_zone = null) if(parent != mummy.get_bodypart(check_zone(def_zone))) return - durability = durability - damage / 100 * initial(durability) //take incoming damage as a % of durability - if(durability <= 0) + lifespan = lifespan - damage / 100 * initial(lifespan) * TREATMENT_DAMAGE_MOD //take incoming damage as a % of durability + if(lifespan <= 0) drop_bandage() /datum/component/bandage/proc/bandage_effects() var/obj/item/bodypart/heal_target = parent - var/actual_heal_speed = healing_speed //TODO: add modifiers to this (scope 2) - heal_target.heal_damage(actual_heal_speed, actual_heal_speed) - durability-- + lifespan -= 1 + heal_target.bleeding // particularly nasty bleeding can burn through dressing faster heal_target.adjust_bleeding(-bleed_reduction) - if(durability <= 0 || ((!heal_target.bleeding || !bleed_reduction) && (!heal_target.get_damage() || !healing_speed))) //remove treatment once it's no longer able to treat + if(lifespan <= 0 || !heal_target.bleeding) //remove treatment once it's no longer able to treat drop_bandage() /datum/component/bandage/proc/drop_bandage() var/obj/item/bodypart/BP = parent - if(trash_item) - new trash_item(get_turf(mummy)) - mummy.visible_message(span_notice("The [bandage_name] on [mummy]'s [parse_zone(BP.body_zone)] falls to the floor."), span_notice("The [bandage_name] on your [parse_zone(BP.body_zone)] falls to the floor.")) - else - to_chat(mummy, span_notice("The [bandage_name] on your [parent] finished healing.")) + to_chat(mummy, span_notice("The [bandage_name] on your [parse_zone(BP.body_zone)] has [BP.bleeding ? "done what it can" : "stopped the bleeding"].")) qdel(src) + +#undef TREATMENT_DAMAGE_MOD diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index e86d4ae9f0f9..e05dd8d16ff8 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -433,6 +433,12 @@ else visible_message("[src]'s door slides open, barraging you with the nauseating smell of charred flesh.") mob_occupant.radiation = 0 + if(iscarbon(mob_occupant)) + var/mob/living/carbon/bacon = mob_occupant + for(var/obj/item/bodypart/grilling as anything in bacon.get_bleeding_parts(TRUE)) + if(!grilling.can_bandage()) + continue + grilling.apply_bandage(0.02, 600, "cauterization") playsound(src, 'sound/machines/airlocks/standard/close.ogg', 25, TRUE) var/list/things_to_clear = list() //Done this way since using GetAllContents on the SSU itself would include circuitry and such. if(suit) diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index b2d53a275fc2..1c5abcac13ed 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -142,10 +142,9 @@ singular_name = "medical gauze" icon_state = "gauze" apply_sounds = list('sound/effects/rip1.ogg', 'sound/effects/rip2.ogg') - var/healing_rate = 0.2 - var/bleed_reduction = 0.1 + var/bleed_reduction = 0.05 - var/lifespan = 180 + var/lifespan = 150 self_delay = 20 max_amount = 12 grind_results = list(/datum/reagent/cellulose = 2) @@ -162,7 +161,7 @@ to_chat(user, span_warning("[C] doesn't have \a [parse_zone(user.zone_selected)]!")) return if(BP.can_bandage(user)) - BP.AddComponent(/datum/component/bandage, healing_rate, bleed_reduction, lifespan, "gauze") + BP.apply_bandage(bleed_reduction, lifespan, name) user.visible_message(span_notice("[user] wraps [C]'s [parse_zone(BP.body_zone)] with [src]."), span_notice("You wrap [C]'s [parse_zone(check_zone(user.zone_selected))] with [src]."), span_hear("You hear ruffling cloth.")) return TRUE @@ -185,9 +184,7 @@ name = "improvised gauze" singular_name = "improvised gauze" desc = "A roll of cloth roughly cut from something that can stop bleeding and slowly heal wounds." - healing_rate = 0.1 - bleed_reduction = 0.05 - lifespan = 90 + bleed_reduction = 0.025 /obj/item/stack/medical/gauze/cyborg custom_materials = null diff --git a/code/game/objects/items/stacks/tape.dm b/code/game/objects/items/stacks/tape.dm index 05d9255f0967..e442717e9181 100644 --- a/code/game/objects/items/stacks/tape.dm +++ b/code/game/objects/items/stacks/tape.dm @@ -81,8 +81,7 @@ usesound = 'sound/items/tape.ogg' var/lifespan = 300 - var/healing_rate = 0.1 - var/bleed_reduction = 0.1 + var/bleed_reduction = 0.01 var/nonorganic_heal = 5 var/self_delay = 30 //! Also used for the tapecuff delay var/other_delay = 10 @@ -182,7 +181,7 @@ C.update_damage_overlays() return TRUE if(affecting.can_bandage(user)) - affecting.AddComponent(/datum/component/bandage, healing_rate, bleed_reduction, lifespan, name) + affecting.apply_bandage(bleed_reduction, lifespan, name) to_chat(user, "You tape up [C]'s [parse_zone(affecting.body_zone)]!") return TRUE to_chat(user, "[src] can't patch what [C] has...") @@ -270,7 +269,7 @@ desc = "This roll of silver sorcery can fix just about anything." icon_state = "tape_d" - lifespan = 800 + lifespan = 400 nonorganic_heal = 20 prefix = "super sticky" conferred_embed = EMBED_HARMLESS_SUPERIOR @@ -295,7 +294,6 @@ desc = "Specialty insulated strips of adhesive plastic. Made for securing cables." icon_state = "tape_e" - lifespan = 400 nonorganic_heal = 10 prefix = "insulated sticky" siemens_coefficient = 0 @@ -319,6 +317,6 @@ desc = "Now THIS is engineering." icon_state = "tape_y" - lifespan = 800 + lifespan = 500 nonorganic_heal = 30 prefix = "industry-standard sticky" diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index fb2ca1838fd3..7f5b26a0d9bb 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -1,10 +1,10 @@ /mob/living/carbon/attackby(obj/item/W, mob/user, params) var/obj/item/bodypart/BP = get_bodypart(check_zone(user.zone_selected)) var/has_painkillers = user.reagents.has_reagent(/datum/reagent/medicine/morphine, needs_metabolizing = TRUE) - if(!user.a_intent == INTENT_HELP || !W.get_temperature() || !BP?.bleeding) - return ..() if(W.tool_behaviour == TOOL_WELDER && IS_ROBOTIC_LIMB(BP) && BP.brute_dam > 5) //prioritize healing if we're synthetic return ..() + if(!user.a_intent == INTENT_HELP || !W.get_temperature() || BP.can_bandage()) //this will also catch low damage synthetic welding + return ..() . = TRUE var/heal_time = 2 SECONDS playsound(user, 'sound/surgery/cautery1.ogg', 20) @@ -14,7 +14,7 @@ user.visible_message(span_nicegreen("[user] holds [W] up to [user == src ? "their" : "[src]'s"] [parse_zone(BP.body_zone)], trying to slow [p_their()] bleeding..."), span_nicegreen("You hold [W] up to [user == src ? "your" : "[src]'s"] [parse_zone(BP.body_zone)], trying to slow [user == src ? "your" : p_their()] bleeding...")) if(do_after(user, heal_time, target = src)) playsound(user, 'sound/surgery/cautery2.ogg', 20) - BP.AddComponent(/datum/component/bandage, 0, 0.02, W.get_temperature()/BLOOD_CAUTERIZATION_RATIO, "cauterization") // this is the "I would really rather not be bleeding right now" option + BP.apply_bandage(0.02, W.get_temperature()/BLOOD_CAUTERIZATION_RATIO, "cauterization") BP.receive_damage(burn = W.get_temperature()/BLOOD_CAUTERIZATION_DAMAGE_RATIO) //my body is a MACHINE that turns BLEEDING into BURN DAMAGE user.visible_message(span_nicegreen("[user] cauterizes some of [user == src ? "their" : "[src]'s"] bleeding!"), span_nicegreen("You cauterize some of [user == src ? "your" : "[src]'s"] bleeding!")) else diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 297281d83105..f922d6589fda 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -247,7 +247,7 @@ break_bone() // Bleeding is applied here - if(brute_dam+brute > (sharpness ? bleed_threshold : bleed_threshold_blunt) && brute > (sharpness ? bleed_damage_min : bleed_damage_min_blunt)) + if(brute_dam+brute >= (sharpness ? bleed_threshold : bleed_threshold_blunt) && brute >= (sharpness ? bleed_damage_min : bleed_damage_min_blunt)) adjust_bleeding(brute/max_damage, BLOOD_LOSS_DAMAGE_CAP) var/can_inflict = max_damage - get_damage() @@ -337,21 +337,24 @@ return if(owner.dna && (NOBLOOD in owner.dna.species.species_traits)) return - bleeding = round(clamp(bleeding+value, 0, maximum), 0.01) + bleeding = round(clamp(bleeding+value, 0, maximum), 0.001) /obj/item/bodypart/proc/can_bandage(user) . = TRUE if(is_pseudopart) return FALSE - if(!get_damage() && !bleeding) + if(!bleeding) if(user) - to_chat(user, span_warning("[owner]'s [parse_zone(body_zone)] is already fully healed!")) + to_chat(user, span_warning("[owner]'s [parse_zone(body_zone)] isn't bleeding!")) return FALSE if(GetComponent(/datum/component/bandage)) if(user) to_chat(user, span_warning("[owner]'s [parse_zone(body_zone)] has already been dressed!")) return FALSE +/obj/item/bodypart/proc/apply_bandage(bleed_reduction, lifespan, name) + AddComponent(/datum/component/bandage, bleed_reduction, lifespan, name) + //Returns total damage. /obj/item/bodypart/proc/get_damage(include_stamina = FALSE) var/total = brute_dam + burn_dam From 4deb81a039e73adcd4f8736128e891852f09b94a Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 20 May 2024 00:06:13 -0400 Subject: [PATCH 18/29] waa --- code/datums/components/bandage.dm | 1 - code/modules/surgery/bodyparts/bodyparts.dm | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/bandage.dm b/code/datums/components/bandage.dm index 3d2eab39da5d..f9bf167eed07 100644 --- a/code/datums/components/bandage.dm +++ b/code/datums/components/bandage.dm @@ -32,7 +32,6 @@ if(lifespan <= 0) drop_bandage() - /datum/component/bandage/proc/bandage_effects() var/obj/item/bodypart/heal_target = parent lifespan -= 1 + heal_target.bleeding // particularly nasty bleeding can burn through dressing faster diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index f922d6589fda..70700851c9da 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -339,6 +339,7 @@ return bleeding = round(clamp(bleeding+value, 0, maximum), 0.001) +/// Checks if the bodypart is viable for bandaging, if it isn't, tells the person trying (if present) what's stopping it /obj/item/bodypart/proc/can_bandage(user) . = TRUE if(is_pseudopart) From 70d6e0c497a7ee81c0b159d5946703274e0f551f Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 20 May 2024 00:13:53 -0400 Subject: [PATCH 19/29] The last icecream sandwich is mine. Everyone else has had two and i have only had one --- code/modules/surgery/bodyparts/bodyparts.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 70700851c9da..0453a501d299 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -53,7 +53,7 @@ /// Threshold at which the limb will start bleeding if damaged by sharp items or projectiles var/bleed_threshold = 10 /// Threshold at which the limb will start bleeding if damaged by blunt items - var/bleed_threshold_blunt = 40 + var/bleed_threshold_blunt = 25 /// Minimum damage of an incoming attack for it to cause bleeding var/bleed_damage_min = 5 /// Minimum damage of an incoming blunt attack for it to cause bleeding @@ -248,7 +248,7 @@ // Bleeding is applied here if(brute_dam+brute >= (sharpness ? bleed_threshold : bleed_threshold_blunt) && brute >= (sharpness ? bleed_damage_min : bleed_damage_min_blunt)) - adjust_bleeding(brute/max_damage, BLOOD_LOSS_DAMAGE_CAP) + adjust_bleeding(brute * BLOOD_LOSS_DAMAGE_COEFF, BLOOD_LOSS_DAMAGE_CAP) var/can_inflict = max_damage - get_damage() if(can_inflict <= 0) @@ -289,7 +289,7 @@ if(brute) set_brute_dam(round(max(brute_dam - brute, 0), DAMAGE_PRECISION)) - adjust_bleeding(-brute/max_damage) + adjust_bleeding(-brute * BLOOD_LOSS_DAMAGE_COEFF) if(burn) set_burn_dam(round(max(burn_dam - burn, 0), DAMAGE_PRECISION)) if(stamina) From 5459c274ff4a3144f9cc4ab02a0ddb1c5c76b6ea Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 20 May 2024 00:25:53 -0400 Subject: [PATCH 20/29] numbers and stuff that slipped --- code/__DEFINES/mobs.dm | 1 + code/game/machinery/suit_storage_unit.dm | 2 +- code/game/objects/items/stacks/medical.dm | 4 ++-- code/game/objects/items/stacks/tape.dm | 2 +- code/modules/mob/living/carbon/carbon_defense.dm | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 37b8b17ea74f..cfd051bfdca3 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -30,6 +30,7 @@ // Bloodloss #define BLOOD_LOSS_MAXIMUM 30 +#define BLOOD_LOSS_DAMAGE_COEFF 0.013 #define BLOOD_LOSS_DAMAGE_CAP 2 #define BLOOD_CAUTERIZATION_RATIO 10 #define BLOOD_CAUTERIZATION_DAMAGE_RATIO 300 diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index e05dd8d16ff8..f516ea44b3a4 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -438,7 +438,7 @@ for(var/obj/item/bodypart/grilling as anything in bacon.get_bleeding_parts(TRUE)) if(!grilling.can_bandage()) continue - grilling.apply_bandage(0.02, 600, "cauterization") + grilling.apply_bandage(0.005, 600, "cauterization") playsound(src, 'sound/machines/airlocks/standard/close.ogg', 25, TRUE) var/list/things_to_clear = list() //Done this way since using GetAllContents on the SSU itself would include circuitry and such. if(suit) diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 1c5abcac13ed..d49472d61e37 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -142,7 +142,7 @@ singular_name = "medical gauze" icon_state = "gauze" apply_sounds = list('sound/effects/rip1.ogg', 'sound/effects/rip2.ogg') - var/bleed_reduction = 0.05 + var/bleed_reduction = 0.02 var/lifespan = 150 self_delay = 20 @@ -184,7 +184,7 @@ name = "improvised gauze" singular_name = "improvised gauze" desc = "A roll of cloth roughly cut from something that can stop bleeding and slowly heal wounds." - bleed_reduction = 0.025 + bleed_reduction = 0.005 /obj/item/stack/medical/gauze/cyborg custom_materials = null diff --git a/code/game/objects/items/stacks/tape.dm b/code/game/objects/items/stacks/tape.dm index e442717e9181..f27f80888635 100644 --- a/code/game/objects/items/stacks/tape.dm +++ b/code/game/objects/items/stacks/tape.dm @@ -81,7 +81,7 @@ usesound = 'sound/items/tape.ogg' var/lifespan = 300 - var/bleed_reduction = 0.01 + var/bleed_reduction = 0.002 var/nonorganic_heal = 5 var/self_delay = 30 //! Also used for the tapecuff delay var/other_delay = 10 diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 7f5b26a0d9bb..61a9cfe27a2f 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -14,7 +14,7 @@ user.visible_message(span_nicegreen("[user] holds [W] up to [user == src ? "their" : "[src]'s"] [parse_zone(BP.body_zone)], trying to slow [p_their()] bleeding..."), span_nicegreen("You hold [W] up to [user == src ? "your" : "[src]'s"] [parse_zone(BP.body_zone)], trying to slow [user == src ? "your" : p_their()] bleeding...")) if(do_after(user, heal_time, target = src)) playsound(user, 'sound/surgery/cautery2.ogg', 20) - BP.apply_bandage(0.02, W.get_temperature()/BLOOD_CAUTERIZATION_RATIO, "cauterization") + BP.apply_bandage(0.005, W.get_temperature()/BLOOD_CAUTERIZATION_RATIO, "cauterization") BP.receive_damage(burn = W.get_temperature()/BLOOD_CAUTERIZATION_DAMAGE_RATIO) //my body is a MACHINE that turns BLEEDING into BURN DAMAGE user.visible_message(span_nicegreen("[user] cauterizes some of [user == src ? "their" : "[src]'s"] bleeding!"), span_nicegreen("You cauterize some of [user == src ? "your" : "[src]'s"] bleeding!")) else From 542ab2afe9689dc81502e5972d13bab80c88a098 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 20 May 2024 00:58:22 -0400 Subject: [PATCH 21/29] Words --- code/datums/status_effects/debuffs.dm | 2 +- code/game/objects/items/stacks/medical.dm | 1 - code/modules/mob/living/blood.dm | 12 ------------ code/modules/mob/living/carbon/carbon_defense.dm | 6 +++--- code/modules/mob/living/carbon/human/examine.dm | 7 +++---- code/modules/surgery/bodyparts/bodyparts.dm | 1 - 6 files changed, 7 insertions(+), 22 deletions(-) diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index 86b2f85198f2..02b96c1b81de 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -335,7 +335,7 @@ /datum/status_effect/neck_slice/tick() var/mob/living/carbon/human/H = owner var/obj/item/bodypart/throat_in_question = H.get_bodypart(BODY_ZONE_HEAD) - if(H.stat == DEAD || throat_in_question?.bleeding <= 8) + if(H.stat == DEAD || throat_in_question?.bleeding <= 8) H.remove_status_effect(/datum/status_effect/neck_slice) if(prob(10)) H.emote(pick("gasp", "gag", "choke")) diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index d49472d61e37..842c880d2ed9 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -143,7 +143,6 @@ icon_state = "gauze" apply_sounds = list('sound/effects/rip1.ogg', 'sound/effects/rip2.ogg') var/bleed_reduction = 0.02 - var/lifespan = 150 self_delay = 20 max_amount = 12 diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index e4ab59b27c76..8a3b0db4acd2 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -4,18 +4,6 @@ BLOOD SYSTEM ****************************************************/ -/*mob/living/carbon/human/proc/suppress_bloodloss(amount) //KILLING these - if(bleedsuppress) - return - else - bleedsuppress = TRUE - addtimer(CALLBACK(src, PROC_REF(resume_bleeding)), amount) - -/mob/living/carbon/human/proc/resume_bleeding() - if(stat != DEAD && get_bleeding_parts(TRUE)) - to_chat(src, "The blood soaks through your bandage.")*/ - - /mob/living/carbon/monkey/handle_blood() if(bodytemperature >= TCRYO && !(HAS_TRAIT(src, TRAIT_HUSK))) //cryosleep or husked people do not pump the blood. //Blood regeneration if there is some space diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 61a9cfe27a2f..dc99d778f8b1 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -3,7 +3,7 @@ var/has_painkillers = user.reagents.has_reagent(/datum/reagent/medicine/morphine, needs_metabolizing = TRUE) if(W.tool_behaviour == TOOL_WELDER && IS_ROBOTIC_LIMB(BP) && BP.brute_dam > 5) //prioritize healing if we're synthetic return ..() - if(!user.a_intent == INTENT_HELP || !W.get_temperature() || BP.can_bandage()) //this will also catch low damage synthetic welding + if(!user.a_intent == INTENT_HELP || !W.get_temperature() || !BP.can_bandage()) //this will also catch low damage synthetic welding return ..() . = TRUE var/heal_time = 2 SECONDS @@ -14,9 +14,9 @@ user.visible_message(span_nicegreen("[user] holds [W] up to [user == src ? "their" : "[src]'s"] [parse_zone(BP.body_zone)], trying to slow [p_their()] bleeding..."), span_nicegreen("You hold [W] up to [user == src ? "your" : "[src]'s"] [parse_zone(BP.body_zone)], trying to slow [user == src ? "your" : p_their()] bleeding...")) if(do_after(user, heal_time, target = src)) playsound(user, 'sound/surgery/cautery2.ogg', 20) - BP.apply_bandage(0.005, W.get_temperature()/BLOOD_CAUTERIZATION_RATIO, "cauterization") + BP.apply_bandage(0.005, W.get_temperature()/BLOOD_CAUTERIZATION_RATIO, "cauterization") //not particularly fast, this is the "I really would prefer not to be bleeding right now" option BP.receive_damage(burn = W.get_temperature()/BLOOD_CAUTERIZATION_DAMAGE_RATIO) //my body is a MACHINE that turns BLEEDING into BURN DAMAGE - user.visible_message(span_nicegreen("[user] cauterizes some of [user == src ? "their" : "[src]'s"] bleeding!"), span_nicegreen("You cauterize some of [user == src ? "your" : "[src]'s"] bleeding!")) + user.visible_message(span_nicegreen("[user] cauterizes the bleeding on [user == src ? "their" : "[src]'s"] [parse_zone(BP.body_zone)]!"), span_nicegreen("You cauterize the bleeding on [user == src ? "your" : "[src]'s"] [parse_zone(BP.body_zone)]!")) else to_chat(user, span_warning("You were interrupted!")) diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index e1a0a7ef3832..930d6f6886d9 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -259,7 +259,7 @@ if(LAZYLEN(get_bandaged_parts())) - msg += "[t_He] [t_is] bandaged with something.\n" + msg += "[t_He] [t_has] some dressed bleeding.\n" var/list/obj/item/bodypart/bleed_check = get_bleeding_parts(TRUE) if(LAZYLEN(bleed_check)) @@ -268,7 +268,6 @@ else msg += "[t_He] [t_is] bleeding!\n" - if(reagents.has_reagent(/datum/reagent/teslium, needs_metabolizing = TRUE)) msg += "[t_He] [t_is] emitting a gentle blue glow!\n" @@ -420,7 +419,7 @@ . = ..() for(var/obj/item/bodypart/BP as anything in get_bandaged_parts()) var/datum/component/bandage/B = BP.GetComponent(/datum/component/bandage) - . += span_notice("Their [parse_zone(BP.body_zone)] is dressed with [B.bandage_name]") + . += span_notice("[p_their(TRUE)] [parse_zone(BP.body_zone)] is dressed with [B.bandage_name]") for(var/obj/item/bodypart/BP as anything in get_bleeding_parts(TRUE)) var/bleed_text switch(BP.bleeding) @@ -432,7 +431,7 @@ bleed_text = "heavily!" else bleed_text = "significantly!!" - . += span_warning("Their [parse_zone(BP.body_zone)] is bleeding [bleed_text]") + . += span_warning("[p_their(TRUE)] [parse_zone(BP.body_zone)] is bleeding [bleed_text]") if ((wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))) return diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 0453a501d299..d51816afeac4 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -213,7 +213,6 @@ heal_damage(0, 0, INFINITY, null, FALSE) . |= BODYPART_LIFE_UPDATE_HEALTH - //Applies brute and burn damage to the organ. Returns 1 if the damage-icon states changed at all. //Damage will not exceed max_damage using this proc //Cannot apply negative damage From df16825d20a3bb2f5aa3630ddc2c85b9fa907304 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 20 May 2024 01:11:36 -0400 Subject: [PATCH 22/29] waa --- code/datums/components/butchering.dm | 1 - code/modules/mob/living/carbon/carbon_defense.dm | 2 -- 2 files changed, 3 deletions(-) diff --git a/code/datums/components/butchering.dm b/code/datums/components/butchering.dm index a79083f1a318..7d3767a6aaa8 100644 --- a/code/datums/components/butchering.dm +++ b/code/datums/components/butchering.dm @@ -79,7 +79,6 @@ "[user] slits your throat...") log_combat(user, H, "finishes slicing the throat of") H.apply_damage(source.force, BRUTE, BODY_ZONE_HEAD) - throat_in_question.adjust_bleeding(20) H.apply_status_effect(/datum/status_effect/neck_slice) diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index dc99d778f8b1..b49334de55cd 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -19,8 +19,6 @@ user.visible_message(span_nicegreen("[user] cauterizes the bleeding on [user == src ? "their" : "[src]'s"] [parse_zone(BP.body_zone)]!"), span_nicegreen("You cauterize the bleeding on [user == src ? "your" : "[src]'s"] [parse_zone(BP.body_zone)]!")) else to_chat(user, span_warning("You were interrupted!")) - - /mob/living/carbon/get_eye_protection() . = ..() From cd97eea1a0299cdb7d07d99dea29939d4ccaf65f Mon Sep 17 00:00:00 2001 From: Theos Date: Mon, 20 May 2024 04:01:11 -0400 Subject: [PATCH 23/29] Reduce bleeding from embeds since it stacks more now Signed-off-by: Theos --- code/modules/mob/living/blood.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 8a3b0db4acd2..5eaa1a3af795 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -78,7 +78,7 @@ listclearnulls(BP.embedded_objects) for(var/obj/item/embeddies in BP.embedded_objects) if(!embeddies.isEmbedHarmless()) - BP.adjust_bleeding(0.5, BLOOD_LOSS_DAMAGE_CAP) + BP.adjust_bleeding(0.1, BLOOD_LOSS_DAMAGE_CAP) limb_bleed += BP.bleeding if(limb_bleed && !bleedsuppress && !HAS_TRAIT(src, TRAIT_FAKEDEATH)) From 72eb14d0a331b8e2a68f8c70b7b9db29af93830f Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Wed, 22 May 2024 17:31:30 -0400 Subject: [PATCH 24/29] WHOOPS --- code/modules/surgery/organic_steps.dm | 9 ++++++--- code/modules/surgery/surgery_helpers.dm | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/code/modules/surgery/organic_steps.dm b/code/modules/surgery/organic_steps.dm index da05176a2a7c..42018e6c1d87 100644 --- a/code/modules/surgery/organic_steps.dm +++ b/code/modules/surgery/organic_steps.dm @@ -31,7 +31,8 @@ "Blood pools around the incision in [H]'s [parse_zone(target_zone)].", "") var/obj/item/bodypart/BP = H.get_bodypart(check_zone(surgery.location)) - BP.adjust_bleeding(3) + if(BP) + BP.adjust_bleeding(3) return ..() /datum/surgery_step/incise/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) @@ -76,7 +77,8 @@ if (ishuman(target)) var/mob/living/carbon/human/H = target var/obj/item/bodypart/BP = H.get_bodypart(check_zone(surgery.location)) - BP.adjust_bleeding(-3) + if(BP) + BP.adjust_bleeding(-3) return ..() /datum/surgery_step/clamp_bleeders/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) @@ -140,7 +142,8 @@ if (ishuman(target)) var/mob/living/carbon/human/H = target var/obj/item/bodypart/BP = H.get_bodypart(check_zone(surgery.location)) - BP.adjust_bleeding(-3) + if(BP) + BP.adjust_bleeding(-3) return ..() //saw bone diff --git a/code/modules/surgery/surgery_helpers.dm b/code/modules/surgery/surgery_helpers.dm index 709975ecd518..94209d276aa2 100644 --- a/code/modules/surgery/surgery_helpers.dm +++ b/code/modules/surgery/surgery_helpers.dm @@ -116,7 +116,8 @@ if(ishuman(M)) var/mob/living/carbon/human/H = M var/obj/item/bodypart/BP = H.get_bodypart(check_zone(S.location)) - BP.adjust_bleeding(-3) + if(BP) + BP.adjust_bleeding(-3) M.surgeries -= S user.visible_message("[user] closes [M]'s [parse_zone(selected_zone)] with [close_tool] and stops the surgery.", \ "You close [M]'s [parse_zone(selected_zone)] with [close_tool] and stop the surgery.") From 0f42e6a25d90560f8a9eb52bc318f6dbb4e9edbe Mon Sep 17 00:00:00 2001 From: Theos Date: Wed, 22 May 2024 21:11:48 -0400 Subject: [PATCH 25/29] Improves bloodloss reduction from brute healing Signed-off-by: Theos --- code/modules/surgery/bodyparts/bodyparts.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index d51816afeac4..4167af92a445 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -288,7 +288,7 @@ if(brute) set_brute_dam(round(max(brute_dam - brute, 0), DAMAGE_PRECISION)) - adjust_bleeding(-brute * BLOOD_LOSS_DAMAGE_COEFF) + adjust_bleeding(-BLOOD_LOSS_MAXIMUM * brute / max_damage) if(burn) set_burn_dam(round(max(burn_dam - burn, 0), DAMAGE_PRECISION)) if(stamina) From 49c0b8fc30371ac18c003055b7ad13abbd01abce Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Thu, 23 May 2024 11:26:31 -0400 Subject: [PATCH 26/29] self help displays openly bleeding limbs --- code/modules/mob/living/carbon/human/human_defense.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index e8034dcf13f0..eb06e5e458ef 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -776,10 +776,10 @@ combined_msg += "\t There is \a [I] embedded in your [LB.name]!" for(var/t in missing) - combined_msg += "Your [parse_zone(t)] is missing!" + combined_msg += span_boldannounce("Your [parse_zone(t)] is missing!") - if(LAZYLEN(get_bleeding_parts())) - combined_msg += "You are bleeding!" + for(var/obj/item/bodypart/BP in get_bleeding_parts(TRUE)) + combined_msg += span_danger("Your [parse_zone(BP.body_zone)] is bleeding!") if(getStaminaLoss()) if(getStaminaLoss() > 30) combined_msg += "You're completely exhausted." From 5feeea44320f526b57302c1ea07d150cd5e4f792 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Thu, 23 May 2024 14:06:11 -0400 Subject: [PATCH 27/29] Fully healed limbs will now slowly stop bleeding if any is left --- code/__DEFINES/mobs.dm | 4 ++-- code/modules/mob/living/blood.dm | 2 +- code/modules/surgery/bodyparts/bodyparts.dm | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 8d54bd762e9e..4b5b56af7be6 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -30,8 +30,8 @@ // Bloodloss #define BLOOD_LOSS_MAXIMUM 30 -#define BLOOD_LOSS_DAMAGE_COEFF 0.013 -#define BLOOD_LOSS_DAMAGE_CAP 2 +#define BLOOD_LOSS_DAMAGE_MAXIMUM 2 +#define BLOOD_LOSS_DAMAGE_BASE 0.013 #define BLOOD_CAUTERIZATION_RATIO 10 #define BLOOD_CAUTERIZATION_DAMAGE_RATIO 300 diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 5eaa1a3af795..1910347e4fdd 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -78,7 +78,7 @@ listclearnulls(BP.embedded_objects) for(var/obj/item/embeddies in BP.embedded_objects) if(!embeddies.isEmbedHarmless()) - BP.adjust_bleeding(0.1, BLOOD_LOSS_DAMAGE_CAP) + BP.adjust_bleeding(0.1, BLOOD_LOSS_DAMAGE_MAXIMUM) limb_bleed += BP.bleeding if(limb_bleed && !bleedsuppress && !HAS_TRAIT(src, TRAIT_FAKEDEATH)) diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 4167af92a445..0222fa6afeee 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -212,6 +212,8 @@ if(stamina_dam > DAMAGE_PRECISION && owner.stam_regen_start_time <= world.time) //DO NOT update health here, it'll be done in the carbon's life. heal_damage(0, 0, INFINITY, null, FALSE) . |= BODYPART_LIFE_UPDATE_HEALTH + if(brute_dam < DAMAGE_PRECISION && bleeding) + adjust_bleeding(-0.2) //slowly stop bleeding if there's no damage left //Applies brute and burn damage to the organ. Returns 1 if the damage-icon states changed at all. //Damage will not exceed max_damage using this proc @@ -247,7 +249,7 @@ // Bleeding is applied here if(brute_dam+brute >= (sharpness ? bleed_threshold : bleed_threshold_blunt) && brute >= (sharpness ? bleed_damage_min : bleed_damage_min_blunt)) - adjust_bleeding(brute * BLOOD_LOSS_DAMAGE_COEFF, BLOOD_LOSS_DAMAGE_CAP) + adjust_bleeding(brute * BLOOD_LOSS_DAMAGE_BASE, BLOOD_LOSS_DAMAGE_MAXIMUM) var/can_inflict = max_damage - get_damage() if(can_inflict <= 0) @@ -288,7 +290,7 @@ if(brute) set_brute_dam(round(max(brute_dam - brute, 0), DAMAGE_PRECISION)) - adjust_bleeding(-BLOOD_LOSS_MAXIMUM * brute / max_damage) + adjust_bleeding(-BLOOD_LOSS_DAMAGE_MAXIMUM * brute / max_damage) if(burn) set_burn_dam(round(max(burn_dam - burn, 0), DAMAGE_PRECISION)) if(stamina) From 715f3f4918d9ac0b9f7b90b27daaab2512a37361 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 27 May 2024 07:22:41 -0400 Subject: [PATCH 28/29] Delimb support and some tuning --- code/__DEFINES/dcs/signals.dm | 2 ++ code/datums/components/bandage.dm | 23 +++++++++++++++---- .../surgery/bodyparts/dismemberment.dm | 1 + 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 408e0c77805c..0902b211f264 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -423,6 +423,8 @@ ///from base of /obj/item/bodypart/proc/attach_limb(): (new_limb, special) allows you to fail limb attachment #define COMSIG_LIVING_ATTACH_LIMB "living_attach_limb" #define COMPONENT_NO_ATTACH 1 +///from base of /obj/item/bodypart/proc/drop_limb(): (special) +#define COMSIG_LIVING_DROP_LIMB "living_drop_limb" ///from base of mob/living/set_buckled(): (new_buckled) #define COMSIG_LIVING_SET_BUCKLED "living_set_buckled" diff --git a/code/datums/components/bandage.dm b/code/datums/components/bandage.dm index f9bf167eed07..16f6a2f0b059 100644 --- a/code/datums/components/bandage.dm +++ b/code/datums/components/bandage.dm @@ -24,24 +24,37 @@ bandage_name = _bandage_name RegisterSignal(mummy, COMSIG_MOB_APPLY_DAMGE, PROC_REF(check_damage)) RegisterSignal(mummy, COMSIG_MOB_LIFE, PROC_REF(bandage_effects)) + RegisterSignal(parent, COMSIG_LIVING_DROP_LIMB, PROC_REF(drop_bandage)) + +/// Checks if damage to the owner is applied to this limb and reduces lifespan (perforated bandages dont work as well) +/datum/component/bandage/proc/check_damage(attacker, damage, damagetype = BRUTE, def_zone = null) + SIGNAL_HANDLER -/datum/component/bandage/proc/check_damage(damage, damagetype = BRUTE, def_zone = null) if(parent != mummy.get_bodypart(check_zone(def_zone))) return - lifespan = lifespan - damage / 100 * initial(lifespan) * TREATMENT_DAMAGE_MOD //take incoming damage as a % of durability + lifespan -= damage / 100 * initial(lifespan) * TREATMENT_DAMAGE_MOD //take incoming damage as a % of durability if(lifespan <= 0) drop_bandage() +/// Handles healing effects and passive lifespan usage /datum/component/bandage/proc/bandage_effects() + SIGNAL_HANDLER + var/obj/item/bodypart/heal_target = parent lifespan -= 1 + heal_target.bleeding // particularly nasty bleeding can burn through dressing faster heal_target.adjust_bleeding(-bleed_reduction) if(lifespan <= 0 || !heal_target.bleeding) //remove treatment once it's no longer able to treat - drop_bandage() + drop_bandage(TRUE) + +/// Handles deleting the component when the bandage runs out of lifespan or finishes healing. Special = bandage didn't get torn off +/datum/component/bandage/proc/drop_bandage(special = FALSE) + SIGNAL_HANDLER -/datum/component/bandage/proc/drop_bandage() var/obj/item/bodypart/BP = parent - to_chat(mummy, span_notice("The [bandage_name] on your [parse_zone(BP.body_zone)] has [BP.bleeding ? "done what it can" : "stopped the bleeding"].")) + if(special) + to_chat(mummy, span_notice("The [bandage_name] on your [parse_zone(BP.body_zone)] has [BP.bleeding ? "done what it can" : "stopped the bleeding"].")) + else + to_chat(mummy, span_warning("The [bandage_name] on your [parse_zone(BP.body_zone)] is damaged beyond use!")) qdel(src) #undef TREATMENT_DAMAGE_MOD diff --git a/code/modules/surgery/bodyparts/dismemberment.dm b/code/modules/surgery/bodyparts/dismemberment.dm index 7c292ac21fc4..07d30e727c77 100644 --- a/code/modules/surgery/bodyparts/dismemberment.dm +++ b/code/modules/surgery/bodyparts/dismemberment.dm @@ -90,6 +90,7 @@ return var/atom/Tsec = owner.drop_location() var/mob/living/carbon/C = owner + SEND_SIGNAL(src, COMSIG_LIVING_DROP_LIMB) update_limb(TRUE) C.remove_bodypart(src) From 707ac6ad0bb2d11a99b4e7da784e6e0462f513b9 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 27 May 2024 07:24:48 -0400 Subject: [PATCH 29/29] uogh --- code/modules/mob/living/carbon/carbon_defense.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index b49334de55cd..026476d8eced 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -3,7 +3,7 @@ var/has_painkillers = user.reagents.has_reagent(/datum/reagent/medicine/morphine, needs_metabolizing = TRUE) if(W.tool_behaviour == TOOL_WELDER && IS_ROBOTIC_LIMB(BP) && BP.brute_dam > 5) //prioritize healing if we're synthetic return ..() - if(!user.a_intent == INTENT_HELP || !W.get_temperature() || !BP.can_bandage()) //this will also catch low damage synthetic welding + if(user.a_intent != INTENT_HELP || !W.get_temperature() || !BP.can_bandage()) //this will also catch low damage synthetic welding return ..() . = TRUE var/heal_time = 2 SECONDS