From 7752e0d6240289514b1005fb8dffef8e8fe88130 Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Wed, 22 Sep 2021 22:30:43 +0200 Subject: [PATCH 01/10] synthtissue and sr --- code/game/objects/items/defib.dm | 2 +- code/modules/mob/living/carbon/carbon.dm | 6 +-- code/modules/reagents/chemistry/holder.dm | 12 ++++- code/modules/reagents/chemistry/reagents.dm | 4 ++ .../chemistry/reagents/medicine_reagents.dm | 24 ++++----- .../nanites/nanite_programs/healing.dm | 2 +- .../reagents/chemistry/reagents/healing.dm | 51 +++++++++++++------ 7 files changed, 66 insertions(+), 35 deletions(-) diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm index 0570de6bcf..2a197cf844 100644 --- a/code/game/objects/items/defib.dm +++ b/code/game/objects/items/defib.dm @@ -423,7 +423,7 @@ if((!req_defib && grab_ghost) || (req_defib && defib.grab_ghost)) H.notify_ghost_cloning("Your heart is being defibrillated!") H.grab_ghost() // Shove them back in their body. - else if(H.can_defib()) + else if(H.can_revive()) H.notify_ghost_cloning("Your heart is being defibrillated. Re-enter your corpse if you want to be revived!", source = src) do_help(H, user) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index f6ef8e8177..8b8caa1513 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -898,16 +898,16 @@ update_inv_handcuffed() update_hud_handcuffed() -/mob/living/carbon/proc/can_defib() +/mob/living/carbon/proc/can_revive(ignore_timelimit = FALSE, maximum_brute_dam = MAX_REVIVE_BRUTE_DAMAGE, maximum_fire_dam = MAX_REVIVE_FIRE_DAMAGE, ignore_heart = FALSE) var/tlimit = DEFIB_TIME_LIMIT * 10 var/obj/item/organ/heart = getorgan(/obj/item/organ/heart) if(suiciding || hellbound || HAS_TRAIT(src, TRAIT_HUSK) || AmBloodsucker(src)) return - if((world.time - timeofdeath) > tlimit) + if(!ignore_timelimit && (world.time - timeofdeath) > tlimit) return if((getBruteLoss() >= MAX_REVIVE_BRUTE_DAMAGE) || (getFireLoss() >= MAX_REVIVE_FIRE_DAMAGE)) return - if(!heart || (heart.organ_flags & ORGAN_FAILING)) + if(!ignore_heart && (!heart || (heart.organ_flags & ORGAN_FAILING))) return var/obj/item/organ/brain/BR = getorgan(/obj/item/organ/brain) if(QDELETED(BR) || BR.brain_death || (BR.organ_flags & ORGAN_FAILING) || suiciding) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 922e14e580..9e939078e3 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -199,6 +199,7 @@ var/transfer_amount = T.volume * part if(preserve_data) trans_data = copy_data(T) + post_copy_data(T) transferred += "[T] - [transfer_amount]" R.add_reagent(T.type, transfer_amount * multiplier, trans_data, chem_temp, T.purity, pH, no_react = TRUE, ignore_pH = TRUE) //we only handle reaction after every reagent has been transfered. @@ -239,7 +240,8 @@ var/datum/reagent/T = reagent var/copy_amount = T.volume * part if(preserve_data) - trans_data = T.data + trans_data = copy_data(T) + post_copy_data(T) R.add_reagent(T.type, copy_amount * multiplier, trans_data) src.update_total() @@ -266,7 +268,8 @@ var/datum/reagent/current_reagent = CR if(current_reagent.type == reagent) if(preserve_data) - trans_data = current_reagent.data + trans_data = copy_data(current_reagent) + post_copy_data(current_reagent) R.add_reagent(current_reagent.type, amount, trans_data, chem_temp, current_reagent.purity, pH, no_react = TRUE) remove_reagent(current_reagent.type, amount, 1) if(log && amount > 0) @@ -1116,6 +1119,11 @@ return trans_data +/// +// Should be ran after using copy_data. Calls the reagent's post_copy_data, which usually does nothing. +/datum/reagents/proc/post_copy_data(datum/reagent/current_reagent) + return current_reagent.post_copy_data() + /datum/reagents/proc/get_reagent(type) var/list/cached_reagents = reagent_list . = locate(type) in cached_reagents diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index d6b7201ef9..334d91363a 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -178,6 +178,10 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) M.reagents.add_reagent(impure_chem, impureVol, FALSE, other_purity = 1-cached_purity) log_reagent("MOB ADD: on_merge() (mixed purity): merged [volume - impureVol] of [type] and [volume] of [impure_chem]") +//Ran by a reagent holder on a specific reagent after copying its data. +/datum/reagent/proc/post_copy_data() + return + /datum/reagent/proc/on_update(atom/A) return diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 72a9779726..e052d2475e 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -980,11 +980,11 @@ if(M.stat == DEAD) if(M.suiciding || M.hellbound) //they are never coming back M.visible_message("[M]'s body does not react...") - return + return ..() if(M.getBruteLoss() >= 100 || M.getFireLoss() >= 100 || HAS_TRAIT(M, TRAIT_HUSK)) //body is too damaged to be revived M.visible_message("[M]'s body convulses a bit, and then falls still once more.") M.do_jitter_animation(10) - return + return ..() else M.visible_message("[M]'s body starts convulsing!") M.notify_ghost_cloning(source = M) @@ -996,27 +996,27 @@ if(iscarbon(M)) var/mob/living/carbon/C = M if(!(C.dna && C.dna.species && (NOBLOOD in C.dna.species.species_traits))) - C.blood_volume = max(C.blood_volume, BLOOD_VOLUME_NORMAL*C.blood_ratio) //so you don't instantly re-die from a lack of blood - for(var/organ in C.internal_organs) - var/obj/item/organ/O = organ - if(O.damage > O.maxHealth/2) - O.setOrganDamage(O.maxHealth/2) //so you don't instantly die from organ damage when being revived - + C.blood_volume = max(C.blood_volume, BLOOD_VOLUME_BAD*C.blood_ratio) //so you don't instantly re-die from a lack of blood. You'll still need help if you had none though. + var/obj/item/organ/heart/H = C.getorganslot(ORGAN_SLOT_HEART) + if(H && H.organ_flags & ORGAN_FAILING) + H.applyOrganDamage(-15) M.adjustOxyLoss(-20, 0) M.adjustToxLoss(-20, 0) M.updatehealth() + if(iscarbon(M)) + var/mob/living/carbon/C = M + if(!C.can_revive(ignore_timelimit = TRUE, maximum_brute_dam = 100, maximum_fire_dam = 100, ignore_heart = TRUE)) + return var/tplus = world.time - M.timeofdeath if(M.revive()) M.grab_ghost() M.emote("gasp") log_combat(M, M, "revived", src) var/list/policies = CONFIG_GET(keyed_list/policy) - var/timelimit = CONFIG_GET(number/defib_cmd_time_limit) * 10 //the config is in seconds, not deciseconds - var/late = timelimit && (tplus > timelimit) - var/policy = late? policies[POLICYCONFIG_ON_DEFIB_LATE] : policies[POLICYCONFIG_ON_DEFIB_INTACT] + var/policy = policies[POLICYCONFIG_ON_DEFIB_LATE] //Always causes memory loss due to the nature of strange reagent. if(policy) to_chat(M, policy) - M.log_message("revived using strange reagent, [tplus] deciseconds from time of death, considered [late? "late" : "memory-intact"] revival under configured policy limits.", LOG_GAME) + M.log_message("revived using strange reagent, [tplus] deciseconds from time of death, considered late revival due to usage of strange reagent.", LOG_GAME) ..() diff --git a/code/modules/research/nanites/nanite_programs/healing.dm b/code/modules/research/nanites/nanite_programs/healing.dm index 81a837504a..c5f36182c7 100644 --- a/code/modules/research/nanites/nanite_programs/healing.dm +++ b/code/modules/research/nanites/nanite_programs/healing.dm @@ -234,7 +234,7 @@ var/mob/living/carbon/C = host_mob if(C.get_ghost()) return FALSE - return C.can_defib() + return C.can_revive() /datum/nanite_program/defib/proc/zap() var/mob/living/carbon/C = host_mob diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm index 2cdaef9c91..013539fd66 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm @@ -98,8 +98,8 @@ description = "Synthetic tissue used for grafting onto damaged organs during surgery, or for treating limb damage. Has a very tight growth window between 305-320, any higher and the temperature will cause the cells to die. Additionally, growth time is considerably long, so chemists are encouraged to leave beakers with said reaction ongoing, while they tend to their other duties." pH = 7.6 metabolization_rate = 0.05 //Give them time to graft - data = list("grown_volume" = 0, "injected_vol" = 0) - var/borrowed_health + data = list("grown_volume" = 0, "injected_vol" = 0, "borrowed_health" = 0) + var/borrowed_health = 0 color = "#FFDADA" value = REAGENT_VALUE_COMMON @@ -107,31 +107,44 @@ if(iscarbon(M)) var/mob/living/carbon/C = M var/healing_factor = (((data["grown_volume"] / 100) + 1)*reac_volume) - if(method in list(PATCH, TOUCH)) - if (M.stat == DEAD) - M.visible_message("The synthetic tissue rapidly grafts into [M]'s wounds, attemping to repair the damage as quickly as possible.") + if(method == PATCH) //Needs to actually be applied via patch / hypo / medspray and not just beakersplashed. + if (C.stat == DEAD) + C.visible_message("The synthetic tissue rapidly grafts into [M]'s wounds, attemping to repair the damage as quickly as possible.") borrowed_health += healing_factor - M.adjustBruteLoss(-healing_factor*2) - M.adjustFireLoss(-healing_factor*2) - M.adjustToxLoss(-healing_factor) - M.adjustCloneLoss(-healing_factor) - M.updatehealth() + C.adjustBruteLoss(-healing_factor*2) + C.adjustFireLoss(-healing_factor*2) + C.adjustToxLoss(-healing_factor) + C.adjustCloneLoss(-healing_factor) + C.updatehealth() if(data["grown_volume"] > 135 && ((C.health + C.oxyloss)>=80)) - if(M.revive()) - M.emote("gasp") + var/tplus = world.time - M.timeofdeath + if(C.can_revive(ignore_timelimit = TRUE, maximum_brute_dam = MAX_REVIVE_BRUTE_DAMAGE / 2, maximum_fire_dam = MAX_REVIVE_FIRE_DAMAGE / 2, ignore_heart = TRUE) && C.revive()) + C.emote("gasp") borrowed_health *= 2 if(borrowed_health < 100) borrowed_health = 100 - log_combat(M, M, "revived", src) + log_combat(C, C, "revived", src) + var/list/policies = CONFIG_GET(keyed_list/policy) + var/policy = policies[POLICYCONFIG_ON_DEFIB_LATE] //Always causes memory loss due to the nature of synthtissue + if(policy) + to_chat(C, policy) + C.log_message("revived using synthtissue, [tplus] deciseconds from time of death, considered late revival due to usage of synthtissue.", LOG_GAME) else M.adjustBruteLoss(-healing_factor) M.adjustFireLoss(-healing_factor) - to_chat(M, "You feel your flesh merge with the synthetic tissue! It stings like hell!") + var/datum/reagent/synthtissue/active_tissue = M.reagents.has_reagent(/datum/reagent/synthtissue) + var/imperfect = FALSE //Merging with synthtissue that has borrowed health + if(active_tissue && active_tissue.borrowed_health) + borrowed_health += healing_factor + imperfect = TRUE + to_chat(M, "You feel your flesh [imperfect ? "partially and painfully" : ""] merge with the synthetic tissue! It stings like hell[imperfect ? " and is making you feel terribly sick." : ""]!") SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "painful_medicine", /datum/mood_event/painful_medicine) + data["borrowed_health"] += borrowed_health //Preserve health offset + borrowed_health = 0 //We are applying this to someone else, so this info will be transferred via data. if(method==INJECT) data["injected_vol"] = reac_volume var/obj/item/organ/heart/H = C.getorganslot(ORGAN_SLOT_HEART) - if(data["grown_volume"] > 50 && H.organ_flags & ORGAN_FAILING) + if(H && data["grown_volume"] > 50 && H.organ_flags & ORGAN_FAILING) H.applyOrganDamage(-20) ..() @@ -145,7 +158,7 @@ C.reagents.remove_reagent(type, 15) to_chat(C, "You feel something reform inside of you!") - data["injected_vol"] -= metabolization_rate + data["injected_vol"] = max(0, data["injected_vol"] - metabolization_rate * C.metabolism_efficiency) //No negatives. if(borrowed_health) C.adjustToxLoss(1) C.adjustCloneLoss(1) @@ -155,6 +168,7 @@ /datum/reagent/synthtissue/on_merge(passed_data) if(!passed_data) return ..() + borrowed_health += passed_data["borrowed_health"] if(passed_data["grown_volume"] > data["grown_volume"]) data["grown_volume"] = passed_data["grown_volume"] if(iscarbon(holder.my_atom)) @@ -166,11 +180,16 @@ /datum/reagent/synthtissue/on_new(passed_data) if(!passed_data) return ..() + borrowed_health += passed_data["borrowed_health"] if(passed_data["grown_volume"] > data["grown_volume"]) data["grown_volume"] = passed_data["grown_volume"] update_name() ..() +/datum/reagent/synthtissue/post_copy_data() + data["borrowed_health"] = 0 //We passed this along to something that needed it, set it back to 0 so we don't do it twice. + return ..() + /datum/reagent/synthtissue/proc/update_name() //They are but babes on creation and have to grow unto godhood switch(data["grown_volume"]) if(-INFINITY to 50) From 5b69a4680bc5f27a5742f313958d82d01583306b Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Wed, 22 Sep 2021 22:36:36 +0200 Subject: [PATCH 02/10] whew --- code/modules/mob/living/carbon/carbon.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 8b8caa1513..b709e132f5 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -905,7 +905,7 @@ return if(!ignore_timelimit && (world.time - timeofdeath) > tlimit) return - if((getBruteLoss() >= MAX_REVIVE_BRUTE_DAMAGE) || (getFireLoss() >= MAX_REVIVE_FIRE_DAMAGE)) + if((getBruteLoss() >= maximum_brute_dam) || (getFireLoss() >= maximum_fire_dam)) return if(!ignore_heart && (!heart || (heart.organ_flags & ORGAN_FAILING))) return From 2e2aa36875f5e0834a09c8c707ad42648b3a7bba Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Wed, 22 Sep 2021 22:47:08 +0200 Subject: [PATCH 03/10] grab the ghost --- .../code/modules/reagents/chemistry/reagents/healing.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm index 013539fd66..7d4f35bf72 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm @@ -119,6 +119,7 @@ if(data["grown_volume"] > 135 && ((C.health + C.oxyloss)>=80)) var/tplus = world.time - M.timeofdeath if(C.can_revive(ignore_timelimit = TRUE, maximum_brute_dam = MAX_REVIVE_BRUTE_DAMAGE / 2, maximum_fire_dam = MAX_REVIVE_FIRE_DAMAGE / 2, ignore_heart = TRUE) && C.revive()) + C.grab_ghost() C.emote("gasp") borrowed_health *= 2 if(borrowed_health < 100) From 6cffeacd4216ef2d2d20f9bff126d9ece87677bb Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Wed, 22 Sep 2021 23:32:35 +0200 Subject: [PATCH 04/10] typo --- .../code/modules/reagents/chemistry/reagents/healing.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm index 7d4f35bf72..58bf76df41 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm @@ -138,7 +138,7 @@ if(active_tissue && active_tissue.borrowed_health) borrowed_health += healing_factor imperfect = TRUE - to_chat(M, "You feel your flesh [imperfect ? "partially and painfully" : ""] merge with the synthetic tissue! It stings like hell[imperfect ? " and is making you feel terribly sick." : ""]!") + to_chat(M, "You feel your flesh [imperfect ? "partially and painfully" : ""] merge with the synthetic tissue! It stings like hell[imperfect ? " and is making you feel terribly sick" : ""]!") SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "painful_medicine", /datum/mood_event/painful_medicine) data["borrowed_health"] += borrowed_health //Preserve health offset borrowed_health = 0 //We are applying this to someone else, so this info will be transferred via data. From 31679157dc2541a6ac017520798892fd4559aee8 Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Sat, 25 Sep 2021 02:24:12 +0200 Subject: [PATCH 05/10] adjust --- .../reagents/chemistry/reagents/healing.dm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm index 58bf76df41..df65780224 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm @@ -109,12 +109,16 @@ var/healing_factor = (((data["grown_volume"] / 100) + 1)*reac_volume) if(method == PATCH) //Needs to actually be applied via patch / hypo / medspray and not just beakersplashed. if (C.stat == DEAD) - C.visible_message("The synthetic tissue rapidly grafts into [M]'s wounds, attemping to repair the damage as quickly as possible.") - borrowed_health += healing_factor + C.visible_message("The synthetic tissue rapidly grafts into [M]'s wounds, attempting to repair the damage as quickly as possible.") + var/preheal_brute = C.getBruteLoss() + var/preheal_burn = C.getFireLoss() + var/preheal_tox = C.getToxLoss() + var/preheal_oxy = C.getOxyLoss() C.adjustBruteLoss(-healing_factor*2) C.adjustFireLoss(-healing_factor*2) C.adjustToxLoss(-healing_factor) C.adjustCloneLoss(-healing_factor) + borrowed_health += (preheal_brute - C.getBruteLoss()) + (preheal_burn - C.getFireLoss()) + (preheal_tox - C.getToxLoss()) + ((preheal_oxy - C.getOxyLoss()) / 2) //Ironically this means that while slimes get damaged by the toxheal, it will reduce borrowed health and longterm effects. Funky! C.updatehealth() if(data["grown_volume"] > 135 && ((C.health + C.oxyloss)>=80)) var/tplus = world.time - M.timeofdeath @@ -131,12 +135,14 @@ to_chat(C, policy) C.log_message("revived using synthtissue, [tplus] deciseconds from time of death, considered late revival due to usage of synthtissue.", LOG_GAME) else + var/preheal_brute = C.getBruteLoss() + var/preheal_burn = C.getFireLoss() M.adjustBruteLoss(-healing_factor) M.adjustFireLoss(-healing_factor) var/datum/reagent/synthtissue/active_tissue = M.reagents.has_reagent(/datum/reagent/synthtissue) var/imperfect = FALSE //Merging with synthtissue that has borrowed health if(active_tissue && active_tissue.borrowed_health) - borrowed_health += healing_factor + borrowed_health += (preheal_brute - C.getBruteLoss()) + (preheal_burn - C.getFireLoss()) imperfect = TRUE to_chat(M, "You feel your flesh [imperfect ? "partially and painfully" : ""] merge with the synthetic tissue! It stings like hell[imperfect ? " and is making you feel terribly sick" : ""]!") SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "painful_medicine", /datum/mood_event/painful_medicine) @@ -161,9 +167,9 @@ data["injected_vol"] = max(0, data["injected_vol"] - metabolization_rate * C.metabolism_efficiency) //No negatives. if(borrowed_health) - C.adjustToxLoss(1) + C.adjustToxLoss(1, forced = TRUE, toxins_type = TOX_OMNI) C.adjustCloneLoss(1) - borrowed_health -= 1 + borrowed_health = max(borrowed_health - 2, 0) ..() /datum/reagent/synthtissue/on_merge(passed_data) From 9f3688f9ccb8280d50ec0caa5a22328635178788 Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Sat, 25 Sep 2021 02:32:29 +0200 Subject: [PATCH 06/10] health payback affected by metabolism --- .../code/modules/reagents/chemistry/reagents/healing.dm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm index df65780224..e88e66705d 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm @@ -167,9 +167,10 @@ data["injected_vol"] = max(0, data["injected_vol"] - metabolization_rate * C.metabolism_efficiency) //No negatives. if(borrowed_health) - C.adjustToxLoss(1, forced = TRUE, toxins_type = TOX_OMNI) - C.adjustCloneLoss(1) - borrowed_health = max(borrowed_health - 2, 0) + var/payback = 2 * C.metabolism_efficiency //How much borrowed health we are paying back. Half as clonedam, half as true omni toxdam + C.adjustToxLoss(payback / 2, forced = TRUE, toxins_type = TOX_OMNI) + C.adjustCloneLoss(payback / 2) + borrowed_health = max(borrowed_health - payback, 0) ..() /datum/reagent/synthtissue/on_merge(passed_data) From 99a4af025b76c54b0b3be9a53833efb2f9420abf Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Sat, 25 Sep 2021 02:46:11 +0200 Subject: [PATCH 07/10] hearts don't need blood typo --- .../reagents/chemistry/reagents/medicine_reagents.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index e052d2475e..3ca96645ad 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -997,9 +997,9 @@ var/mob/living/carbon/C = M if(!(C.dna && C.dna.species && (NOBLOOD in C.dna.species.species_traits))) C.blood_volume = max(C.blood_volume, BLOOD_VOLUME_BAD*C.blood_ratio) //so you don't instantly re-die from a lack of blood. You'll still need help if you had none though. - var/obj/item/organ/heart/H = C.getorganslot(ORGAN_SLOT_HEART) - if(H && H.organ_flags & ORGAN_FAILING) - H.applyOrganDamage(-15) + var/obj/item/organ/heart/H = C.getorganslot(ORGAN_SLOT_HEART) + if(H && H.organ_flags & ORGAN_FAILING) + H.applyOrganDamage(-15) M.adjustOxyLoss(-20, 0) M.adjustToxLoss(-20, 0) M.updatehealth() From 64367ff7ba8824006e7e3f16bd92e562a17fb3bd Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Sat, 2 Oct 2021 18:33:57 +0200 Subject: [PATCH 08/10] edge case protection --- .../code/modules/reagents/chemistry/reagents/healing.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm index e88e66705d..d291278a5f 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm @@ -176,7 +176,7 @@ /datum/reagent/synthtissue/on_merge(passed_data) if(!passed_data) return ..() - borrowed_health += passed_data["borrowed_health"] + borrowed_health += max(0, passed_data["borrowed_health"]) if(passed_data["grown_volume"] > data["grown_volume"]) data["grown_volume"] = passed_data["grown_volume"] if(iscarbon(holder.my_atom)) From bb3eb904ebdfefdef23564da0136b53e164466ad Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Wed, 3 Nov 2021 03:03:18 +0100 Subject: [PATCH 09/10] resolves hypo inconsistancy --- code/modules/reagents/reagent_containers/hypospray.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index 9d2e4a8e31..1a6183ce9d 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -491,7 +491,7 @@ return var/fp_verb = mode == HYPO_SPRAY ? "spray" : "inject" - var/method = mode == HYPO_SPRAY ? TOUCH : INJECT + var/method = mode == HYPO_SPRAY ? PATCH : INJECT //Medsprays use patch when spraying, feels like an inconsistancy here. if(L != user) L.visible_message("[user] is trying to [fp_verb] [L] with [src]!", \ From 051f5780dbdd7e173dcda60d0ed9275e11a9dfd5 Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Fri, 31 Dec 2021 00:16:49 +0100 Subject: [PATCH 10/10] tweaks Synthtissue borrowed health capped at 250, gradually flips from clonedamage towards toxdamage within 45 cycles. Restores organ healing for strange reagent, but only in a very weak fashion (5 heal for failing organs) --- code/__DEFINES/reagents.dm | 3 +++ .../chemistry/reagents/medicine_reagents.dm | 4 ++++ .../modules/reagents/chemistry/reagents/healing.dm | 13 +++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/code/__DEFINES/reagents.dm b/code/__DEFINES/reagents.dm index 8864e41ae9..90128606ac 100644 --- a/code/__DEFINES/reagents.dm +++ b/code/__DEFINES/reagents.dm @@ -63,6 +63,9 @@ #define THRESHOLD_UNHUSK 50 // health threshold for synthflesh/rezadone to unhusk someone +#define SYNTHTISSUE_BORROW_CAP 250 //The cap for synthtissue's borrowed health value when used on someone dead or already having borrowed health. +#define SYNTHTISSUE_DAMAGE_FLIP_CYCLES 45 //After how many cycles the damage will be pure toxdamage as opposed to clonedamage like initially. Gradually changes during its cycles. + //reagent bitflags, used for altering how they works #define REAGENT_DEAD_PROCESS (1<<0) //calls on_mob_dead() if present in a dead body #define REAGENT_DONOTSPLIT (1<<1) //Do not split the chem at all during processing diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 3ca96645ad..a211a29298 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -1000,6 +1000,10 @@ var/obj/item/organ/heart/H = C.getorganslot(ORGAN_SLOT_HEART) if(H && H.organ_flags & ORGAN_FAILING) H.applyOrganDamage(-15) + for(var/obj/item/organ/O as anything in C.internal_organs) + if(O.organ_flags & ORGAN_FAILING) + O.applyOrganDamage(-5) + M.adjustOxyLoss(-20, 0) M.adjustToxLoss(-20, 0) M.updatehealth() diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm index d291278a5f..346a74006f 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm @@ -167,9 +167,10 @@ data["injected_vol"] = max(0, data["injected_vol"] - metabolization_rate * C.metabolism_efficiency) //No negatives. if(borrowed_health) - var/payback = 2 * C.metabolism_efficiency //How much borrowed health we are paying back. Half as clonedam, half as true omni toxdam - C.adjustToxLoss(payback / 2, forced = TRUE, toxins_type = TOX_OMNI) - C.adjustCloneLoss(payback / 2) + var/ratio = (current_cycle > SYNTHTISSUE_DAMAGE_FLIP_CYCLES) ? 0 : (1 - (current_cycle / SYNTHTISSUE_DAMAGE_FLIP_CYCLES)) + var/payback = 2 * C.metabolism_efficiency //How much borrowed health we are paying back. Starts as cloneloss, slowly flips over to toxloss. + C.adjustToxLoss((1 - ratio) * payback * REAGENTS_EFFECT_MULTIPLIER, forced = TRUE, toxins_type = TOX_OMNI) + C.adjustCloneLoss(ratio * payback * REAGENTS_EFFECT_MULTIPLIER) borrowed_health = max(borrowed_health - payback, 0) ..() @@ -188,7 +189,7 @@ /datum/reagent/synthtissue/on_new(passed_data) if(!passed_data) return ..() - borrowed_health += passed_data["borrowed_health"] + borrowed_health = min(passed_data["borrowed_health"] + borrowed_health, SYNTHTISSUE_BORROW_CAP) if(passed_data["grown_volume"] > data["grown_volume"]) data["grown_volume"] = passed_data["grown_volume"] update_name() @@ -220,9 +221,9 @@ C.adjustCloneLoss(borrowed_health*1.25) C.adjustAllOrganLoss(borrowed_health*0.25) M.updatehealth() - if(borrowed_health && C.health < -20) - M.stat = DEAD + if(C.stat != DEAD && borrowed_health && C.health < -20) M.visible_message("The synthetic tissue degrades off [M]'s wounds as they collapse to the floor.") + M.death() //NEEDS ON_MOB_DEAD() /datum/reagent/fermi/zeolites