Allergen CE Conversion (#8431)

* WIP allergen conversion

* allergen CE conversion

* allergen CE conversion

inap now actually stops reactions properly

* add brute/burn allergen reactions

* recommended changes
This commit is contained in:
Killian
2022-04-03 02:28:25 +01:00
committed by GitHub
parent 4780b1efe5
commit e39f24b49e
8 changed files with 54 additions and 32 deletions

View File

@@ -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

View File

@@ -40,13 +40,16 @@
#define ALLERGEN_STIMULANT 0x1000 // Stimulants are what makes the Tajaran heart go ruh roh - not just coffee!
// Allergen reactions
#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_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
// Species spawn flags
#define SPECIES_IS_WHITELISTED 0x1 // Must be whitelisted to play.

View File

@@ -435,6 +435,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))

View File

@@ -82,6 +82,8 @@
handle_shock()
handle_pain()
handle_allergens()
handle_medical_side_effects()
@@ -660,6 +662,35 @@
playsound_local(get_turf(src), suit_exhale_sound, 100, pressure_affected = FALSE, volume_channel = VOLUME_CHANNEL_AMBIENCE)
/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

View File

@@ -53,9 +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
var/allergen_reaction = AG_TOX_DMG|AG_OXY_DMG|AG_EMOTE|AG_PAIN|AG_WEAKEN // 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 = 1.2 // How bad are reactions to the allergen? Touch with extreme caution.
var/allergen_disable_severity = 2.5 // Whilst this determines how long nonlethal effects last and how common emotes are.
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.
var/min_age = 17
var/max_age = 70

View File

@@ -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
@@ -166,25 +166,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!
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 * removed)
if(M.species.allergen_reaction & AG_OXY_DMG)
M.adjustOxyLoss(damage_severity * removed)
if(prob(2*disable_severity))
M.emote(pick("cough","gasp","choke"))
if(M.species.allergen_reaction & AG_EMOTE)
if(prob(2*disable_severity))
M.emote(pick("pale","shiver","twitch"))
if(M.species.allergen_reaction & AG_PAIN)
M.adjustHalLoss(disable_severity)
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)
M.add_chemical_effect(CE_ALLERGEN,allergen_factor)
remove_self(removed)
return

View File

@@ -92,7 +92,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)
..()

View File

@@ -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"