diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index cf3a3c1faf..c76b5d4070 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -193,13 +193,13 @@ // #define SPEECH_FORCED 7 // /mob/living signals -#define COMSIG_LIVING_FULLY_HEAL "living_fully_healed" //from base of /mob/living/fully_heal(): (admin_revive) #define COMSIG_LIVING_REGENERATE_LIMBS "living_regenerate_limbs" //from base of /mob/living/regenerate_limbs(): (noheal, excluded_limbs) #define COMSIG_LIVING_RESIST "living_resist" //from base of mob/living/resist() (/mob/living) #define COMSIG_LIVING_IGNITED "living_ignite" //from base of mob/living/IgniteMob() (/mob/living) #define COMSIG_LIVING_EXTINGUISHED "living_extinguished" //from base of mob/living/ExtinguishMob() (/mob/living) #define COMSIG_LIVING_ELECTROCUTE_ACT "living_electrocute_act" //from base of mob/living/electrocute_act(): (shock_damage) #define COMSIG_LIVING_MINOR_SHOCK "living_minor_shock" //sent by stuff like stunbatons and tasers: () +#define COMSIG_LIVING_REVIVE "living_revive" //from base of mob/living/revive() (full_heal, admin_revive) #define COMSIG_MOB_CLIENT_LOGIN "comsig_mob_client_login" //sent when a mob/login() finishes: (client) #define COMSIG_LIVING_GUN_PROCESS_FIRE "living_gun_process_fire" //from base of /obj/item/gun/proc/process_fire(): (atom/target, params, zone_override) diff --git a/code/datums/components/mood.dm b/code/datums/components/mood.dm index 2ecd77546d..5e9382f88e 100644 --- a/code/datums/components/mood.dm +++ b/code/datums/components/mood.dm @@ -21,6 +21,7 @@ RegisterSignal(parent, COMSIG_ADD_MOOD_EVENT, .proc/add_event) RegisterSignal(parent, COMSIG_CLEAR_MOOD_EVENT, .proc/clear_event) RegisterSignal(parent, COMSIG_MODIFY_SANITY, .proc/modify_sanity) + RegisterSignal(parent, COMSIG_LIVING_REVIVE, .proc/on_revive) RegisterSignal(parent, COMSIG_MOB_HUD_CREATED, .proc/modify_hud) var/mob/living/owner = parent @@ -81,7 +82,8 @@ msg += "I don't have much of a reaction to anything right now.\n" to_chat(user || parent, msg) -/datum/component/mood/proc/update_mood() //Called whenever a mood event is added or removed +///Called after moodevent/s have been added/removed. +/datum/component/mood/proc/update_mood() mood = 0 shown_mood = 0 for(var/i in mood_events) @@ -234,6 +236,15 @@ qdel(event) update_mood() +/datum/component/mood/proc/remove_temp_moods() //Removes all temp moodsfor(var/i in mood_events) + for(var/i in mood_events) + var/datum/mood_event/moodlet = mood_events[i] + if(!moodlet || !moodlet.timeout) + continue + mood_events -= i + qdel(moodlet) + update_mood() + /datum/component/mood/proc/modify_hud(datum/source) var/mob/living/owner = parent var/datum/hud/hud = owner.hud_used @@ -270,5 +281,12 @@ if(0 to NUTRITION_LEVEL_STARVING) add_event(null, "nutrition", /datum/mood_event/starving) +///Called when parent is ahealed. +/datum/component/mood/proc/on_revive(datum/source, full_heal) + if(!full_heal) + return + remove_temp_moods() + setSanity(initial(sanity)) + #undef MINOR_INSANITY_PEN #undef MAJOR_INSANITY_PEN diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index de41623b34..574a5aedd2 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -856,6 +856,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) @@ -868,7 +871,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/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 94e8cd22fa..423277863f 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -803,7 +803,7 @@ hud_used.staminas?.update_icon_state() hud_used.staminabuffer?.update_icon_state() -/mob/living/carbon/human/fully_heal(admin_revive = 0) +/mob/living/carbon/human/fully_heal(admin_revive = FALSE) if(admin_revive) regenerate_limbs() regenerate_organs() diff --git a/code/modules/mob/living/carbon/human/species_types/dullahan.dm b/code/modules/mob/living/carbon/human/species_types/dullahan.dm index 220e639e34..499e3b0276 100644 --- a/code/modules/mob/living/carbon/human/species_types/dullahan.dm +++ b/code/modules/mob/living/carbon/human/species_types/dullahan.dm @@ -135,7 +135,7 @@ RegisterSignal(owner, COMSIG_CLICK_SHIFT, .proc/examinate_check) RegisterSignal(src, COMSIG_ATOM_HEARER_IN_VIEW, .proc/include_owner) RegisterSignal(owner, COMSIG_LIVING_REGENERATE_LIMBS, .proc/unlist_head) - RegisterSignal(owner, COMSIG_LIVING_FULLY_HEAL, .proc/retrieve_head) + RegisterSignal(owner, COMSIG_LIVING_REVIVE, .proc/retrieve_head) /obj/item/dullahan_relay/proc/examinate_check(atom/source, mob/user) if(user.client.eye == src) @@ -148,8 +148,9 @@ /obj/item/dullahan_relay/proc/unlist_head(datum/source, noheal = FALSE, list/excluded_limbs) excluded_limbs |= BODY_ZONE_HEAD // So we don't gib when regenerating limbs. -/obj/item/dullahan_relay/proc/retrieve_head(datum/source, admin_revive = FALSE) - if(admin_revive) //retrieving the owner's head for ahealing purposes. +//Retrieving the owner's head for better ahealing. +/obj/item/dullahan_relay/proc/retrieve_head(datum/source, full_heal, admin_revive) + if(admin_revive) var/obj/item/bodypart/head/H = loc var/turf/T = get_turf(owner) if(H && istype(H) && T && !(H in owner.GetAllContents())) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 0c11d6ab42..212ea79e9d 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -482,7 +482,8 @@ med_hud_set_status() //proc used to ressuscitate a mob -/mob/living/proc/revive(full_heal = 0, admin_revive = 0) +/mob/living/proc/revive(full_heal = FALSE, admin_revive = FALSE) + SEND_SIGNAL(src, COMSIG_LIVING_REVIVE, full_heal, admin_revive) if(full_heal) fully_heal(admin_revive) if(stat == DEAD && can_be_revived()) //in some cases you can't revive (e.g. no brain) @@ -528,11 +529,6 @@ fire_stacks = 0 confused = 0 update_canmove() - var/datum/component/mood/mood = GetComponent(/datum/component/mood) - if (mood) - QDEL_LIST_ASSOC_VAL(mood.mood_events) - mood.sanity = SANITY_GREAT - mood.update_mood() //Heal all organs if(iscarbon(src)) var/mob/living/carbon/C = src @@ -540,8 +536,6 @@ for(var/organ in C.internal_organs) var/obj/item/organ/O = organ O.setOrganDamage(0) - SEND_SIGNAL(src, COMSIG_LIVING_FULLY_HEAL, admin_revive) - //proc called by revive(), to check if we can actually ressuscitate the mob (we don't want to revive him and have him instantly die again) /mob/living/proc/can_be_revived() 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))