-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIRROR] Adds Food Allergies as a counterpart to Medicine Allergies […
…MDB IGNORE] (#24493) * Adds Food Allergies as a counterpart to Medicine Allergies (#79118) ## About The Pull Request Adds food allergies as a counterpart to medicinal allergies. This is about as you would expect. Eating food you are allergic to causes Anaphylaxis, which can be cured with epinephrine. If you are not cured rapidly, you will shortly fall into a coma and die. There is a preference for choosing your character's allergy. Not all food types are viable allergen types: Only `"Alcohol", "Bugs", "Dairy", "Fruit", "Grain", "Meat", "Nuts", "Seafood", "Sugar", "Vegetables"`. You also get a dogtag like med allergies. Minor implementation detail: I added a "dangerous" level of food quality / scale, so I gave it to the Death Sandwich. ## Why It's Good For The Game This was a request, and I saw it fairly harmless, so I said why not. Similar to Medicine Allergy, it adds a small mechanic to concern yourself with when you visit the kitchen, encouraging you to get a bit more familiar with food types before diving into food at the kitchen. As it is not as impactful as Medicine Allergy, it is only a -2 quirk. ## Changelog :cl: Melbert add: Adds Food Allergies as a -2 quirk. You can select which food you're allergic to or rock a random option. /:cl: * Adds Food Allergies as a counterpart to Medicine Allergies --------- Co-authored-by: MrMelbert <[email protected]>
- Loading branch information
1 parent
a9d96ac
commit c823eb8
Showing
10 changed files
with
208 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/datum/disease/anaphylaxis | ||
form = "Shock" | ||
name = "Anaphylaxis" | ||
desc = "Patient is undergoing a life-threatening allergic reaction and will die if not treated." | ||
max_stages = 3 | ||
cure_text = "Epinephrine" | ||
cures = list(/datum/reagent/medicine/epinephrine) | ||
cure_chance = 20 | ||
agent = "Allergy" | ||
viable_mobtypes = list(/mob/living/carbon/human) | ||
disease_flags = CURABLE | ||
severity = DISEASE_SEVERITY_DANGEROUS | ||
spread_flags = DISEASE_SPREAD_NON_CONTAGIOUS | ||
spread_text = "None" | ||
visibility_flags = HIDDEN_PANDEMIC | ||
bypasses_immunity = TRUE | ||
stage_prob = 5 | ||
|
||
/datum/disease/anaphylaxis/stage_act(seconds_per_tick, times_fired) | ||
. = ..() | ||
if(!.) | ||
return | ||
|
||
if(HAS_TRAIT(affected_mob, TRAIT_TOXINLOVER)) // You are no fun | ||
cure() | ||
return | ||
|
||
// Cool them enough to feel cold to the touch, and then some, because temperature mechanics are dumb | ||
affected_mob.adjust_bodytemperature(-10 * seconds_per_tick * stage, min_temp = BODYTEMP_COLD_DAMAGE_LIMIT - 70) | ||
|
||
switch(stage) | ||
// early symptoms: mild shakes and dizziness | ||
if(1) | ||
if(affected_mob.num_hands >= 1 && SPT_PROB(5, seconds_per_tick)) | ||
to_chat(affected_mob, span_warning("You feel your hand[affected_mob.num_hands == 1 ? "":"s"] start to shake.")) | ||
affected_mob.adjust_jitter_up_to(4 SECONDS * seconds_per_tick, 1 MINUTES) | ||
if(affected_mob.num_legs >= 1 && SPT_PROB(5, seconds_per_tick)) | ||
to_chat(affected_mob, span_warning("You feel your leg[affected_mob.num_hands == 1 ? "":"s"] start to shake.")) | ||
affected_mob.adjust_jitter_up_to(4 SECONDS * seconds_per_tick, 1 MINUTES) | ||
if(SPT_PROB(2, seconds_per_tick)) | ||
affected_mob.adjust_dizzy_up_to(5 SECONDS * seconds_per_tick, 1 MINUTES) | ||
if(SPT_PROB(1, seconds_per_tick)) | ||
to_chat(affected_mob, span_danger("Your throat itches.")) | ||
|
||
// warning symptoms: violent shakes, dizziness, blurred vision, difficulty breathing | ||
if(2) | ||
affected_mob.apply_damage(0.33 * seconds_per_tick, TOX, spread_damage = TRUE) | ||
|
||
if(affected_mob.num_hands >= 1 && SPT_PROB(5, seconds_per_tick)) | ||
to_chat(affected_mob, span_warning("You feel your hand[affected_mob.num_hands == 1 ? "":"s"] shake violently.")) | ||
affected_mob.adjust_jitter_up_to(8 SECONDS * seconds_per_tick, 1 MINUTES) | ||
if(prob(20)) | ||
affected_mob.drop_all_held_items() | ||
if(affected_mob.num_legs >= 1 && SPT_PROB(5, seconds_per_tick)) | ||
to_chat(affected_mob, span_warning("You feel your leg[affected_mob.num_hands == 1 ? "":"s"] shake violently.")) | ||
affected_mob.adjust_jitter_up_to(8 SECONDS * seconds_per_tick, 1 MINUTES) | ||
if(prob(40) && affected_mob.getStaminaLoss() < 75) | ||
affected_mob.adjustStaminaLoss(15) | ||
if(affected_mob.get_organ_slot(ORGAN_SLOT_EYES) && SPT_PROB(4, seconds_per_tick)) | ||
affected_mob.adjust_eye_blur(4 SECONDS * seconds_per_tick) | ||
to_chat(affected_mob, span_warning("It's getting harder to see clearly.")) | ||
if(!HAS_TRAIT(affected_mob, TRAIT_NOBREATH) && SPT_PROB(4, seconds_per_tick)) | ||
affected_mob.apply_damage(2 * seconds_per_tick, OXY) | ||
affected_mob.losebreath += (2 * seconds_per_tick) | ||
to_chat(affected_mob, span_warning("It's getting harder to breathe.")) | ||
if(SPT_PROB(2, seconds_per_tick)) | ||
affected_mob.adjust_drowsiness_up_to(3 SECONDS * seconds_per_tick, 30 SECONDS) | ||
if(SPT_PROB(2, seconds_per_tick)) | ||
affected_mob.adjust_dizzy_up_to(5 SECONDS * seconds_per_tick, 1 MINUTES) | ||
affected_mob.adjust_confusion_up_to(1 SECONDS * seconds_per_tick, 10 SECONDS) | ||
if(SPT_PROB(2, seconds_per_tick)) | ||
affected_mob.vomit(MOB_VOMIT_MESSAGE|MOB_VOMIT_HARM) | ||
affected_mob.Stun(2 SECONDS) // The full 20 second vomit stun would be lethal | ||
if(SPT_PROB(1, seconds_per_tick)) | ||
affected_mob.emote("cough") | ||
if(SPT_PROB(1, seconds_per_tick)) | ||
to_chat(affected_mob, span_danger("Your throat feels sore.")) | ||
|
||
// "you are too late" symptoms: death. | ||
if(3) | ||
affected_mob.apply_damage(3 * seconds_per_tick, TOX, spread_damage = TRUE) | ||
affected_mob.apply_damage(1 * seconds_per_tick, OXY) | ||
affected_mob.Unconscious(3 SECONDS * seconds_per_tick) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
GLOBAL_LIST_INIT(possible_food_allergies, list( | ||
"Alcohol" = ALCOHOL, | ||
"Bugs" = BUGS, | ||
"Dairy" = DAIRY, | ||
"Fruit" = FRUIT, | ||
"Grain" = GRAIN, | ||
"Meat" = MEAT, | ||
"Nuts" = NUTS, | ||
"Seafood" = SEAFOOD, | ||
"Sugar" = SUGAR, | ||
"Vegetables" = VEGETABLES, | ||
)) | ||
|
||
/datum/quirk/item_quirk/food_allergic | ||
name = "Food Allergy" | ||
desc = "Ever since you were a kid, you've been allergic to certain foods." | ||
icon = FA_ICON_SHRIMP | ||
value = -2 | ||
gain_text = span_danger("You feel your immune system shift.") | ||
lose_text = span_notice("You feel your immune system phase back into perfect shape.") | ||
medical_record_text = "Patient's immune system responds violently to certain food." | ||
hardcore_value = 1 | ||
quirk_flags = QUIRK_HUMAN_ONLY | ||
mail_goodies = list(/obj/item/reagent_containers/hypospray/medipen) | ||
/// Footype flags that will trigger the allergy | ||
var/target_foodtypes = NONE | ||
|
||
/datum/quirk/item_quirk/food_allergic/add(client/client_source) | ||
if(target_foodtypes != NONE) // Already set, don't care | ||
return | ||
|
||
var/desired_allergy = client_source?.prefs.read_preference(/datum/preference/choiced/food_allergy) || "Random" | ||
if(desired_allergy != "Random") | ||
target_foodtypes = GLOB.possible_food_allergies[desired_allergy] | ||
if(target_foodtypes != NONE) // Got a preference, don't care | ||
return | ||
|
||
target_foodtypes = pick(flatten_list(GLOB.possible_food_allergies)) | ||
|
||
/datum/quirk/item_quirk/food_allergic/add_unique(client/client_source) | ||
var/what_are_we_actually_killed_by = english_list(bitfield_to_list(target_foodtypes, FOOD_FLAGS_IC)) // This should never be more than one thing but just in case we can support it | ||
to_chat(client_source.mob, span_info("You are allergic to [what_are_we_actually_killed_by]. Watch what you eat!")) | ||
|
||
var/obj/item/clothing/accessory/dogtag/allergy/dogtag = new(quirk_holder, what_are_we_actually_killed_by) | ||
give_item_to_holder(dogtag, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS), flavour_text = "Keep it close around the kitchen.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/datum/preference/choiced/food_allergy | ||
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES | ||
savefile_key = "food_allergy" | ||
savefile_identifier = PREFERENCE_CHARACTER | ||
can_randomize = FALSE | ||
|
||
/datum/preference/choiced/food_allergy/init_possible_values() | ||
return list("Random") + assoc_to_keys(GLOB.possible_food_allergies) | ||
|
||
/datum/preference/choiced/food_allergy/create_default_value() | ||
return "Random" | ||
|
||
/datum/preference/choiced/food_allergy/is_accessible(datum/preferences/preferences) | ||
if (!..()) | ||
return FALSE | ||
|
||
return "Food Allergy" in preferences.all_quirks | ||
|
||
/datum/preference/choiced/food_allergy/apply_to_human(mob/living/carbon/human/target, value) | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...ui/interfaces/PreferencesMenu/preferences/features/character_preferences/food_allergy.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { FeatureChoiced, FeatureDropdownInput } from '../base'; | ||
|
||
export const food_allergy: FeatureChoiced = { | ||
name: 'Food Allergy', | ||
component: FeatureDropdownInput, | ||
}; |