diff --git a/code/__DEFINES/reagents.dm b/code/__DEFINES/reagents.dm index 621375642fa..6ceca143499 100644 --- a/code/__DEFINES/reagents.dm +++ b/code/__DEFINES/reagents.dm @@ -36,3 +36,5 @@ //used by chem masters and pill presses #define PILL_STYLE_COUNT 22 //Update this if you add more pill icons or you die #define RANDOM_PILL_STYLE 22 //Dont change this one though + +#define ALLERGIC_REMOVAL_SKIP "Allergy" diff --git a/code/datums/traits/negative.dm b/code/datums/traits/negative.dm index c5477dee2b5..d1460bbc11c 100644 --- a/code/datums/traits/negative.dm +++ b/code/datums/traits/negative.dm @@ -614,6 +614,64 @@ medical_record_text = "Patient's mind is in a vulnerable state, and cannot recover from traumatic events." hardcore_value = 9 +/datum/quirk/allergic + name = "Extreme Medicine Allergy" + desc = "Ever since you were a kid, you've been allergic to certain chemicals..." + value = -2 + gain_text = "You feel your immune system shift." + lose_text = "You feel your immune system phase back into perfect shape." + medical_record_text = "Patient's immune system responds violently to certain chemicals." + hardcore_value = 3 + var/list/allergies = list() + var/list/blacklist = list(/datum/reagent/medicine/c2,/datum/reagent/medicine/epinephrine,/datum/reagent/medicine/adminordrazine,/datum/reagent/medicine/omnizine/godblood,/datum/reagent/medicine/cordiolis_hepatico,/datum/reagent/medicine/synaphydramine,/datum/reagent/medicine/diphenhydramine) + +/datum/quirk/allergic/on_spawn() + var/list/chem_list = subtypesof(/datum/reagent/medicine) - blacklist + for(var/i in 0 to 5) + var/chem = pick(chem_list) + chem_list -= chem + allergies += chem + +/datum/quirk/allergic/post_add() + var/display = "" + for(var/C in allergies) + var/datum/reagent/chemical = C + display += initial(chemical.name) + ", " + name = "Extreme " + display +"Allergies" + medical_record_text = "Patient's immune system responds violently to [display]" + quirk_holder?.mind.store_memory("You are allergic to [display]") + to_chat(quirk_holder, "You are allergic to [display]make sure not to consume any of it!") + if(!ishuman(quirk_holder)) + return + var/mob/living/carbon/human/human_holder = quirk_holder + var/obj/item/clothing/accessory/allergy_dogtag/dogtag = new(get_turf(human_holder)) + var/list/slots = list ( + "backpack" = ITEM_SLOT_BACKPACK, + "hands" = ITEM_SLOT_HANDS + ) + dogtag.display = display + human_holder.equip_in_one_of_slots(dogtag, slots , qdel_on_fail = TRUE) + +/datum/quirk/allergic/on_process() + . = ..() + if(!iscarbon(quirk_holder)) + return + var/mob/living/carbon/carbon_quirk_holder = quirk_holder + for(var/M in allergies) + var/datum/reagent/instantiated_med = carbon_quirk_holder.reagents.has_reagent(M) + if(!instantiated_med) + continue + //Just halts the progression, I'd suggest you run to medbay asap to get it fixed + if(carbon_quirk_holder.reagents.has_reagent(/datum/reagent/medicine/epinephrine)) + instantiated_med.reagent_removal_skip_list |= ALLERGIC_REMOVAL_SKIP + return //intentionally stops the entire proc so we avoid the organ damage after the loop + instantiated_med.reagent_removal_skip_list -= ALLERGIC_REMOVAL_SKIP + carbon_quirk_holder.adjustToxLoss(3) + carbon_quirk_holder.reagents.add_reagent(/datum/reagent/toxin/histamine,3) + if(prob(10)) + carbon_quirk_holder.vomit() + carbon_quirk_holder.adjustOrganLoss(pick(ORGAN_SLOT_BRAIN,ORGAN_SLOT_APPENDIX,ORGAN_SLOT_LUNGS,ORGAN_SLOT_HEART,ORGAN_SLOT_LIVER,ORGAN_SLOT_STOMACH),10) + #undef LOCATION_LPOCKET #undef LOCATION_RPOCKET #undef LOCATION_BACKPACK diff --git a/code/modules/clothing/under/accessories.dm b/code/modules/clothing/under/accessories.dm index 533f775e832..01c308cca3f 100755 --- a/code/modules/clothing/under/accessories.dm +++ b/code/modules/clothing/under/accessories.dm @@ -382,3 +382,28 @@ armor = list("melee" = 5, "bullet" = 5, "laser" = 5, "energy" = 5, "bomb" = 20, "bio" = 20, "rad" = 5, "fire" = 0, "acid" = 25) attachment_slot = GROIN +/obj/item/clothing/accessory/allergy_dogtag + name = "Allergy dogtag" + desc = "Dogtag with a list of your allergies" + icon_state = "allergy" + above_suit = FALSE + minimize_when_attached = TRUE + attachment_slot = CHEST + ///Display message + var/display + +/obj/item/clothing/accessory/allergy_dogtag/examine(mob/user) + . = ..() + . += "The dogtag has a listing of allergies : [display]" + +/obj/item/clothing/accessory/allergy_dogtag/on_uniform_equip(obj/item/clothing/under/U, user) + . = ..() + RegisterSignal(U,COMSIG_PARENT_EXAMINE,.proc/on_examine) + +/obj/item/clothing/accessory/allergy_dogtag/on_uniform_dropped(obj/item/clothing/under/U, user) + . = ..() + UnregisterSignal(U,COMSIG_PARENT_EXAMINE) + +///What happens when we examine the uniform +/obj/item/clothing/accessory/allergy_dogtag/proc/on_examine(datum/source, mob/user, list/examine_list) + examine_list += "The dogtag has a listing of allergies : [display]" diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 6239f162fa5..becdc60b43d 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -70,6 +70,8 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) var/harmful = FALSE /// Are we from a material? We might wanna know that for special stuff. Like metalgen. Is replaced with a ref of the material on New() var/datum/material/material + ///A list of causes why this chem should skip being removed, if the length is 0 it will be removed from holder naturally, if this is >0 it will not be removed from the holder. + var/list/reagent_removal_skip_list = list() /datum/reagent/New() . = ..() @@ -108,8 +110,9 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) /// Called from [/datum/reagents/proc/metabolize] /datum/reagent/proc/on_mob_life(mob/living/carbon/M) current_cycle++ + if(!length(reagent_removal_skip_list)) + return holder.remove_reagent(type, metabolization_rate * M.metabolism_efficiency) //By default it slowly disappears. - return ///Called after a reagent is transfered /datum/reagent/proc/on_transfer(atom/A, method=TOUCH, trans_volume) diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index 81faab22570..44e471587d6 100755 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -20,6 +20,8 @@ var/mob/living/carbon/human/H = M if(!HAS_TRAIT(H, TRAIT_NOHUNGER)) H.adjust_nutrition(nutriment_factor) + if(!length(reagent_removal_skip_list)) + return holder.remove_reagent(type, metabolization_rate) /datum/reagent/consumable/expose_mob(mob/living/M, method=TOUCH, reac_volume) diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 0ec14bbe693..65513ce433b 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -12,6 +12,8 @@ /datum/reagent/medicine/on_mob_life(mob/living/carbon/M) current_cycle++ + if(!length(reagent_removal_skip_list)) + return holder.remove_reagent(type, metabolization_rate / M.metabolism_efficiency) //medicine reagents stay longer if you have a better metabolism /datum/reagent/medicine/leporazine diff --git a/icons/mob/clothing/accessories.dmi b/icons/mob/clothing/accessories.dmi index 7d21a38f29a..71fcac7c003 100644 Binary files a/icons/mob/clothing/accessories.dmi and b/icons/mob/clothing/accessories.dmi differ diff --git a/icons/obj/clothing/accessories.dmi b/icons/obj/clothing/accessories.dmi index 46740d803db..767a8eb0f7b 100644 Binary files a/icons/obj/clothing/accessories.dmi and b/icons/obj/clothing/accessories.dmi differ