From 37ba75ec12a3bf2181b67e5d957497c0fca286f7 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Wed, 19 Feb 2020 14:07:11 +0100 Subject: [PATCH] Fixing addiction moodlets not going away and secret sauce recipe paper. --- code/modules/mob/living/carbon/carbon.dm | 6 +++++- code/modules/reagents/chemistry/holder.dm | 14 +++++++++++--- code/modules/reagents/chemistry/recipes/special.dm | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 6460d8331d..cbb2cdb5c2 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -840,6 +840,9 @@ var/obj/item/organ/brain/B = getorgan(/obj/item/organ/brain) if(B) B.brain_death = FALSE + for(var/O in internal_organs) + var/obj/item/organ/organ = O + organ.setOrganDamage(0) for(var/thing in diseases) var/datum/disease/D = thing if(D.severity != DISEASE_SEVERITY_POSITIVE) @@ -852,7 +855,8 @@ qdel(R) update_handcuffed() if(reagents) - reagents.addiction_list = list() + for(var/addi in reagents.addiction_list) + reagents.remove_addiction(addi) cure_all_traumas(TRAUMA_RESILIENCE_MAGIC) ..() // heal ears after healing traits, since ears check TRAIT_DEAF trait diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 4c240660a9..8635626209 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -77,6 +77,8 @@ /datum/reagents/Destroy() . = ..() + //We're about to delete all reagents, so lets cleanup + addiction_list.Cut() var/list/cached_reagents = reagent_list for(var/reagent in cached_reagents) var/datum/reagent/R = reagent @@ -332,9 +334,7 @@ if(R.addiction_stage3_end to R.addiction_stage4_end) need_mob_update += R.addiction_act_stage4(C) if(R.addiction_stage4_end to INFINITY) - to_chat(C, "You feel like you've gotten over your need for [R.name].") - SEND_SIGNAL(C, COMSIG_CLEAR_MOOD_EVENT, "[R.type]_addiction") - cached_addictions.Remove(R) + remove_addiction(R) else SEND_SIGNAL(C, COMSIG_CLEAR_MOOD_EVENT, "[R.type]_overdose") addiction_tick++ @@ -344,6 +344,12 @@ C.update_stamina() update_total() +/datum/reagents/proc/remove_addiction(datum/reagent/R) + to_chat(my_atom, "You feel like you've gotten over your need for [R.name].") + SEND_SIGNAL(my_atom, COMSIG_CLEAR_MOOD_EVENT, "[R.type]_overdose") + addiction_list.Remove(R) + qdel(R) + //Signals that metabolization has stopped, triggering the end of trait-based effects /datum/reagents/proc/end_metabolization(mob/living/carbon/C, keep_liverless = TRUE) var/list/cached_reagents = reagent_list @@ -762,6 +768,8 @@ R.metabolizing = FALSE R.on_mob_end_metabolize(M) R.on_mob_delete(M) + //Clear from relevant lists + addiction_list -= R qdel(R) reagent_list -= R update_total() diff --git a/code/modules/reagents/chemistry/recipes/special.dm b/code/modules/reagents/chemistry/recipes/special.dm index cc63a8c692..fb4552f96b 100644 --- a/code/modules/reagents/chemistry/recipes/special.dm +++ b/code/modules/reagents/chemistry/recipes/special.dm @@ -168,7 +168,7 @@ GLOBAL_LIST_INIT(food_reagents, build_reagents_to_food()) //reagentid = related /obj/item/paper/secretrecipe name = "old recipe" - var/recipe_id = "secretsauce" + var/recipe_id = /datum/reagent/consumable/secretsauce /obj/item/paper/secretrecipe/examine(mob/user) //Extra secret if(isobserver(user))