From 316137137d95c7e251063d95f164de71298c50e8 Mon Sep 17 00:00:00 2001 From: Killian <49700375+KillianKirilenko@users.noreply.github.com> Date: Sun, 3 Apr 2022 02:28:25 +0100 Subject: [PATCH 1/2] Allergen CE Conversion --- code/__defines/chemistry.dm | 1 + code/__defines/species_languages.dm | 13 ++++++++ code/modules/mob/living/carbon/carbon.dm | 4 +++ code/modules/mob/living/carbon/human/life.dm | 31 +++++++++++++++++++ .../living/carbon/human/species/species.dm | 6 ++++ code/modules/reagents/reagents/_reagents.dm | 6 +++- code/modules/reagents/reagents/dispenser.dm | 2 +- code/modules/reagents/reagents/medicine.dm | 3 +- 8 files changed, 63 insertions(+), 3 deletions(-) diff --git a/code/__defines/chemistry.dm b/code/__defines/chemistry.dm index f1de2ddd45..deb84cc3b8 100644 --- a/code/__defines/chemistry.dm +++ b/code/__defines/chemistry.dm @@ -36,6 +36,7 @@ #define CE_SPEEDBOOST "gofast" // Hyperzine #define CE_SLOWDOWN "goslow" // Slowdown #define CE_ANTACID "nopuke" // Don't puke. +#define CE_ALLERGEN "allergyreaction" // Self explanatory #define REAGENTS_PER_SHEET 20 diff --git a/code/__defines/species_languages.dm b/code/__defines/species_languages.dm index 46cff510cb..2a070803bb 100644 --- a/code/__defines/species_languages.dm +++ b/code/__defines/species_languages.dm @@ -40,6 +40,7 @@ #define ALLERGEN_STIMULANT 0x1000 // Stimulants are what makes the Tajaran heart go ruh roh - not just coffee! // Allergen reactions +<<<<<<< HEAD #define AG_TOX_DMG 0x1 // the classic #define AG_OXY_DMG 0x2 // intense airway reactions #define AG_EMOTE 0x4 // general emote reactions based on affect type @@ -48,6 +49,18 @@ #define AG_BLURRY 0x20 // blurred vision! #define AG_SLEEPY 0x40 // fatigue/exhaustion #define AG_CONFUSE 0x80 // disorientation - VOREStation addition +======= +#define AG_PHYS_DMG 0x1 // brute +#define AG_BURN_DMG 0x2 // burns +#define AG_TOX_DMG 0x4 // the classic +#define AG_OXY_DMG 0x8 // intense airway reactions +#define AG_EMOTE 0x10 // general emote reactions based on affect type +#define AG_PAIN 0x20 // short-lived hurt +#define AG_WEAKEN 0x40 // too weak to move, oof +#define AG_BLURRY 0x80 // blurred vision! +#define AG_SLEEPY 0x100 // fatigue/exhaustion +#define AG_CONFUSE 0x200 // disorientation +>>>>>>> e39f24b49e3... Allergen CE Conversion (#8431) // Species spawn flags #define SPECIES_IS_WHITELISTED 0x1 // Must be whitelisted to play. diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index c9d4dfad52..b0557e2bc1 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -430,6 +430,10 @@ else chem_effects[effect] = magnitude +/mob/living/carbon/proc/remove_chemical_effect(var/effect, var/magnitude) + if(effect in chem_effects) + chem_effects[effect] = magnitude ? max(0,chem_effects[effect]-magnitude) : 0 + /mob/living/carbon/get_default_language() if(default_language) if(can_speak(default_language)) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 9d3b6753ac..5fa34ca78a 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -84,6 +84,8 @@ handle_shock() handle_pain() + + handle_allergens() handle_medical_side_effects() @@ -638,6 +640,35 @@ breath.update_values() return 1 +/mob/living/carbon/human/proc/handle_allergens() + if(chem_effects[CE_ALLERGEN]) + //first, multiply the basic species-level value by our allergen effect rating, so consuming multiple seperate allergen typess simultaneously hurts more + var/damage_severity = species.allergen_damage_severity * chem_effects[CE_ALLERGEN] + var/disable_severity = species.allergen_disable_severity * chem_effects[CE_ALLERGEN] + if(species.allergen_reaction & AG_PHYS_DMG) + adjustBruteLoss(damage_severity) + if(species.allergen_reaction & AG_BURN_DMG) + adjustFireLoss(damage_severity) + if(species.allergen_reaction & AG_TOX_DMG) + adjustToxLoss(damage_severity) + if(species.allergen_reaction & AG_OXY_DMG) + adjustOxyLoss(damage_severity) + if(prob(disable_severity/2)) + emote(pick("cough","gasp","choke")) + if(species.allergen_reaction & AG_EMOTE) + if(prob(disable_severity/2)) + emote(pick("pale","shiver","twitch")) + if(species.allergen_reaction & AG_PAIN) + adjustHalLoss(disable_severity) + if(species.allergen_reaction & AG_WEAKEN) + Weaken(disable_severity) + if(species.allergen_reaction & AG_BLURRY) + eye_blurry = max(eye_blurry, disable_severity) + if(species.allergen_reaction & AG_SLEEPY) + drowsyness = max(drowsyness, disable_severity) + if(species.allergen_reaction & AG_CONFUSE) + Confuse(disable_severity/4) + /mob/living/carbon/human/handle_environment(datum/gas_mixture/environment) if(!environment) return diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 9dd1eaffe7..13694ec785 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -53,9 +53,15 @@ var/taste_sensitivity = TASTE_NORMAL // How sensitive the species is to minute tastes. var/allergens = null // Things that will make this species very sick +<<<<<<< HEAD var/allergen_reaction = AG_TOX_DMG|AG_OXY_DMG|AG_EMOTE|AG_PAIN|AG_BLURRY|AG_CONFUSE // What type of reactions will you have? These the 'main' options and are intended to approximate anaphylactic shock at high doses. VOREStation Edit'd. var/allergen_damage_severity = 4 // How bad are reactions to the allergen? Touch with extreme caution. VOREStation Edit'd. var/allergen_disable_severity = 4 // Whilst this determines how long nonlethal effects last and how common emotes are. VOREStation Edit'd. +======= + var/allergen_reaction = AG_TOX_DMG|AG_OXY_DMG|AG_EMOTE|AG_PAIN|AG_BLURRY|AG_CONFUSE // What type of reactions will you have? These the 'main' options and are intended to approximate anaphylactic shock at high doses. + var/allergen_damage_severity = 2.5 // How bad are reactions to the allergen? Touch with extreme caution. + var/allergen_disable_severity = 10 // Whilst this determines how long nonlethal effects last and how common emotes are. +>>>>>>> e39f24b49e3... Allergen CE Conversion (#8431) var/min_age = 17 var/max_age = 70 diff --git a/code/modules/reagents/reagents/_reagents.dm b/code/modules/reagents/reagents/_reagents.dm index fafd022559..b5275d2e5c 100644 --- a/code/modules/reagents/reagents/_reagents.dm +++ b/code/modules/reagents/reagents/_reagents.dm @@ -27,7 +27,7 @@ var/affects_robots = 0 // Does this chem process inside a Synth? var/allergen_type // What potential allergens does this contain? - var/allergen_factor = 1 // If the potential allergens are mixed and low-volume, they're a bit less dangerous. Needed for drinks because they're a single reagent compared to food which contains multiple seperate reagents. + var/allergen_factor = 2 // If the potential allergens are mixed and low-volume, they're a bit less dangerous. Needed for drinks because they're a single reagent compared to food which contains multiple seperate reagents. var/cup_icon_state = null var/cup_name = null @@ -171,6 +171,7 @@ if(overdose && (volume > overdose * M?.species.chemOD_threshold) && (active_metab.metabolism_class != CHEM_TOUCH && !can_overdose_touch)) overdose(M, alien, removed) if(M.species.allergens & allergen_type) //uhoh, we can't handle this! +<<<<<<< HEAD var/damage_severity = M.species.allergen_damage_severity*allergen_factor var/disable_severity = M.species.allergen_disable_severity*allergen_factor if(M.species.allergen_reaction & AG_TOX_DMG) @@ -192,6 +193,9 @@ M.drowsyness = max(M.drowsyness, disable_severity) if(M.species.allergen_reaction & AG_CONFUSE) //VOREStation Addition M.Confuse(disable_severity/4) //VOREStation Addition +======= + M.add_chemical_effect(CE_ALLERGEN,allergen_factor) +>>>>>>> e39f24b49e3... Allergen CE Conversion (#8431) remove_self(removed) return diff --git a/code/modules/reagents/reagents/dispenser.dm b/code/modules/reagents/reagents/dispenser.dm index abc0522886..7708609a33 100644 --- a/code/modules/reagents/reagents/dispenser.dm +++ b/code/modules/reagents/reagents/dispenser.dm @@ -104,7 +104,7 @@ glass_name = "ethanol" glass_desc = "A well-known alcohol with a variety of applications." - allergen_factor = 0.5 //simulates mixed drinks containing less of the allergen, as they have only a single actual reagent unlike food + allergen_factor = 1 //simulates mixed drinks containing less of the allergen, as they have only a single actual reagent unlike food /datum/reagent/ethanol/touch_mob(var/mob/living/L, var/amount) ..() diff --git a/code/modules/reagents/reagents/medicine.dm b/code/modules/reagents/reagents/medicine.dm index a18a2a1a73..2ccf92a113 100644 --- a/code/modules/reagents/reagents/medicine.dm +++ b/code/modules/reagents/reagents/medicine.dm @@ -3,7 +3,7 @@ /datum/reagent/inaprovaline name = "Inaprovaline" id = "inaprovaline" - description = "Inaprovaline is a synaptic stimulant and cardiostimulant. Commonly used to stabilize patients." + description = "Inaprovaline is a synaptic stimulant and cardiostimulant. Commonly used to stabilize patients. Also counteracts allergic reactions." taste_description = "bitterness" reagent_state = LIQUID color = "#00BFFF" @@ -15,6 +15,7 @@ if(alien != IS_DIONA) M.add_chemical_effect(CE_STABLE, 15) M.add_chemical_effect(CE_PAINKILLER, 10 * M.species.chem_strength_pain) + M.remove_chemical_effect(CE_ALLERGEN) /datum/reagent/inaprovaline/topical name = "Inaprovalaze" From d897561abac61e4c9bd6facbe99bc1736d99b6a5 Mon Sep 17 00:00:00 2001 From: Killian <49700375+KillianKirilenko@users.noreply.github.com> Date: Sun, 10 Apr 2022 21:12:38 +0100 Subject: [PATCH 2/2] allergen CE conversion fix --- code/__defines/species_languages.dm | 11 --------- .../living/carbon/human/species/species.dm | 6 ----- .../species/station/traits_vr/neutral.dm | 4 ++-- code/modules/reagents/reagents/_reagents.dm | 24 ------------------- 4 files changed, 2 insertions(+), 43 deletions(-) diff --git a/code/__defines/species_languages.dm b/code/__defines/species_languages.dm index 2a070803bb..67d6b6e7d6 100644 --- a/code/__defines/species_languages.dm +++ b/code/__defines/species_languages.dm @@ -40,16 +40,6 @@ #define ALLERGEN_STIMULANT 0x1000 // Stimulants are what makes the Tajaran heart go ruh roh - not just coffee! // Allergen reactions -<<<<<<< HEAD -#define AG_TOX_DMG 0x1 // the classic -#define AG_OXY_DMG 0x2 // intense airway reactions -#define AG_EMOTE 0x4 // general emote reactions based on affect type -#define AG_PAIN 0x8 // short-lived hurt -#define AG_WEAKEN 0x10 // too weak to move, oof -#define AG_BLURRY 0x20 // blurred vision! -#define AG_SLEEPY 0x40 // fatigue/exhaustion -#define AG_CONFUSE 0x80 // disorientation - VOREStation addition -======= #define AG_PHYS_DMG 0x1 // brute #define AG_BURN_DMG 0x2 // burns #define AG_TOX_DMG 0x4 // the classic @@ -60,7 +50,6 @@ #define AG_BLURRY 0x80 // blurred vision! #define AG_SLEEPY 0x100 // fatigue/exhaustion #define AG_CONFUSE 0x200 // disorientation ->>>>>>> e39f24b49e3... Allergen CE Conversion (#8431) // Species spawn flags #define SPECIES_IS_WHITELISTED 0x1 // Must be whitelisted to play. diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 13694ec785..91770ff1f4 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -53,15 +53,9 @@ var/taste_sensitivity = TASTE_NORMAL // How sensitive the species is to minute tastes. var/allergens = null // Things that will make this species very sick -<<<<<<< HEAD - var/allergen_reaction = AG_TOX_DMG|AG_OXY_DMG|AG_EMOTE|AG_PAIN|AG_BLURRY|AG_CONFUSE // What type of reactions will you have? These the 'main' options and are intended to approximate anaphylactic shock at high doses. VOREStation Edit'd. - var/allergen_damage_severity = 4 // How bad are reactions to the allergen? Touch with extreme caution. VOREStation Edit'd. - var/allergen_disable_severity = 4 // Whilst this determines how long nonlethal effects last and how common emotes are. VOREStation Edit'd. -======= var/allergen_reaction = AG_TOX_DMG|AG_OXY_DMG|AG_EMOTE|AG_PAIN|AG_BLURRY|AG_CONFUSE // What type of reactions will you have? These the 'main' options and are intended to approximate anaphylactic shock at high doses. var/allergen_damage_severity = 2.5 // How bad are reactions to the allergen? Touch with extreme caution. var/allergen_disable_severity = 10 // Whilst this determines how long nonlethal effects last and how common emotes are. ->>>>>>> e39f24b49e3... Allergen CE Conversion (#8431) var/min_age = 17 var/max_age = 70 diff --git a/code/modules/mob/living/carbon/human/species/station/traits_vr/neutral.dm b/code/modules/mob/living/carbon/human/species/station/traits_vr/neutral.dm index 8c54fbaee0..b0d9b66440 100644 --- a/code/modules/mob/living/carbon/human/species/station/traits_vr/neutral.dm +++ b/code/modules/mob/living/carbon/human/species/station/traits_vr/neutral.dm @@ -251,7 +251,7 @@ desc = "This trait drastically reduces the effects of allergen reactions. If you don't have any allergens set, it does nothing. It does not apply to special reactions (such as unathi drowsiness from sugars)." cost = 0 custom_only = FALSE - var_changes = list("allergen_damage_severity" = 2, "allergen_disable_severity" = 3) + var_changes = list("allergen_damage_severity" = 1.25, "allergen_disable_severity" = 5) excludes = list(/datum/trait/neutral/allergen_increased_effect) /datum/trait/neutral/allergen_increased_effect @@ -259,7 +259,7 @@ desc = "This trait drastically increases the effects of allergen reactions, enough that even a small dose can be lethal. If you don't have any allergens set, it does nothing. It does not apply to special reactions (such as unathi drowsiness from sugars)." cost = 0 custom_only = FALSE - var_changes = list("allergen_damage_severity" = 8, "allergen_disable_severity" = 6) + var_changes = list("allergen_damage_severity" = 5, "allergen_disable_severity" = 20) excludes = list(/datum/trait/neutral/allergen_reduced_effect) // Spicy Food Traits, from negative to positive. diff --git a/code/modules/reagents/reagents/_reagents.dm b/code/modules/reagents/reagents/_reagents.dm index b5275d2e5c..b42dd2d905 100644 --- a/code/modules/reagents/reagents/_reagents.dm +++ b/code/modules/reagents/reagents/_reagents.dm @@ -171,31 +171,7 @@ if(overdose && (volume > overdose * M?.species.chemOD_threshold) && (active_metab.metabolism_class != CHEM_TOUCH && !can_overdose_touch)) overdose(M, alien, removed) if(M.species.allergens & allergen_type) //uhoh, we can't handle this! -<<<<<<< HEAD - var/damage_severity = M.species.allergen_damage_severity*allergen_factor - var/disable_severity = M.species.allergen_disable_severity*allergen_factor - if(M.species.allergen_reaction & AG_TOX_DMG) - M.adjustToxLoss(damage_severity) - if(M.species.allergen_reaction & AG_OXY_DMG) - M.adjustOxyLoss(damage_severity*1.5) //VOREStation Edit - if(prob(2.5*disable_severity)) - M.emote(pick("cough","gasp","choke")) - if(M.species.allergen_reaction & AG_EMOTE) - if(prob(2.5*disable_severity)) //this has a higher base chance, but not *too* high - M.emote(pick("pale","shiver","twitch")) - if(M.species.allergen_reaction & AG_PAIN) - M.adjustHalLoss(disable_severity*2) //VOREStation Edit - if(M.species.allergen_reaction & AG_WEAKEN) - M.Weaken(disable_severity) - if(M.species.allergen_reaction & AG_BLURRY) - M.eye_blurry = max(M.eye_blurry, disable_severity) - if(M.species.allergen_reaction & AG_SLEEPY) - M.drowsyness = max(M.drowsyness, disable_severity) - if(M.species.allergen_reaction & AG_CONFUSE) //VOREStation Addition - M.Confuse(disable_severity/4) //VOREStation Addition -======= M.add_chemical_effect(CE_ALLERGEN,allergen_factor) ->>>>>>> e39f24b49e3... Allergen CE Conversion (#8431) remove_self(removed) return