From 3df290f46fee0acfd8578bd05d8402e39eae8504 Mon Sep 17 00:00:00 2001 From: Anewbe Date: Thu, 22 Mar 2018 11:55:49 -0500 Subject: [PATCH] Ports antibiotics overhaul (#5050) * Ports antibiotics overhaul * Update the rest of the places "spaceacillin" is used where antibiotics is meant. * Antibiotics port compiles --- code/__defines/chemistry.dm | 7 +++- .../modules/organs/internal/organ_internal.dm | 6 +-- code/modules/organs/organ.dm | 22 +++++------ code/modules/organs/organ_external.dm | 10 ++--- code/modules/reagents/Chemistry-Reagents.dm | 2 +- .../Chemistry-Reagents-Medicine.dm | 37 ++++++++++++++++++- code/modules/reagents/Chemistry-Recipes.dm | 8 ++++ code/modules/virus2/disease2.dm | 2 +- code/modules/virus2/helpers.dm | 2 +- 9 files changed, 72 insertions(+), 24 deletions(-) diff --git a/code/__defines/chemistry.dm b/code/__defines/chemistry.dm index 08131f99bb..c9b34fc2b6 100644 --- a/code/__defines/chemistry.dm +++ b/code/__defines/chemistry.dm @@ -27,7 +27,7 @@ #define IS_SLIME 8 #define CE_STABLE "stable" // Inaprovaline -#define CE_ANTIBIOTIC "antibiotic" // Spaceacilin +#define CE_ANTIBIOTIC "antibiotic" // Antibiotics #define CE_BLOODRESTORE "bloodrestore" // Iron/nutriment #define CE_PAINKILLER "painkiller" #define CE_ALCOHOL "alcohol" // Liver filtering @@ -36,6 +36,11 @@ #define REAGENTS_PER_SHEET 20 +// Attached to CE_ANTIBIOTIC +#define ANTIBIO_NORM 1 +#define ANTIBIO_OD 2 +#define ANTIBIO_SUPER 3 + // Chemistry lists. var/list/tachycardics = list("coffee", "inaprovaline", "hyperzine", "nitroglycerin", "thirteenloko", "nicotine") // Increase heart rate. var/list/bradycardics = list("neurotoxin", "cryoxadone", "clonexadone", "space_drugs", "stoxin") // Decrease heart rate. diff --git a/code/modules/organs/internal/organ_internal.dm b/code/modules/organs/internal/organ_internal.dm index 43b3a4c4d7..58ed176505 100644 --- a/code/modules/organs/internal/organ_internal.dm +++ b/code/modules/organs/internal/organ_internal.dm @@ -52,13 +52,13 @@ . = ..() //Should be an interger value for infection level if(!.) return - var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin") + var/antibiotics = owner.chem_effects[CE_ANTIBIOTIC] - if(. >= 2 && antibiotics < 5) //INFECTION_LEVEL_TWO + if(. >= 2 && antibiotics < ANTIBIO_NORM) //INFECTION_LEVEL_TWO if (prob(3)) take_damage(1,silent=prob(30)) - if(. >= 3 && antibiotics < 30) //INFECTION_LEVEL_THREE + if(. >= 3 && antibiotics < ANTIBIO_OD) //INFECTION_LEVEL_THREE if (prob(50)) take_damage(1,silent=prob(15)) diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm index abd388c930..e26ea19374 100644 --- a/code/modules/organs/organ.dm +++ b/code/modules/organs/organ.dm @@ -148,25 +148,25 @@ var/list/organ_cache = list() germ_level = 0 return 0 - var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin") + var/antibiotics = owner.chem_effects[CE_ANTIBIOTIC] || 0 var/infection_damage = 0 - if((status & ORGAN_DEAD) && antibiotics < 30) //Sepsis from 'dead' organs + if((status & ORGAN_DEAD) && antibiotics < ANTIBIO_OD) //Sepsis from 'dead' organs infection_damage = min(1, 1 + round((germ_level - INFECTION_LEVEL_THREE)/200,0.25)) //1 Tox plus a little based on germ level - else if(germ_level > INFECTION_LEVEL_TWO && antibiotics < 30) + else if(germ_level > INFECTION_LEVEL_TWO && antibiotics < ANTIBIO_OD) infection_damage = min(0.25, 0.25 + round((germ_level - INFECTION_LEVEL_TWO)/200,0.25)) if(infection_damage) owner.adjustToxLoss(infection_damage) if (germ_level > 0 && germ_level < INFECTION_LEVEL_ONE/2 && prob(30)) - adjust_germ_level(-1) + adjust_germ_level(-antibiotics) if (germ_level >= INFECTION_LEVEL_ONE/2) //aiming for germ level to go from ambient to INFECTION_LEVEL_TWO in an average of 15 minutes - if(antibiotics < 5 && prob(round(germ_level/6))) + if(!antibiotics && prob(round(germ_level/6))) adjust_germ_level(1) if(germ_level >= INFECTION_LEVEL_ONE) @@ -181,7 +181,7 @@ var/list/organ_cache = list() . = 2 //Organ qualifies for effect-specific processing //No particular effect on the general 'organ' at 3 - if (germ_level >= INFECTION_LEVEL_THREE && antibiotics < 30) + if (germ_level >= INFECTION_LEVEL_THREE && antibiotics < ANTIBIO_OD) . = 3 //Organ qualifies for effect-specific processing adjust_germ_level(rand(5,10)) //Germ_level increases without overdose of antibiotics @@ -234,19 +234,19 @@ var/list/organ_cache = list() //Germs /obj/item/organ/proc/handle_antibiotics() - var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin") + var/antibiotics = owner.chem_effects[CE_ANTIBIOTIC] || 0 - if (!germ_level || antibiotics < 5) + if (!germ_level || antibiotics < ANTIBIO_NORM) return if (germ_level < INFECTION_LEVEL_ONE) germ_level = 0 //cure instantly else if (germ_level < INFECTION_LEVEL_TWO) - adjust_germ_level(-6) //at germ_level < 500, this should cure the infection in a minute + adjust_germ_level(-antibiotics*4) //at germ_level < 500, this should cure the infection in a minute else if (germ_level < INFECTION_LEVEL_THREE) - adjust_germ_level(-2) //at germ_level < 1000, this will cure the infection in 5 minutes + adjust_germ_level(-antibiotics*2) //at germ_level < 1000, this will cure the infection in 5 minutes else - adjust_germ_level(-1) // You waited this long to get treated, you don't really deserve this organ + adjust_germ_level(-antibiotics) // You waited this long to get treated, you don't really deserve this organ //Adds autopsy data for used_weapon. /obj/item/organ/proc/add_autopsy_data(var/used_weapon, var/damage) diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 86a9f589e4..6becbcaaf4 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -621,13 +621,13 @@ Note that amputating the affected organ does in fact remove the infection from t handle_germ_effects() /obj/item/organ/external/proc/handle_germ_sync() - var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin") + var/antibiotics = owner.chem_effects[CE_ANTIBIOTIC] for(var/datum/wound/W in wounds) //Open wounds can become infected if (owner.germ_level > W.germ_level && W.infection_check()) W.germ_level++ - if (antibiotics < 5) + if (antibiotics < ANTIBIO_NORM) for(var/datum/wound/W in wounds) //Infected wounds raise the organ's germ level if (W.germ_level > germ_level) @@ -638,9 +638,9 @@ Note that amputating the affected organ does in fact remove the infection from t . = ..() //May be null or an infection level, if null then no specific processing needed here if(!.) return - var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin") + var/antibiotics = owner.chem_effects[CE_ANTIBIOTIC] - if(. >= 2 && antibiotics < 5) //INFECTION_LEVEL_TWO + if(. >= 2 && antibiotics < ANTIBIO_NORM) //INFECTION_LEVEL_TWO //spread the infection to internal organs var/obj/item/organ/target_organ = null //make internal organs become infected one at a time instead of all at once for (var/obj/item/organ/I in internal_organs) @@ -672,7 +672,7 @@ Note that amputating the affected organ does in fact remove the infection from t if (parent.germ_level < INFECTION_LEVEL_ONE*2 || prob(30)) parent.germ_level++ - if(. >= 3 && antibiotics < 30) //INFECTION_LEVEL_THREE + if(. >= 3 && antibiotics < ANTIBIO_OD) //INFECTION_LEVEL_THREE if (!(status & ORGAN_DEAD)) status |= ORGAN_DEAD owner << "You can't feel your [name] anymore..." diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index 536ad9d248..ce7227ce46 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -108,7 +108,7 @@ /datum/reagent/proc/affect_touch(var/mob/living/carbon/M, var/alien, var/removed) return -/datum/reagent/proc/overdose(var/mob/living/carbon/M, var/alien, var/removed) // Overdose effect. Doesn't happen instantly. +/datum/reagent/proc/overdose(var/mob/living/carbon/M, var/alien, var/removed) // Overdose effect. if(alien == IS_DIONA) return if(ishuman(M)) diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm index b731f50326..d753d045d6 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm @@ -509,11 +509,46 @@ taste_description = "bitterness" reagent_state = LIQUID color = "#C1C1C1" - metabolism = REM * 0.05 + metabolism = REM * 0.25 mrate_static = TRUE overdose = REAGENTS_OVERDOSE scannable = 1 +/datum/reagent/spaceacillin/affect_blood(var/mob/living/carbon/M, var/alien, var/removed) + ..() + M.add_chemical_effect(CE_ANTIBIOTIC, dose >= overdose ? ANTIBIO_OD : ANTIBIO_NORM) + +/datum/reagent/corophizine + name = "Corophizine" + id = "corophizine" + description = "A wide-spectrum antibiotic drug. Powerful and uncomfortable in equal doses." + taste_description = "burnt toast" + reagent_state = LIQUID + color = "#FFB0B0" + mrate_static = TRUE + overdose = 10 + scannable = 1 + +/datum/reagent/corophizine/affect_blood(var/mob/living/carbon/M, var/alien, var/removed) + ..() + M.add_chemical_effect(CE_ANTIBIOTIC, ANTIBIO_SUPER) + + //Based roughly on Levofloxacin's rather severe side-effects + if(prob(20)) + M.Confuse(5) + if(prob(20)) + M.Weaken(5) + if(prob(20)) + M.make_dizzy(5) + if(prob(20)) + M.hallucination = max(M.hallucination, 10) + + //One of the levofloxacin side effects is 'spontaneous tendon rupture', which I'll immitate here. 1:1000 chance, so, pretty darn rare. + if(ishuman(M) && rand(1,1000) == 1) + var/mob/living/carbon/human/H = M + var/obj/item/organ/external/eo = pick(H.organs) //Misleading variable name, 'organs' is only external organs + eo.fracture() + /datum/reagent/sterilizine name = "Sterilizine" id = "sterilizine" diff --git a/code/modules/reagents/Chemistry-Recipes.dm b/code/modules/reagents/Chemistry-Recipes.dm index 37634ac28a..bb9358f8d0 100644 --- a/code/modules/reagents/Chemistry-Recipes.dm +++ b/code/modules/reagents/Chemistry-Recipes.dm @@ -417,6 +417,14 @@ required_reagents = list("cryptobiolin" = 1, "inaprovaline" = 1) result_amount = 2 +/datum/chemical_reaction/corophizine + name = "Corophizine" + id = "corophizine" + result = "corophizine" + required_reagents = list("spaceacillin" = 1, "carbon" = 1, "phoron" = 0.1) + catalysts = list("phoron" = 5) + result_amount = 2 + /datum/chemical_reaction/imidazoline name = "imidazoline" id = "imidazoline" diff --git a/code/modules/virus2/disease2.dm b/code/modules/virus2/disease2.dm index 1b8ab86fd6..3670f60bea 100644 --- a/code/modules/virus2/disease2.dm +++ b/code/modules/virus2/disease2.dm @@ -82,7 +82,7 @@ majormutate() //Space antibiotics have a good chance to stop disease completely - if(mob.reagents.has_reagent("spaceacillin")) + if(mob.chem_effects[CE_ANTIBIOTIC]) if(stage == 1 && prob(70-resistance)) src.cure(mob) else diff --git a/code/modules/virus2/helpers.dm b/code/modules/virus2/helpers.dm index d10fdbfb68..64790fdfc5 100644 --- a/code/modules/virus2/helpers.dm +++ b/code/modules/virus2/helpers.dm @@ -81,7 +81,7 @@ proc/airborne_can_reach(turf/source, turf/target) var/list/antibodies_in_common = M.antibodies & disease.antigen if(antibodies_in_common.len) return - if(M.reagents.has_reagent("spaceacillin")) + if(M.chem_effects[CE_ANTIBIOTIC]) if(prob(disease.resistance)) var/datum/disease2/disease/D = disease.getcopy() D.minormutate()