Merge pull request #9891 from VOREStation/upstream-merge-7950

[MIRROR] Allergens v2
This commit is contained in:
Novacat
2021-03-10 14:06:39 -05:00
committed by GitHub
4 changed files with 223 additions and 176 deletions
+1
View File
@@ -37,6 +37,7 @@
#define COFFEE 0x200 // Mostly here for tajara.
#define GENERIC 0x400 // Catchall for stuff that doesn't fall into the groups above. You shouldn't be allergic to this type, ever.
#define SUGARS 0x800 // For unathi-like reactions
#define EGGS 0x1000 // For Skrell eggs allergy
// Allergen reactions
#define AG_TOX_DMG 0x1 // the classic
@@ -313,7 +313,7 @@
breath_heat_level_3 = 1350 //Default 1250
reagent_tag = IS_SKRELL
allergens = MEAT|FISH|DAIRY
allergens = MEAT|FISH|DAIRY|EGGS
has_limbs = list(
BP_TORSO = list("path" = /obj/item/organ/external/chest),
+22
View File
@@ -112,6 +112,28 @@
update_total()
amount = min(amount, get_free_space())
if(istype(my_atom,/obj/item/weapon/reagent_containers/food)) //The following code is targeted specifically at getting allergen reagents into food items, since for the most part they're not applied by default.
var/list/add_reagents = list()
var/totalnum = 0
for(var/item in data) //Try to find the ID
var/add_reagent_id = null
if(item in SSchemistry.chemical_reagents)
add_reagent_id = item
else if("[item]juice" in SSchemistry.chemical_reagents)
add_reagent_id = "[item]juice"
if(add_reagent_id) //If we did find it, add it to our list of reagents to add, and add the number to our total.
add_reagents[add_reagent_id] += data[item]
totalnum += data[item]
if(totalnum)
var/multconst = amount/totalnum //We're going to add these extra reagents so that they share the ratio described, but only add up to 1x the existing amount at the most
for(var/item in add_reagents)
add_reagent(item,add_reagents[item]*multconst)
for(var/datum/reagent/current in reagent_list)
if(current.id == id)
if(current.id == "blood")
File diff suppressed because it is too large Load Diff