From f23ac594992610f0f9c489b72018a3b7b4211d53 Mon Sep 17 00:00:00 2001 From: Zwei <35403274+Gottfrei@users.noreply.github.com> Date: Mon, 5 Aug 2024 05:46:35 +0300 Subject: [PATCH] bugfix: Correct Health Updates (#5657) Correct Update Health Updates --- .../advance/symptoms/damage_converter.dm | 24 ++++++-- code/game/dna/genes/goon_powers.dm | 13 +++-- code/game/objects/items/stacks/medical.dm | 19 +++++- code/game/objects/items/stacks/nanopaste.dm | 19 ++++-- .../objects/items/weapons/storage/bible.dm | 16 ++++- code/modules/mob/living/carbon/human/human.dm | 10 +++- .../mob/living/carbon/human/human_damage.dm | 58 ++++++++++++++----- .../mob/living/carbon/human/human_defense.dm | 34 ++++++++--- code/modules/mob/living/damage_procs.dm | 18 ++++-- code/modules/power/cable_coil.dm | 15 +++-- .../reagents/chemistry/reagents/medicine.dm | 20 ++----- .../reagents/reagent_containers/applicator.dm | 3 +- code/modules/surgery/organs/organ_external.dm | 20 ++++--- 13 files changed, 194 insertions(+), 75 deletions(-) diff --git a/code/datums/diseases/viruses/advance/symptoms/damage_converter.dm b/code/datums/diseases/viruses/advance/symptoms/damage_converter.dm index c1db27ac285..de7e2eec66b 100644 --- a/code/datums/diseases/viruses/advance/symptoms/damage_converter.dm +++ b/code/datums/diseases/viruses/advance/symptoms/damage_converter.dm @@ -41,15 +41,27 @@ Bonus if(ishuman(M)) var/mob/living/carbon/human/H = M - var/list/parts = H.get_damaged_organs(TRUE, TRUE, AFFECT_ORGANIC_ORGAN) //1,1 because it needs inputs. + var/list/parts = H.get_damaged_organs(1, 1, AFFECT_ORGANIC_ORGAN) //1,1 because it needs inputs. - if(!parts.len) + if(!length(parts)) return var/healed = 0 - for(var/obj/item/organ/external/E as anything in parts) - healed += min(E.brute_dam, get_damage) + min(E.burn_dam, get_damage) - E.heal_damage(get_damage, get_damage, updating_health = TRUE) - M.adjustToxLoss(healed) + var/update_health = STATUS_UPDATE_NONE + var/update_damage_icon = NONE + for(var/obj/item/organ/external/bodypart as anything in parts) + var/brute_was = bodypart.brute_dam + var/burn_was = bodypart.burn_dam + update_damage_icon |= bodypart.heal_damage(get_damage, get_damage, updating_health = TRUE) + if(bodypart.brute_dam != brute_was || bodypart.burn_dam != burn_was) + update_health |= STATUS_UPDATE_HEALTH + healed += max(((bodypart.brute_dam - brute_was) + (bodypart.burn_dam - burn_was)), get_damage) + + if(healed) + update_health |= H.apply_damage(healed, TOX) + if(update_health) + H.updatehealth("[name]") + if(update_damage_icon) + H.UpdateDamageIcon() else if(M.getFireLoss() > 0 || M.getBruteLoss() > 0) diff --git a/code/game/dna/genes/goon_powers.dm b/code/game/dna/genes/goon_powers.dm index 72114844a0e..48dc4045ded 100644 --- a/code/game/dna/genes/goon_powers.dm +++ b/code/game/dna/genes/goon_powers.dm @@ -247,7 +247,8 @@ /obj/effect/proc_holder/spell/eat/proc/doHeal(mob/user) if(ishuman(user)) var/mob/living/carbon/human/H = user - var/update = NONE + var/should_update_health = FALSE + var/update_damage_icon = NONE for(var/name in H.bodyparts_by_name) var/obj/item/organ/external/affecting = null if(!H.bodyparts_by_name[name]) @@ -255,10 +256,14 @@ affecting = H.bodyparts_by_name[name] if(!isexternalorgan(affecting)) continue - update |= affecting.heal_damage(4, 0, updating_health = FALSE) - if(update) + var/brute_was = affecting.brute_dam + update_damage_icon |= affecting.heal_damage(4, updating_health = FALSE) + if(affecting.brute_dam != brute_was) + should_update_health = TRUE + if(should_update_health) + H.updatehealth("[name] heal") + if(update_damage_icon) H.UpdateDamageIcon() - H.updatehealth() /obj/effect/proc_holder/spell/eat/cast(list/targets, mob/user = usr) diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 47b2d73442f..0715090f012 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -102,7 +102,13 @@ var/remburn = max(0, heal_burn - affecting.burn_dam) // And deduct it from their health (aka deal damage) var/nrembrute = rembrute var/nremburn = remburn - affecting.heal_damage(heal_brute, heal_burn) + var/should_update_health = FALSE + var/update_damage_icon = NONE + var/affecting_brute_was = affecting.brute_dam + var/affecting_burn_was = affecting.burn_dam + update_damage_icon |= affecting.heal_damage(heal_brute, heal_burn, updating_health = FALSE) + if(affecting.brute_dam != affecting_brute_was || affecting.burn_dam != affecting_burn_was) + should_update_health = TRUE var/list/achildlist if(LAZYLEN(affecting.children)) achildlist = affecting.children.Copy() @@ -122,11 +128,20 @@ continue nrembrute = max(0, rembrute - E.brute_dam) // Deduct the healed damage from the remain nremburn = max(0, remburn - E.burn_dam) - E.heal_damage(rembrute, remburn) + var/brute_was = E.brute_dam + var/burn_was = E.burn_dam + update_damage_icon |= E.heal_damage(rembrute, remburn, updating_health = FALSE) + if(E.brute_dam != brute_was || E.burn_dam != burn_was) + should_update_health = TRUE rembrute = nrembrute remburn = nremburn user.visible_message("[user] [healverb]s the wounds on [H]'s [E.name] with the remaining medication.", \ "You [healverb] the wounds on [H]'s [E.name] with the remaining medication." ) + if(should_update_health) + H.updatehealth("[name] heal") + if(update_damage_icon) + H.UpdateDamageIcon() + //Bruise Packs// diff --git a/code/game/objects/items/stacks/nanopaste.dm b/code/game/objects/items/stacks/nanopaste.dm index 1bd8ff21da3..56ed6c10363 100644 --- a/code/game/objects/items/stacks/nanopaste.dm +++ b/code/game/objects/items/stacks/nanopaste.dm @@ -14,14 +14,14 @@ /obj/item/stack/nanopaste/cyborg is_cyborg = 1 -/obj/item/stack/nanopaste/cyborg/attack(mob/living/M as mob, mob/user as mob) +/obj/item/stack/nanopaste/cyborg/attack(mob/living/M, mob/user) if(!get_amount()) to_chat(user, "Not enough nanopaste!") return else . = ..() -/obj/item/stack/nanopaste/attack(mob/living/M as mob, mob/user as mob) +/obj/item/stack/nanopaste/attack(mob/living/M, mob/user) if(!istype(M) || !istype(user)) return 0 if(istype(M,/mob/living/silicon/robot)) //Repairing cyborgs @@ -49,11 +49,12 @@ use(1) var/remheal = 15 var/nremheal = 0 - S.heal_damage(robo_repair = TRUE) //should in, theory, heal the robotic organs in just the targeted area with it being S instead of E var/childlist if(LAZYLEN(S.children)) childlist = S.children.Copy() var/parenthealed = FALSE + var/should_update_health = FALSE + var/update_damage_icon = NONE while(remheal > 0) var/obj/item/organ/external/E if(S.get_damage()) @@ -70,11 +71,17 @@ else break nremheal = max(remheal - E.get_damage(), 0) - E.heal_damage(remheal, 0, FALSE, TRUE) //Healing Brute - E.heal_damage(0, remheal, FALSE, TRUE) //Healing Burn + var/brute_was = E.brute_dam + var/burn_was = E.burn_dam + update_damage_icon |= E.heal_damage(remheal, remheal, FALSE, TRUE, FALSE) + if(E.brute_dam != brute_was || E.burn_dam != burn_was) + should_update_health = TRUE remheal = nremheal - H.UpdateDamageIcon() user.visible_message("\The [user] applies some nanite paste at \the [M]'s [E.name] with \the [src].") + if(should_update_health) + H.updatehealth("nanopaste repair") + if(update_damage_icon) + H.UpdateDamageIcon() if(H.bleed_rate && ismachineperson(H)) H.bleed_rate = 0 else diff --git a/code/game/objects/items/weapons/storage/bible.dm b/code/game/objects/items/weapons/storage/bible.dm index 07514aaa0b0..1a62f3ee4a9 100644 --- a/code/game/objects/items/weapons/storage/bible.dm +++ b/code/game/objects/items/weapons/storage/bible.dm @@ -62,16 +62,26 @@ new /obj/item/stack/spacecash(src) new /obj/item/stack/spacecash(src) + //BS12 EDIT // All cult functionality moved to Null Rod /obj/item/storage/bible/proc/bless(mob/living/carbon/M) if(ishuman(M)) var/mob/living/carbon/human/H = M var/heal_amt = 10 + var/should_update_health = FALSE + var/update_damage_icon = NONE for(var/obj/item/organ/external/affecting as anything in H.bodyparts) - if(affecting.heal_damage(heal_amt, heal_amt)) - H.UpdateDamageIcon() - return + var/brute_was = affecting.brute_dam + var/burn_was = affecting.burn_dam + update_damage_icon |= affecting.heal_damage(heal_amt, heal_amt, updating_health = FALSE) + if(affecting.brute_dam != brute_was || affecting.burn_dam != burn_was) + should_update_health = TRUE + if(should_update_health) + M.updatehealth("bless heal") + if(update_damage_icon) + M.UpdateDamageIcon() + /obj/item/storage/bible/proc/god_forgive() god_punishment = max(0, god_punishment - round((world.time - last_used) / (30 SECONDS))) //forgive 1 sin every 30 seconds diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 9d25215e315..7658a172bb5 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1143,13 +1143,18 @@ dna.species.create_organs(src, missing_bodyparts, additional_organs) //Apply relevant damages and variables to the new organs. + var/should_update_health = FALSE for(var/obj/item/organ/external/bodypart as anything in bodyparts) for(var/stats in bodypart_damages) if(bodypart.limb_zone == stats["zone"]) var/brute_dmg = stats["brute"] var/burn_dmg = stats["burn"] if(brute_dmg || burn_dmg) - bodypart.external_receive_damage(brute_dmg, burn_dmg, forced = TRUE, silent = TRUE) + var/brute_was = bodypart.brute_dam + var/burn_was = bodypart.burn_dam + bodypart.external_receive_damage(brute_dmg, burn_dmg, forced = TRUE, updating_health = FALSE, silent = TRUE) + if(bodypart.brute_dam != brute_was || bodypart.burn_dam != burn_was) + should_update_health = TRUE var/status = stats["status"] if(status & ORGAN_INT_BLEED) bodypart.internal_bleeding(silent = TRUE) @@ -1163,6 +1168,9 @@ bodypart.mutate(silent = TRUE) break + if(should_update_health) + updatehealth("set_species damage retain") + for(var/obj/item/organ/internal/organ as anything in internal_organs) for(var/stats in internal_damages) if(organ.slot == stats["slot"]) diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 684ccaf4ead..435d84d8664 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -332,9 +332,16 @@ ) . = STATUS_UPDATE_NONE var/obj/item/organ/external/picked = safepick(get_damaged_organs(brute, burn, flags = affect_robotic ? AFFECT_ALL_ORGANS : AFFECT_ORGANIC_ORGAN)) - if(picked?.heal_damage(brute, burn, internal, affect_robotic, updating_health)) + if(!picked) + return . + var/brute_was = picked.brute_dam + var/burn_was = picked.burn_dam + if(picked.heal_damage(brute, burn, internal, affect_robotic, updating_health = FALSE)) UpdateDamageIcon() - return STATUS_UPDATE_HEALTH + if(picked.brute_dam != brute_was || picked.burn_dam != burn_was) + . |= STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth("heal organ damage") /mob/living/carbon/human/take_organ_damage( @@ -352,9 +359,16 @@ return ..() . = STATUS_UPDATE_NONE var/obj/item/organ/external/picked = safepick(get_damageable_organs(affect_robotic)) - if(picked?.external_receive_damage(brute, burn, blocked, sharp, used_weapon, forced = forced, updating_health = updating_health, silent = silent)) + if(!picked) + return . + var/brute_was = picked.brute_dam + var/burn_was = picked.burn_dam + if(picked.external_receive_damage(brute, burn, blocked, sharp, used_weapon, forced = forced, updating_health = FALSE, silent = silent)) UpdateDamageIcon() - return STATUS_UPDATE_HEALTH + if(QDELETED(picked) || picked.loc != src || picked.brute_dam != brute_was || picked.burn_dam != burn_was) + . |= STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth("take organ damage") /mob/living/carbon/human/heal_overall_damage( @@ -370,26 +384,35 @@ brute = abs(brute) burn = abs(burn) - var/list/obj/item/organ/external/parts = get_damaged_organs(brute, burn) + var/list/obj/item/organ/external/parts = get_damaged_organs(brute, burn, flags = affect_robotic ? AFFECT_ALL_ORGANS : AFFECT_ORGANIC_ORGAN) - var/update = NONE + var/should_update_health = FALSE + var/update_damage_icon = NONE while(parts.len && (brute > 0 || burn > 0)) var/obj/item/organ/external/picked = pick(parts) var/brute_per_part = round(brute/parts.len, DAMAGE_PRECISION) var/burn_per_part = round(burn/parts.len, DAMAGE_PRECISION) - update |= picked.heal_damage(brute_per_part, burn_per_part, internal, affect_robotic, updating_health = FALSE) + var/brute_was = picked.brute_dam + var/burn_was = picked.burn_dam + + update_damage_icon |= picked.heal_damage(brute_per_part, burn_per_part, internal, affect_robotic, updating_health = FALSE) + + if(picked.brute_dam != brute_was || picked.burn_dam != burn_was) + should_update_health = TRUE brute = max(brute - brute_per_part, 0) burn = max(burn - burn_per_part, 0) parts -= picked - if(update) + if(should_update_health) + . |= STATUS_UPDATE_HEALTH if(updating_health) updatehealth("heal overall damage") + + if(update_damage_icon) UpdateDamageIcon() - return STATUS_UPDATE_HEALTH /mob/living/carbon/human/take_overall_damage( @@ -416,24 +439,33 @@ brute = abs(brute) burn = abs(burn) - var/update = NONE + var/should_update_health = FALSE + var/update_damage_icon = NONE while(parts.len && (brute > 0 || burn > 0)) var/obj/item/organ/external/picked = pick(parts) var/brute_per_part = round(brute/parts.len, DAMAGE_PRECISION) var/burn_per_part = round(burn/parts.len, DAMAGE_PRECISION) - update |= picked.external_receive_damage(brute_per_part, burn_per_part, blocked, sharp, used_weapon, forced = forced, updating_health = FALSE, silent = silent) + var/brute_was = picked.brute_dam + var/burn_was = picked.burn_dam + + update_damage_icon |= picked.external_receive_damage(brute_per_part, burn_per_part, blocked, sharp, used_weapon, forced = forced, updating_health = FALSE, silent = silent) + + if(QDELETED(picked) || picked.loc != src || picked.brute_dam != brute_was || picked.burn_dam != burn_was) + should_update_health = TRUE brute = max(brute - brute_per_part, 0) burn = max(burn - burn_per_part, 0) parts -= picked - if(update) + if(should_update_health) + . |= STATUS_UPDATE_HEALTH if(updating_health) updatehealth("take overall damage") + + if(update_damage_icon) UpdateDamageIcon() - return STATUS_UPDATE_HEALTH //////////////////////////////////////////// diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index a33f002bed5..bcbb0b1b754 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -109,6 +109,8 @@ emp_act if(LAZYLEN(S.children)) childlist = S.children.Copy() var/parenthealed = FALSE + var/should_update_health = FALSE + var/update_damage_icon = NONE while(rembrute > 0) var/obj/item/organ/external/E if(S.brute_dam) @@ -125,10 +127,16 @@ emp_act else break nrembrute = max(rembrute - E.brute_dam, 0) - E.heal_damage(rembrute, 0, FALSE, TRUE) + var/brute_was = E.brute_dam + update_damage_icon |= E.heal_damage(rembrute, 0, FALSE, TRUE, FALSE) + if(E.brute_dam != brute_was) + should_update_health = TRUE rembrute = nrembrute - H.UpdateDamageIcon() user.visible_message("[user] patches some dents on [src]'s [E.name] with [I].") + if(should_update_health) + H.updatehealth("welder repair") + if(update_damage_icon) + H.UpdateDamageIcon() if(bleed_rate && ismachineperson(src)) bleed_rate = 0 user.visible_message("[user] patches some leaks on [src] with [I].") @@ -362,20 +370,32 @@ emp_act damaged += . //DAMAGE// - var/update_damage = FALSE + var/should_update_health = FALSE + var/update_damage_icon = NONE for(var/obj/item/organ/external/affecting as anything in damaged) - if(affecting.external_receive_damage(acidity, 2 * acidity)) - update_damage = TRUE + var/brute_was = affecting.brute_dam + var/burn_was = affecting.burn_dam + update_damage_icon |= affecting.external_receive_damage(acidity, 2 * acidity, updating_health = FALSE) + if(QDELETED(affecting) || affecting.loc != src) + should_update_health = TRUE + continue + if(affecting.brute_dam != brute_was || affecting.burn_dam != burn_was) + should_update_health = TRUE if(!istype(affecting, /obj/item/organ/external/head) || !prob(min(acidpwr * acid_volume / 10, 90))) //Applies disfigurement continue var/obj/item/organ/external/head/head_organ = affecting - emote("scream") + if(has_pain()) + emote("scream") head_organ.h_style = "Bald" head_organ.f_style = "Shaved" update_hair() update_fhair() head_organ.disfigure() - if(update_damage) + + if(should_update_health) + updatehealth("acid act") + + if(update_damage_icon) UpdateDamageIcon() //MELTING INVENTORY ITEMS// diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index cda6b30daff..77f658e3290 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -42,19 +42,25 @@ if(BRUTE) if(isexternalorgan(def_zone)) var/obj/item/organ/external/bodypart = def_zone - if(bodypart.external_receive_damage(damage, 0, blocked, sharp, used_weapon, forced = forced, updating_health = updating_health, silent = silent)) - if(update_damage_icon) - UpdateDamageIcon() + var/brute_was = bodypart.brute_dam + if(bodypart.external_receive_damage(damage, 0, blocked, sharp, used_weapon, forced = forced, updating_health = FALSE, silent = silent) && update_damage_icon) + UpdateDamageIcon() + if(QDELETED(bodypart) || bodypart.loc != src || bodypart.brute_dam != brute_was) . |= STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth("apply damage") else . |= adjustBruteLoss(damage, updating_health, def_zone, blocked, forced, used_weapon, sharp, silent) if(BURN) if(isexternalorgan(def_zone)) var/obj/item/organ/external/bodypart = def_zone - if(bodypart.external_receive_damage(0, damage, blocked, sharp, used_weapon, forced = forced, updating_health = updating_health, silent = silent)) - if(update_damage_icon) - UpdateDamageIcon() + var/burn_was = bodypart.burn_dam + if(bodypart.external_receive_damage(0, damage, blocked, sharp, used_weapon, forced = forced, updating_health = FALSE, silent = silent) && update_damage_icon) + UpdateDamageIcon() + if(QDELETED(bodypart) || bodypart.loc != src || bodypart.burn_dam != burn_was) . |= STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth("apply damage") else . |= adjustFireLoss(damage, updating_health, def_zone, blocked, forced, used_weapon, sharp, silent) if(TOX) diff --git a/code/modules/power/cable_coil.dm b/code/modules/power/cable_coil.dm index 6e75246b415..f0e2b8e744e 100644 --- a/code/modules/power/cable_coil.dm +++ b/code/modules/power/cable_coil.dm @@ -175,6 +175,8 @@ var/cable_used = 0 var/list/childlist = LAZYLEN(target_organ.children) ? target_organ.children.Copy() : null var/parenthealed = FALSE + var/should_update_health = FALSE + var/update_damage_icon = NONE while(cable_used <= MAXCABLEPERHEAL && amount) var/obj/item/organ/external/current_organ if(target_organ.burn_dam) @@ -190,15 +192,18 @@ break else break - var/update = NONE + var/burn_was = current_organ.burn_dam while(cable_used <= MAXCABLEPERHEAL && current_organ.burn_dam && amount) use(1) cable_used++ - update |= current_organ.heal_damage(0, HEALPERCABLE, FALSE, TRUE, FALSE) - if(update) - target.updatehealth("cable repair") - target.UpdateDamageIcon() + update_damage_icon |= current_organ.heal_damage(0, HEALPERCABLE, FALSE, TRUE, FALSE) + if(current_organ.burn_dam != burn_was) + should_update_health = TRUE user.visible_message(span_alert("[user] repairs some burn damage on [target]'s [current_organ.name] with [src].")) + if(should_update_health) + target.updatehealth("cable repair") + if(update_damage_icon) + target.UpdateDamageIcon() return TRUE diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index 214f6afbab6..bfa1f17b6e5 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -238,18 +238,16 @@ /datum/reagent/medicine/silver_sulfadiazine/on_mob_life(mob/living/M) var/update_flags = STATUS_UPDATE_NONE - update_flags |= M.adjustFireLoss(-1, FALSE) + update_flags |= M.heal_damage_type(1, BURN, updating_health = FALSE) return ..() | update_flags /datum/reagent/medicine/silver_sulfadiazine/reaction_mob(mob/living/M, method=REAGENT_TOUCH, volume, show_message = 1) if(iscarbon(M)) if(method == REAGENT_TOUCH) - M.adjustFireLoss(-volume) - if(show_message) + if(M.heal_damage_type(volume, BURN) && show_message) to_chat(M, "The silver sulfadiazine soothes your burns.") if(method == REAGENT_INGEST) - M.adjustToxLoss(0.5*volume) - if(show_message) + if(M.apply_damage(0.5 * volume, TOX) && show_message) to_chat(M, "You feel sick...") ..() @@ -265,22 +263,16 @@ /datum/reagent/medicine/styptic_powder/on_mob_life(mob/living/M) var/update_flags = STATUS_UPDATE_NONE - update_flags |= M.adjustBruteLoss(-1, FALSE) + update_flags |= M.heal_damage_type(1, BRUTE, updating_health = FALSE) return ..() | update_flags /datum/reagent/medicine/styptic_powder/reaction_mob(mob/living/M, method=REAGENT_TOUCH, volume, show_message = 1) if(iscarbon(M)) if(method == REAGENT_TOUCH) - M.adjustBruteLoss(-volume) - var/has_pain = TRUE - if(ishuman(M)) - var/mob/living/carbon/human/H = M - has_pain = H.has_pain() - if(show_message && has_pain) + if(M.heal_damage_type(volume, BRUTE) && show_message && M.has_pain()) to_chat(M, "The styptic powder stings like hell as it closes some of your wounds!") else if(method == REAGENT_INGEST) - M.adjustToxLoss(0.5*volume) - if(show_message) + if(M.apply_damage(0.5 * volume, TOX) && show_message) to_chat(M, "You feel gross!") ..() diff --git a/code/modules/reagents/reagent_containers/applicator.dm b/code/modules/reagents/reagent_containers/applicator.dm index 5823c98bd0c..2c0d2445ada 100644 --- a/code/modules/reagents/reagent_containers/applicator.dm +++ b/code/modules/reagents/reagent_containers/applicator.dm @@ -17,7 +17,7 @@ var/emagged = FALSE var/applied_amount = 8 // How much it applies var/applying = FALSE // So it can't be spammed. - var/measured_health = 0 // Used for measuring health; we don't want this to stop applying once the person's health isn't changing. + /obj/item/reagent_containers/applicator/emag_act(mob/user) if(!emagged) @@ -86,6 +86,7 @@ apply_to(M, user, 0.2) // We apply a very weak application up front, then loop. add_attack_logs(user, M, "Started mending with [src] containing ([reagents.log_list()])", (emagged && !(reagents.harmless_helper())) ? null : ATKLOG_ALMOSTALL) var/cycle_count = 0 + var/measured_health = 0 while(do_after(user, 1 SECONDS, M)) measured_health = M.health apply_to(M, user, 1, FALSE) diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm index 12e752014b8..5966f4a1d21 100644 --- a/code/modules/surgery/organs/organ_external.dm +++ b/code/modules/surgery/organs/organ_external.dm @@ -282,6 +282,9 @@ if(owner?.status_flags & GODMODE) return FALSE + var/brute_was = brute_dam + var/burn_was = burn_dam + if(!forced) if(tough) brute = max(0, brute - 5) @@ -408,7 +411,7 @@ if(!limb_dropped && original_burn && prob(original_burn / 2)) droplimb(clean = FALSE, disintegrate = DROPLIMB_BURN, silent = silent) - if(updating_health) + if(updating_health && (QDELETED(src) || loc != organ_owner || brute_dam != brute_was || burn_dam != burn_was)) organ_owner?.updatehealth("limb receive damage") return update_state() @@ -416,10 +419,14 @@ /obj/item/organ/external/proc/heal_damage(brute, burn, internal = FALSE, robo_repair = FALSE, updating_health = TRUE) if(is_robotic() && !robo_repair) - return + return FALSE - brute_dam = round(max(brute_dam - brute, 0), DAMAGE_PRECISION) - burn_dam = round(max(burn_dam - burn, 0), DAMAGE_PRECISION) + var/brute_was = brute_dam + var/burn_was = burn_dam + brute_dam = max(round(brute_dam - brute, DAMAGE_PRECISION), 0) + burn_dam = max(round(burn_dam - burn, DAMAGE_PRECISION), 0) + if(brute_dam == brute_was && burn_dam == burn_was) + updating_health = FALSE if(internal) mend_fracture() @@ -699,13 +706,12 @@ Note that amputating the affected organ does in fact remove the infection from t for(var/obj/item/organ/external/childpart as anything in children) //Factor in the children's brute and burn into how much will transfer total_brute += childpart.brute_dam total_burn += childpart.burn_dam - parent.external_receive_damage(total_brute, total_burn, forced = TRUE, silent = silent) //Transfer the full damage to the parent, bypass limb damage reduction. + parent.external_receive_damage(total_brute, total_burn, forced = TRUE, updating_health = FALSE, silent = silent) //Transfer the full damage to the parent, bypass limb damage reduction. parent = null - dir = SOUTH + setDir(SOUTH) if(victim) victim.updatehealth("droplimb") - victim.UpdateDamageIcon() victim.regenerate_icons() switch(disintegrate)