From 306b711ab174b6937ce407bc392bdbcc96d772d3 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Mon, 24 Feb 2020 14:30:50 -0700 Subject: [PATCH] Update reagents.dm --- code/modules/reagents/chemistry/reagents.dm | 29 +++++++-------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 4aabd82d6a..8de788e971 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -78,7 +78,6 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) current_cycle++ if(holder) holder.remove_reagent(type, metabolization_rate * M.metabolism_efficiency) //By default it slowly disappears. - return //called when a mob processes chems when dead. /datum/reagent/proc/on_mob_dead(mob/living/carbon/M) @@ -87,15 +86,14 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) current_cycle++ if(holder) holder.remove_reagent(type, metabolization_rate * M.metabolism_efficiency) //By default it slowly disappears. - return // Called when this reagent is first added to a mob /datum/reagent/proc/on_mob_add(mob/living/L, amount) if(!iscarbon(L)) return var/mob/living/carbon/M = L + log_reagent("MOB ADD: on_mob_add(): [key_name(M)] at [AREACOORD(T)] - [volume] of [type] with [purity] purity") if (purity == 1) - log_game("CHEM: [L] ckey: [L.key] has ingested [volume]u of [type]") return if(cached_purity == 1) cached_purity = purity @@ -112,20 +110,18 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) R.name = name//Negative effects are hidden if(R.chemical_flags & REAGENT_INVISIBLE) R.chemical_flags |= (REAGENT_INVISIBLE) - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [inverse_chem]") - return + log_reagent("MOB ADD: on_mob_add() (impure): merged [volume] of [inverse_chem]") else if (impure_chem) var/impureVol = amount * (1 - purity) //turns impure ratio into impure chem if(!(chemical_flags & REAGENT_SPLITRETAINVOL)) M.reagents.remove_reagent(type, (impureVol), FALSE) M.reagents.add_reagent(impure_chem, impureVol, FALSE, other_purity = 1-cached_purity) - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume - impureVol]u of [type]") - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [impure_chem]") - return + log_reagent("MOB ADD: on_mob_add() (mixed purity): merged [volume - impureVol] of [type] and [volume] of [impure_chem]") // Called when this reagent is removed while inside a mob /datum/reagent/proc/on_mob_delete(mob/living/L) - return + var/turf/T = get_turf(L) + log_reagent("MOB DELETE: on_mob_delete: [key_name(L)] at [AREACOORD(T)] - [type]") // Called when this reagent first starts being metabolized by a liver /datum/reagent/proc/on_mob_metabolize(mob/living/L) @@ -146,8 +142,9 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) /datum/reagent/proc/on_merge(data, amount, mob/living/carbon/M, purity) if(!iscarbon(M)) return + var/turf/T = get_turf(M) + log_reagent("MOB ADD: on_merge(): [key_name(M)] at [AREACOORD(T)] - [volume] of [type] with [purity] purity") if (purity == 1) - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [type]") return cached_purity = purity //purity SHOULD be precalculated from the add_reagent, update cache. if (purity < 0) @@ -163,16 +160,13 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) R.name = name//Negative effects are hidden if(R.chemical_flags & REAGENT_INVISIBLE) R.chemical_flags |= (REAGENT_INVISIBLE) - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [inverse_chem]") - return + log_reagent("MOB ADD: on_merge() (impure): merged [volume] of [inverse_chem]") else if (impure_chem) //SPLIT var/impureVol = amount * (1 - purity) if(!(chemical_flags & REAGENT_SPLITRETAINVOL)) M.reagents.remove_reagent(type, impureVol, FALSE) M.reagents.add_reagent(impure_chem, impureVol, FALSE, other_purity = 1-cached_purity) - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume - impureVol]u of [type]") - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [impure_chem]") - return + log_reagent("MOB ADD: on_merge() (mixed purity): merged [volume - impureVol] of [type] and [volume] of [impure_chem]") /datum/reagent/proc/on_update(atom/A) return @@ -188,31 +182,26 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) /datum/reagent/proc/overdose_start(mob/living/M) to_chat(M, "You feel like you took too much of [name]!") SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "[type]_overdose", /datum/mood_event/overdose, name) - return /datum/reagent/proc/addiction_act_stage1(mob/living/M) SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "[type]_overdose", /datum/mood_event/withdrawal_light, name) if(prob(30)) to_chat(M, "You feel like having some [name] right about now.") - return /datum/reagent/proc/addiction_act_stage2(mob/living/M) SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "[type]_overdose", /datum/mood_event/withdrawal_medium, name) if(prob(30)) to_chat(M, "You feel like you need [name]. You just can't get enough.") - return /datum/reagent/proc/addiction_act_stage3(mob/living/M) SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "[type]_overdose", /datum/mood_event/withdrawal_severe, name) if(prob(30)) to_chat(M, "You have an intense craving for [name].") - return /datum/reagent/proc/addiction_act_stage4(mob/living/M) SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "[type]_overdose", /datum/mood_event/withdrawal_critical, name) if(prob(30)) to_chat(M, "You're not feeling good at all! You really need some [name].") - return /proc/pretty_string_from_reagent_list(list/reagent_list) //Convert reagent list to a printable string for logging etc