Diet/Allergy Rework & Refactor Pt2 (#7940)

* Diet/Allergy Pt2

* couple more reaction types

* refactor and improve

* Update Chemistry-Reagents.dm
This commit is contained in:
Killian
2021-03-07 21:09:18 +00:00
committed by GitHub
parent 698d1035ab
commit 948d43afec
5 changed files with 43 additions and 26 deletions

View File

@@ -25,6 +25,9 @@
var/affects_dead = 0 // Does this chem process inside a corpse?
var/affects_robots = 0 // Does this chem process inside a Synth?
var/allergen_type = GENERIC // 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/cup_icon_state = null
var/cup_name = null
@@ -159,6 +162,26 @@
affect_touch(M, alien, removed)
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)
if(M.species.allergen_reaction & AG_OXY_DMG)
M.adjustOxyLoss(damage_severity)
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)
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)
remove_self(removed)
return

View File

@@ -82,8 +82,6 @@
var/nutriment_factor = 0
var/strength = 10 // This is, essentially, units between stages - the lower, the stronger. Less fine tuning, more clarity.
var/allergen_type = GENERIC // What potential allergens does this contain?
var/allergen_factor = 0.5 // 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/toxicity = 1
var/druggy = 0
@@ -93,6 +91,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
/datum/reagent/ethanol/touch_mob(var/mob/living/L, var/amount)
if(istype(L))
@@ -141,13 +140,11 @@
if(halluci)
M.hallucination = max(M.hallucination, halluci*3)
if(M.species.allergens & allergen_type)
M.adjustToxLoss(((M.species.allergen_severity*allergen_factor)*4) * removed)
/datum/reagent/ethanol/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed)
if(issmall(M)) removed *= 2
M.adjust_nutrition(nutriment_factor * removed)
if(!(M.species.allergens & allergen_type)) //assuming it doesn't cause a horrible reaction, we get the nutrition effects
M.adjust_nutrition(nutriment_factor * removed)
var/strength_mod = 1 * M.species.alcohol_mod
if(alien == IS_SKRELL)
strength_mod *= 5
@@ -188,9 +185,6 @@
if(halluci)
M.hallucination = max(M.hallucination, halluci)
if(M.species.allergens & allergen_type)
M.adjustToxLoss((M.species.allergen_severity*allergen_factor) * removed)
/datum/reagent/ethanol/touch_obj(var/obj/O)
if(istype(O, /obj/item/weapon/paper))

View File

@@ -9,7 +9,6 @@
metabolism = REM * 4
ingest_met = REM * 4
var/nutriment_factor = 30 // Per unit
var/allergen_type = GENERIC // What potential allergens does this contain?
var/injectable = 0
color = "#664330"
@@ -41,9 +40,6 @@
if(!injectable && alien != IS_SLIME)
M.adjustToxLoss(0.1 * removed)
return
if(M.species.allergens & allergen_type)
M.adjustToxLoss((M.species.allergen_severity*4) * removed)
return
affect_ingest(M, alien, removed)
..()
@@ -52,9 +48,7 @@
if(IS_DIONA) return
if(IS_UNATHI) removed *= 0.5
if(issmall(M)) removed *= 2 // Small bodymass, more effect from lower volume.
if(M.species.allergens & allergen_type) //uhoh, we can't digest this!
M.adjustToxLoss(M.species.allergen_severity * removed)
else //delicious
if(!(M.species.allergens & allergen_type)) //assuming it doesn't cause a horrible reaction, we'll be ok!
M.heal_organ_damage(0.5 * removed, 0)
M.adjust_nutrition(nutriment_factor * removed)
M.add_chemical_effect(CE_BLOODRESTORE, 4 * removed)
@@ -859,22 +853,16 @@
var/adj_sleepy = 0
var/adj_temp = 0
var/water_based = TRUE
var/allergen_type = GENERIC // 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.
/datum/reagent/drink/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
var/strength_mod = 1
if(alien == IS_SLIME && water_based)
strength_mod = 3
M.adjustToxLoss(removed * strength_mod) // Probably not a good idea; not very deadly though
if(M.species.allergens & allergen_type) // Unless you're allergic, in which case...
M.adjustToxLoss(((M.species.allergen_severity*allergen_factor)*2) * removed)
return
/datum/reagent/drink/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed)
if(M.species.allergens & allergen_type)
M.adjustToxLoss((M.species.allergen_severity*allergen_factor) * removed)
else //delicious
if(!(M.species.allergens & allergen_type))
M.adjust_nutrition(nutrition * removed)
M.dizziness = max(0, M.dizziness + adj_dizzy)
M.drowsyness = max(0, M.drowsyness + adj_drowsy)