From cb09fe1a0881fd825878440e269fcb0ee18ca18d Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 03:16:35 -0400 Subject: [PATCH 01/17] aheals fix addiction --- code/datums/components/mood.dm | 15 ++++++++++++--- code/modules/mob/living/carbon/carbon.dm | 2 ++ code/modules/mob/living/carbon/human/human.dm | 2 +- code/modules/mob/living/living.dm | 3 --- code/modules/reagents/chemistry/holder.dm | 12 +++++++++--- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/code/datums/components/mood.dm b/code/datums/components/mood.dm index 6e3b8cee429d7..76c14c593f3eb 100644 --- a/code/datums/components/mood.dm +++ b/code/datums/components/mood.dm @@ -23,6 +23,7 @@ RegisterSignal(parent, COMSIG_ADD_MOOD_EVENT, PROC_REF(add_event)) RegisterSignal(parent, COMSIG_CLEAR_MOOD_EVENT, PROC_REF(clear_event)) RegisterSignal(parent, COMSIG_MOVABLE_ENTERED_AREA, PROC_REF(check_area_mood)) + RegisterSignal(parent, COMSIG_LIVING_REVIVE, PROC_REF(on_revive)) RegisterSignal(parent, COMSIG_MOB_HUD_CREATED, PROC_REF(modify_hud)) RegisterSignal(parent, COMSIG_HERETIC_MASK_ACT, PROC_REF(direct_sanity_drain)) @@ -93,7 +94,8 @@ msg += thought_msg to_chat(user || parent, EXAMINE_BLOCK(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) @@ -294,14 +296,14 @@ category = REF(category) return mood_events[category] -/datum/component/mood/proc/remove_temp_moods(var/admin) //Removes all temp moods +/datum/component/mood/proc/remove_temp_moods() //Removes all temp moods for(var/i in mood_events) var/datum/mood_event/moodlet = mood_events[i] if(!moodlet || !moodlet.timeout) continue mood_events -= moodlet.category qdel(moodlet) - update_mood() + update_mood() /datum/component/mood/proc/modify_hud(datum/source) @@ -380,6 +382,13 @@ else clear_event(null, "area") +///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 e2186925bee7a..136f4992a5e75 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -812,6 +812,8 @@ CREATION_TEST_IGNORE_SELF(/mob/living/carbon) /mob/living/carbon/fully_heal(admin_revive = FALSE) if(reagents) reagents.clear_reagents() + for(var/addi in reagents.addiction_list) + reagents.remove_addiction(addi) for(var/O in internal_organs) var/obj/item/organ/organ = O organ.setOrganDamage(0) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 7b4f7add40380..cf2e8c4254628 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -783,7 +783,7 @@ else hud_used.healthdoll.icon_state = "healthdoll_DEAD" -/mob/living/carbon/human/fully_heal(admin_revive = 0) +/mob/living/carbon/human/fully_heal(admin_revive = FALSE) dna?.species.spec_fully_heal(src) if(admin_revive) regenerate_limbs() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 46c7eb35afe58..bed9202374f84 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -727,9 +727,6 @@ stuttering = 0 slurring = 0 jitteriness = 0 - var/datum/component/mood/mood = GetComponent(/datum/component/mood) - if (mood) - mood.remove_temp_moods(admin_revive) stop_sound_channel(CHANNEL_HEARTBEAT) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 695ceef34eaae..2f554757a2961 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -342,10 +342,12 @@ if(R.volume >= R.overdose_threshold && !R.overdosed) R.overdosed = 1 need_mob_update += R.overdose_start(C) + log_game("[key_name(C)] has started overdosing on [R.name] at [R.volume] units.") if(R.addiction_threshold) if(R.volume >= R.addiction_threshold && !is_type_in_list(R, cached_addictions)) var/datum/reagent/new_reagent = new R.type() cached_addictions.Add(new_reagent) + log_game("[key_name(C)] has become addicted to [R.name] at [R.volume] units.") if(R.overdosed) need_mob_update += R.overdose_process(C) if(is_type_in_list(R,cached_addictions)) @@ -372,9 +374,7 @@ if(30 to 40) need_mob_update += R.addiction_act_stage4(C) if(40 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]_overdose") - cached_addictions.Remove(R) + remove_addiction(R) else SEND_SIGNAL(C, COMSIG_CLEAR_MOOD_EVENT, "[R.type]_overdose") addiction_tick++ @@ -383,6 +383,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 From 75c2c4f1fcccb1aadee0653e6e9e0b3a94d359d5 Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 03:18:19 -0400 Subject: [PATCH 02/17] reagent transfer --- code/modules/reagents/chemistry/holder.dm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 2f554757a2961..56c84ce77ce48 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -78,15 +78,19 @@ my_atom = null // Used in attack logs for reagents in pills and such -/datum/reagents/proc/log_list() - if(!length(reagent_list)) +/datum/reagents/proc/log_list(external_list) + if((external_list && !length(external_list)) || !length(reagent_list)) return "no reagents" var/list/data = list() - for(var/r in reagent_list) //no reagents will be left behind - var/datum/reagent/R = r - data += "[R.type] ([round(R.volume, 0.1)]u)" - //Using IDs because SOME chemicals (I'm looking at you, chlorhydrate-beer) have the same names as other chemicals. + if(external_list) + for(var/r in external_list) + data += "[r] ([round(external_list[r], 0.1)]u)" + else + for(var/r in reagent_list) //no reagents will be left behind + var/datum/reagent/R = r + data += "[R.type] ([round(R.volume, 0.1)]u)" + //Using types because SOME chemicals (I'm looking at you, chlorhydrate-beer) have the same names as other chemicals. return english_list(data) /datum/reagents/proc/remove_any(amount = 1) @@ -183,10 +187,6 @@ R = target.reagents target_atom = target - if(transfered_by && target_atom) - target_atom.add_hiddenprint(transfered_by) //log prints so admins can figure out who touched it last. - log_combat(transfered_by, target_atom, "transferred reagents ([log_list()]) from [my_atom] to") - amount = min(min(amount, src.total_volume), R.maximum_volume-R.total_volume) var/trans_data = null var/transfer_log = list() From ec1b6984e312f14e54313fed0e34163872e6b792 Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 03:20:05 -0400 Subject: [PATCH 03/17] fix reaction chambers sometimes not working --- code/__DEFINES/reagents.dm | 1 + code/modules/reagents/chemistry/holder.dm | 1 + 2 files changed, 2 insertions(+) diff --git a/code/__DEFINES/reagents.dm b/code/__DEFINES/reagents.dm index 0c5cef33fb353..6212b42153320 100644 --- a/code/__DEFINES/reagents.dm +++ b/code/__DEFINES/reagents.dm @@ -31,6 +31,7 @@ #define ADD_REAGENT 2 // reagent added #define REM_REAGENT 3 // reagent removed (may still exist) #define CLEAR_REAGENTS 4 // all reagents were cleared +#define REACT_REAGENTS 5 // a reaction occurred #define MIMEDRINK_SILENCE_DURATION 30 //ends up being 60 seconds given 1 tick every 2 seconds #define THRESHOLD_UNHUSK 50 //Health treshold for synthflesh and rezadone to unhusk someone diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 56c84ce77ce48..11455a83c9648 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -533,6 +533,7 @@ ME2.name = "used slime extract" ME2.desc = "This extract has been used up." + my_atom?.on_reagent_change(REACT_REAGENTS) selected_reaction.on_reaction(src, multiplier) reaction_occurred = 1 From a1b18ca03ec9b2b7567b9ffe4139a7d382381952 Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 03:22:45 -0400 Subject: [PATCH 04/17] oranges addiction fix --- code/modules/reagents/chemistry/holder.dm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 11455a83c9648..cbe9c51a46721 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -67,6 +67,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 @@ -567,9 +569,10 @@ R.metabolizing = FALSE R.on_mob_end_metabolize(mob_consumer) R.on_mob_delete(mob_consumer) - qdel(R) + //Clear from relevant lists + addiction_list -= R reagent_list -= R - update_total() + qdel(R) if(my_atom) my_atom.on_reagent_change(DEL_REAGENT) return 1 From de8aca4e766a60864a060c8bd465a02327b21997 Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 03:24:22 -0400 Subject: [PATCH 05/17] cleaning skill (without the skill) --- code/modules/reagents/chemistry/holder.dm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index cbe9c51a46721..078351da22d01 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -99,6 +99,7 @@ var/list/cached_reagents = reagent_list var/total_transfered = 0 var/current_list_element = 1 + var/initial_list_length = cached_reagents.len //stored here because removing can cause some reagents to be deleted, ergo length change. current_list_element = rand(1, cached_reagents.len) @@ -112,14 +113,16 @@ current_list_element = 1 var/datum/reagent/R = cached_reagents[current_list_element] - remove_reagent(R.type, 1) + var/remove_amt = min(amount-total_transfered,round(amount/rand(2,initial_list_length),round(amount/10,0.01))) //double round to keep it at a somewhat even spread relative to amount without getting funky numbers. + //min ensures we don't go over amount. + remove_reagent(R.type, remove_amt) current_list_element++ - total_transfered++ + total_transfered += remove_amt update_total() handle_reactions() - return total_transfered + return total_transfered //this should be amount unless the loop is prematurely broken, in which case it'll be lower. It shouldn't ever go OVER amount. /datum/reagents/proc/remove_all(amount = 1) var/list/cached_reagents = reagent_list From 120fc9617103820a29a5d85a8804a2c00f295c20 Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 03:37:12 -0400 Subject: [PATCH 06/17] chem holdover --- code/game/machinery/iv_drip.dm | 4 +--- code/modules/reagents/chemistry/holder.dm | 25 +++++++++++++++++++++ code/modules/reagents/chemistry/reagents.dm | 25 +-------------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index db82e63c621f9..d97a421c71fda 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -147,9 +147,7 @@ if(istype(beaker, /obj/item/reagent_containers/blood)) // speed up transfer on blood packs transfer_amount *= 2 - var/fraction = min(transfer_amount*delta_time/beaker.reagents.total_volume, 1) //the fraction that is transfered of the total volume - beaker.reagents.reaction(attached, INJECT, fraction, FALSE) //make reagents reacts, but don't spam messages - beaker.reagents.trans_to(attached, transfer_amount) + beaker.reagents.trans_to(attached, transfer_amount, method = INJECT, show_message = FALSE) //make reagents reacts, but don't spam messages update_icon() // Take blood diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 078351da22d01..be8039e43305a 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -648,6 +648,31 @@ if("OBJ") R.reaction_obj(A, R.volume * volume_modifier, show_message) +/datum/reagents/proc/react_single(datum/reagent/R, atom/A, method = TOUCH, volume_modifier = 1, show_message = TRUE) + var/react_type + if(isliving(A)) + react_type = "LIVING" + if(method == INGEST) + var/mob/living/L = A + L.taste(src) + else if(isturf(A)) + react_type = "TURF" + else if(isobj(A)) + react_type = "OBJ" + else + return + switch(react_type) + if("LIVING") + var/touch_protection = 0 + if(method == VAPOR) + var/mob/living/L = A + touch_protection = L.get_permeability_protection() + R.reaction_mob(A, method, R.volume * volume_modifier, show_message, touch_protection) + if("TURF") + R.reaction_turf(A, R.volume * volume_modifier, show_message) + if("OBJ") + R.reaction_obj(A, R.volume * volume_modifier, show_message) + /datum/reagents/proc/holder_full() if(total_volume >= maximum_volume) return TRUE diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 0ea618e104151..902094dd8e88d 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -72,30 +72,7 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) /datum/reagent/proc/on_transfer(atom/A, method=TOUCH, trans_volume) //Called after a reagent is transfered return -/datum/reagents/proc/react_single(datum/reagent/R, atom/A, method = TOUCH, volume_modifier = 1, show_message = TRUE) - var/react_type - if(isliving(A)) - react_type = "LIVING" - if(method == INGEST) - var/mob/living/L = A - L.taste(src) - else if(isturf(A)) - react_type = "TURF" - else if(isobj(A)) - react_type = "OBJ" - else - return - switch(react_type) - if("LIVING") - var/touch_protection = 0 - if(method == VAPOR) - var/mob/living/L = A - touch_protection = L.get_permeability_protection() - R.reaction_mob(A, method, R.volume * volume_modifier, show_message, touch_protection) - if("TURF") - R.reaction_turf(A, R.volume * volume_modifier, show_message) - if("OBJ") - R.reaction_obj(A, R.volume * volume_modifier, show_message) + // Called when this reagent is first added to a mob /datum/reagent/proc/on_mob_add(mob/living/L) From 14e3ca28be18f5dce09c64c388de9a22e7098eae Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 03:46:34 -0400 Subject: [PATCH 07/17] autodoc --- code/modules/reagents/chemistry/holder.dm | 143 +++++++++++++++++--- code/modules/reagents/chemistry/reagents.dm | 81 ++++++++--- 2 files changed, 184 insertions(+), 40 deletions(-) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index be8039e43305a..f003ea175f432 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -26,13 +26,14 @@ GLOB.chemical_reactions_list = list() for(var/path in paths) - var/datum/chemical_reaction/D = new path() var/list/reaction_ids = list() - if(D.required_reagents && D.required_reagents.len) - for(var/reaction in D.required_reagents) - reaction_ids += reaction + if(!D.required_reagents || !D.required_reagents.len) //Skip impossible reactions + continue + + for(var/reaction in D.required_reagents) + reaction_ids += reaction // Create filters based on each reagent id in the required reagents list for(var/id in reaction_ids) @@ -43,15 +44,25 @@ /////////////////////////////////////////////////////////////////////////////////// +/// Holder for a bunch of [/datum/reagent] /datum/reagents + /// The reagents being held var/list/datum/reagent/reagent_list = new/list() + /// Current volume of all the reagents var/total_volume = 0 + /// Max volume of this holder var/maximum_volume = 100 + /// The atom this holder is attached to var/atom/my_atom = null + /// Current temp of the holder volume var/chem_temp = 150 + /// unused var/last_tick = 1 + /// see [/datum/reagents/proc/metabolize] for usage var/addiction_tick = 1 + /// currently addicted reagents var/list/datum/reagent/addiction_list = new/list() + /// various flags, see code\__DEFINES\reagents.dm var/flags /datum/reagents/New(maximum=100, new_flags=0) @@ -79,7 +90,12 @@ my_atom.reagents = null my_atom = null -// Used in attack logs for reagents in pills and such +/** + * Used in attack logs for reagents in pills and such + * + * Arguments: + * * external_list - list of reagent types = amounts + */ /datum/reagents/proc/log_list(external_list) if((external_list && !length(external_list)) || !length(reagent_list)) return "no reagents" @@ -95,6 +111,7 @@ //Using types because SOME chemicals (I'm looking at you, chlorhydrate-beer) have the same names as other chemicals. return english_list(data) +/// Remove an amount of reagents without caring about what they are /datum/reagents/proc/remove_any(amount = 1) var/list/cached_reagents = reagent_list var/total_transfered = 0 @@ -124,6 +141,7 @@ handle_reactions() return total_transfered //this should be amount unless the loop is prematurely broken, in which case it'll be lower. It shouldn't ever go OVER amount. +/// Removes all reagents from this holder /datum/reagents/proc/remove_all(amount = 1) var/list/cached_reagents = reagent_list if(total_volume > 0) @@ -136,6 +154,7 @@ handle_reactions() return amount +/// Get the name of the reagent there is the most of in this holder /datum/reagents/proc/get_master_reagent_name() var/list/cached_reagents = reagent_list var/name @@ -148,6 +167,7 @@ return name +/// Get the id of the reagent there is the most of in this holder /datum/reagents/proc/get_master_reagent_id() var/list/cached_reagents = reagent_list var/max_type @@ -160,6 +180,7 @@ return max_type +/// Get a reference to the reagent there is the most of in this holder /datum/reagents/proc/get_master_reagent() var/list/cached_reagents = reagent_list var/datum/reagent/master @@ -172,9 +193,22 @@ return master +/** + * Transfer some stuff from this holder to a target object + * + * Arguments: + * * obj/target - Target to attempt transfer to + * * amount - amount of reagent volume to transfer + * * multiplier - multiplies amount of each reagent by this number + * * preserve_data - if preserve_data=0, the reagents data will be lost. Usefull if you use data for some strange stuff and don't want it to be transferred. + * * no_react - passed through to [/datum/reagents/proc/add_reagent] + * * mob/transfered_by - used for logging + * * remove_blacklisted - skips transferring of reagents with can_synth = FALSE + * * method - passed through to [/datum/reagents/proc/react_single] and [/datum/reagent/proc/on_transfer] + * * show_message - passed through to [/datum/reagents/proc/react_single] + * * round_robin - if round_robin=TRUE, so transfer 5 from 15 water, 15 sugar and 15 plasma becomes 10, 15, 15 instead of 13.3333, 13.3333 13.3333. Good if you hate floating point errors + */ /datum/reagents/proc/trans_to(obj/target, amount = 1, multiplier = 1, preserve_data = TRUE, no_react = FALSE, mob/transfered_by, remove_blacklisted = FALSE, method = null, show_message = TRUE, round_robin = FALSE) - //if preserve_data=0, the reagents data will be lost. Usefull if you use data for some strange stuff and don't want it to be transferred. - //if round_robin=TRUE, so transfer 5 from 15 water, 15 sugar and 15 plasma becomes 10, 15, 15 instead of 13.3333, 13.3333 13.3333. Good if you hate floating point errors var/list/cached_reagents = reagent_list if(!target || !total_volume) return @@ -244,6 +278,7 @@ src.handle_reactions() return amount +/// Copies the reagents to the target object /datum/reagents/proc/copy_to(obj/target, amount=1, multiplier=1, preserve_data=1) var/list/cached_reagents = reagent_list if(!target || !total_volume) @@ -275,7 +310,7 @@ src.handle_reactions() return amount -///Multiplies the reagents inside this holder by a specific amount +/// Multiplies the reagents inside this holder by a specific amount /datum/reagents/proc/multiply_reagents(multiplier=1) var/list/cached_reagents = reagent_list if(!total_volume) @@ -291,6 +326,7 @@ update_total() handle_reactions() +/// Transfer a specific reagent id to the target object /datum/reagents/proc/trans_id_to(obj/target, reagent, amount=1, preserve_data=1)//Not sure why this proc didn't exist before. It does now! /N var/list/cached_reagents = reagent_list if (!target) @@ -319,6 +355,14 @@ R.handle_reactions() return amount +/** + * Triggers metabolizing the reagents in this holder + * + * Arguments: + * * mob/living/carbon/C - The mob to metabolize in, if null it uses [/datum/reagents/var/my_atom] + * * can_overdose - Allows overdosing + * * liverless - Stops reagents that aren't set as [/datum/reagent/var/self_consuming] from metabolizing + */ /datum/reagents/proc/metabolize(mob/living/carbon/C, can_overdose = FALSE, liverless = FALSE) if(C?.dna?.species && (NOREAGENTS in C.dna.species.species_traits)) return 0 @@ -388,13 +432,14 @@ C.update_stamina() update_total() +/// Removes addiction to a specific reagent on [/datum/reagents/var/my_atom] /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 +/// 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 for(var/reagent in cached_reagents) @@ -409,6 +454,13 @@ R.metabolizing = FALSE R.on_mob_end_metabolize(C) +/** + * Calls [/datum/reagent/proc/on_move] on every reagent in this holder + * + * Arguments: + * * atom/A - passed to on_move + * * Running - passed to on_move + */ /datum/reagents/proc/conditional_update_move(atom/A, Running = 0) var/list/cached_reagents = reagent_list for(var/reagent in cached_reagents) @@ -416,6 +468,12 @@ R.on_move (A, Running) update_total() +/** + * Calls [/datum/reagent/proc/on_update] on every reagent in this holder + * + * Arguments: + * * atom/A - passed to on_update + */ /datum/reagents/proc/conditional_update(atom/A) var/list/cached_reagents = reagent_list for(var/reagent in cached_reagents) @@ -423,6 +481,7 @@ R.on_update (A) update_total() +/// Handle any reactions possible in this holder /datum/reagents/proc/handle_reactions() if(flags & NO_REACT) return //Yup, no reactions here. No siree. @@ -546,6 +605,7 @@ update_total() return 0 +/// Remove every reagent except this one /datum/reagents/proc/isolate_reagent(reagent) var/list/cached_reagents = reagent_list for(var/_reagent in cached_reagents) @@ -554,6 +614,7 @@ del_reagent(R.type) update_total() +/// Fuck this one reagent /datum/reagents/proc/del_reagent(reagent) var/list/cached_reagents = reagent_list for(var/_reagent in cached_reagents) @@ -580,6 +641,7 @@ my_atom.on_reagent_change(DEL_REAGENT) return 1 +/// Updates [/datum/reagents/var/total_volume] /datum/reagents/proc/update_total() var/list/cached_reagents = reagent_list total_volume = 0 @@ -592,6 +654,7 @@ return 0 +/// Removes all reagents /datum/reagents/proc/clear_reagents() var/list/cached_reagents = reagent_list for(var/reagent in cached_reagents) @@ -601,6 +664,7 @@ my_atom.on_reagent_change(CLEAR_REAGENTS) return 0 +//Checks if the reaction is valid for IPC /datum/reagents/proc/reaction_check(mob/living/M, datum/reagent/R) var/can_process = FALSE if(ishuman(M)) @@ -617,6 +681,12 @@ can_process = TRUE return can_process +/** + * Applies the relevant reaction_ proc for every reagent in this holder + * * [/datum/reagent/proc/reaction_mob] + * * [/datum/reagent/proc/reaction_turf] + * * [/datum/reagent/proc/reaction_obj] + */ /datum/reagents/proc/reaction(atom/A, method = TOUCH, volume_modifier = 1, show_message = 1, obj/item/bodypart/affecting) var/react_type if(isliving(A)) @@ -648,6 +718,7 @@ if("OBJ") R.reaction_obj(A, R.volume * volume_modifier, show_message) +/// Same as [/datum/reagents/proc/reaction] but only for one reagent /datum/reagents/proc/react_single(datum/reagent/R, atom/A, method = TOUCH, volume_modifier = 1, show_message = TRUE) var/react_type if(isliving(A)) @@ -673,12 +744,14 @@ if("OBJ") R.reaction_obj(A, R.volume * volume_modifier, show_message) + +/// Is this holder full or not /datum/reagents/proc/holder_full() if(total_volume >= maximum_volume) return TRUE return FALSE -//Returns the average specific heat for all reagents currently in this holder. +/// Returns the average specific heat for all reagents currently in this holder. /datum/reagents/proc/specific_heat() . = 0 var/cached_amount = total_volume //cache amount @@ -691,6 +764,17 @@ var/S = specific_heat() chem_temp = clamp(chem_temp + (J / (S * total_volume)), 2.7, 1000) + +/** + * Adds a reagent to this holder + * + * Arguments: + * * reagent - The reagent id to add + * * amount - Amount to add + * * list/data - Any reagent data for this reagent, used for transferring data with reagents + * * reagtemp - Temperature of this reagent, will be equalized + * * no_react - prevents reactions being triggered by this addition + */ /datum/reagents/proc/add_reagent(reagent, amount, list/data=null, reagtemp = 300, no_react = 0) if(!isnum_safe(amount) || !amount) return FALSE @@ -757,11 +841,13 @@ handle_reactions() return TRUE -/datum/reagents/proc/add_reagent_list(list/list_reagents, list/data=null) // Like add_reagent but you can enter a list. Format it like this: list(/datum/reagent/toxin = 10, "beer" = 15) +/// Like add_reagent but you can enter a list. Format it like this: list(/datum/reagent/toxin = 10, "beer" = 15) +/datum/reagents/proc/add_reagent_list(list/list_reagents, list/data=null) for(var/r_id in list_reagents) var/amt = list_reagents[r_id] add_reagent(r_id, amt, data) +/// Remove a specific reagent /datum/reagents/proc/remove_reagent(reagent, amount, safety)//Added a safety check for the trans_id_to if(isnull(amount)) @@ -792,6 +878,7 @@ return FALSE +/// Check if this holder contains this reagent /datum/reagents/proc/has_reagent(reagent, amount = -1, needs_metabolizing = FALSE) var/list/cached_reagents = reagent_list for(var/_reagent in cached_reagents) @@ -811,6 +898,7 @@ return +/// Get the amount of this reagen /datum/reagents/proc/get_reagent_amount(reagent) var/list/cached_reagents = reagent_list for(var/_reagent in cached_reagents) @@ -820,6 +908,7 @@ return 0 +/// Get a comma separated string of every reagent name in this holder /datum/reagents/proc/get_reagents() var/list/names = list() var/list/cached_reagents = reagent_list @@ -829,7 +918,8 @@ return jointext(names, ",") -/datum/reagents/proc/remove_all_type(reagent_type, amount, strict = 0, safety = 1) // Removes all reagent of X type. @strict set to 1 determines whether the childs of the type are included. +/// Removes all reagent of X type. @strict set to 1 determines whether the childs of the type are included. +/datum/reagents/proc/remove_all_type(reagent_type, amount, strict = 0, safety = 1) if(!isnum_safe(amount)) return 1 var/list/cached_reagents = reagent_list @@ -852,7 +942,7 @@ return has_removed_reagent -//two helper functions to preserve data across reactions (needed for xenoarch) +/// helper function to preserve data across reactions (needed for xenoarch) /datum/reagents/proc/get_data(reagent_id) var/list/cached_reagents = reagent_list for(var/reagent in cached_reagents) @@ -860,6 +950,7 @@ if(R.type == reagent_id) return R.data +/// helper function to preserve data across reactions (needed for xenoarch) /datum/reagents/proc/set_data(reagent_id, new_data) var/list/cached_reagents = reagent_list for(var/reagent in cached_reagents) @@ -867,6 +958,7 @@ if(R.type == reagent_id) R.data = new_data +/// Shallow copies (deep copy of viruses) data from the provided reagent into our copy of that reagent /datum/reagents/proc/copy_data(datum/reagent/current_reagent) if(!current_reagent || !current_reagent.data) return null @@ -888,12 +980,19 @@ return trans_data +/// Get a reference to the reagent if it exists /datum/reagents/proc/get_reagent(type) var/list/cached_reagents = reagent_list . = locate(type) in cached_reagents + +/** + * Returns what this holder's reagents taste like + * + * Arguments: + * * minimum_percent - the lower the minimum percent, the more sensitive the message is. + */ /datum/reagents/proc/generate_taste_message(minimum_percent=15) - // the lower the minimum percent, the more sensitive the message is. var/list/out = list() var/list/tastes = list() //descriptor = strength if(minimum_percent <= 100) @@ -937,6 +1036,7 @@ return english_list(out, "something indescribable") +/// Applies heat to this holder /datum/reagents/proc/expose_temperature(var/temperature, var/coeff=0.02) var/temp_delta = (temperature - chem_temp) * coeff if(temp_delta > 0) @@ -949,16 +1049,20 @@ /////////////////////////////////////////////////////////////////////////////////// -// Convenience proc to create a reagents holder for an atom -// Max vol is maximum volume of holder +/** + * Convenience proc to create a reagents holder for an atom + * + * Arguments: + * * max_vol - maximum volume of holder + * * flags - flags to pass to the holder + */ /atom/proc/create_reagents(max_vol, flags) if(reagents) qdel(reagents) reagents = new /datum/reagents(max_vol, flags) reagents.my_atom = src -/proc/get_random_reagent_id(var/flag_check, var/blacklist_flag = NONE, var/union = TRUE, var/return_as_list = FALSE) - /* This proc returns a random reagent ID based on given 'flag_check' which is used to check bitflag for each reagent. +/* This proc returns a random reagent ID based on given 'flag_check' which is used to check bitflag for each reagent. *--- arguments ---* * flag_check the method will return a random reagent id which has this flag. @@ -983,7 +1087,8 @@ i.e.) `var/static/list/random_reagents_xx = list() // CHEMICAL_SOMETHING_NEW` 3. add the new static variable to the 'random_reagent' list then done! (of course, don't forget to turn on the new flag at each desired reagent) - */ +*/ +/proc/get_random_reagent_id(var/flag_check, var/blacklist_flag = NONE, var/union = TRUE, var/return_as_list = FALSE) // ----below is a section you might want to edit for more chem RNGs---- diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 902094dd8e88d..3687b12cb6b56 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -12,39 +12,66 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) //Toxin & acid reagents //Hydroponics stuff +/// A single reagent /datum/reagent + /// datums don't have names by default var/name = "Reagent" + /// nor do they have descriptions var/description = "" - var/specific_heat = SPECIFIC_HEAT_DEFAULT //J/(K*mol) + ///J/(K*mol) + var/specific_heat = SPECIFIC_HEAT_DEFAULT + /// used by taste messages var/taste_description = "metaphorical salt" - var/taste_mult = 1 //how this taste compares to others. Higher values means it is more noticeable - var/glass_name = "glass of ...what?" // use for specialty drinks. + ///how this taste compares to others. Higher values means it is more noticable + var/taste_mult = 1 + /// use for specialty drinks. + var/glass_name = "glass of ...what?" + /// desc applied to glasses with this reagent var/glass_desc = "You can't really tell what this is." - var/glass_icon_state = null // Otherwise just sets the icon to a normal glass with the mixture of the reagents in the glass. + /// Otherwise just sets the icon to a normal glass with the mixture of the reagents in the glass. + var/glass_icon_state = null + /// used for shot glasses, mostly for alcohol var/shot_glass_icon_state = null + /// reagent holder this belongs to var/datum/reagents/holder = null + /// LIQUID, SOLID, GAS var/reagent_state = LIQUID + /// special data associated with this like viruses etc var/list/data + /// increments everytime on_mob_life is called var/current_cycle = 0 - var/volume = 0 //pretend this is moles + ///pretend this is moles + var/volume = 0 + /// color it looks in containers etc var/color = "#000000" // rgb: 0, 0, 0 - var/chem_flags = CHEMICAL_NOT_DEFINED // default = I am not sure this shit + CHEMICAL_NOT_SYNTH - var/metabolization_rate = REAGENTS_METABOLISM //how fast the reagent is metabolized by the mob - var/metabolite //Will be added as the reagent is processed - var/overrides_metab = 0 + // default = I am not sure this shit + CHEMICAL_NOT_SYNTH + var/chem_flags = CHEMICAL_NOT_DEFINED + ///how fast the reagent is metabolized by the mob + var/metabolization_rate = REAGENTS_METABOLISM + //Will be added as the reagent is processed + var/metabolite + /// above this overdoses happen var/overdose_threshold = 0 + /// above this amount addictions start var/addiction_threshold = 0 + /// increases as addiction gets worse var/addiction_stage = 0 - var/process_flags = ORGANIC // What can process this? ORGANIC, SYNTHETIC, or ORGANIC | SYNTHETIC?. We'll assume by default that it affects organics. - var/overdosed = 0 // You fucked up and this is now triggering its overdose effects, purge that shit quick. + // What can process this? ORGANIC, SYNTHETIC, or ORGANIC | SYNTHETIC?. We'll assume by default that it affects organics. + var/process_flags = ORGANIC + /// You fucked up and this is now triggering its overdose effects, purge that shit quick. + var/overdosed = 0 + ///if false stops metab in liverless mobs var/self_consuming = FALSE - var/reagent_weight = 1 //affects how far it travels when sprayed + ///affects how far it travels when sprayed + var/reagent_weight = 1 + ///is it currently metabolizing var/metabolizing = FALSE /datum/reagent/Destroy() // This should only be called by the holder, so it's already handled clearing its references . = ..() holder = null +/// Applies this reagent to a [/mob/living] /datum/reagent/proc/reaction_mob(mob/living/M, method = TOUCH, reac_volume, show_message = 1, touch_protection = 0, obj/item/bodypart/affecting) if(!istype(M)) return FALSE @@ -56,12 +83,16 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) M.reagents.add_reagent(type, amount) return TRUE +/// Applies this reagent to an [/obj] /datum/reagent/proc/reaction_obj(obj/O, volume) return + +/// Applies this reagent to a [/turf] /datum/reagent/proc/reaction_turf(turf/T, volume) return +/// Called from [/datum/reagents/proc/metabolize] /datum/reagent/proc/on_mob_life(mob/living/carbon/M) current_cycle++ holder.remove_reagent(type, metabolization_rate * M.metabolism_efficiency) //By default it slowly disappears. @@ -69,77 +100,85 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) holder.add_reagent(metabolite, metabolization_rate * M.metabolism_efficiency * METABOLITE_RATE) return -/datum/reagent/proc/on_transfer(atom/A, method=TOUCH, trans_volume) //Called after a reagent is transfered +///Called after a reagent is transfered +/datum/reagent/proc/on_transfer(atom/A, method=TOUCH, trans_volume) return -// Called when this reagent is first added to a mob +/// Called when this reagent is first added to a mob /datum/reagent/proc/on_mob_add(mob/living/L) return -// Called when this reagent is removed while inside a mob +/// Called when this reagent is removed while inside a mob /datum/reagent/proc/on_mob_delete(mob/living/L) return -// Called when this reagent first starts being metabolized by a liver +/// Called when this reagent first starts being metabolized by a liver /datum/reagent/proc/on_mob_metabolize(mob/living/L) return -// Called when this reagent stops being metabolized by a liver +/// Called when this reagent stops being metabolized by a liver /datum/reagent/proc/on_mob_end_metabolize(mob/living/L) return +/// Called by [/datum/reagents/proc/conditional_update_move] /datum/reagent/proc/on_move(mob/M) return -// Called after add_reagents creates a new reagent. +/// Called after add_reagents creates a new reagent. /datum/reagent/proc/on_new(data) if(data) src.data = data -// Called when two reagents of the same are mixing. +/// Called when two reagents of the same are mixing. /datum/reagent/proc/on_merge(data) return +/// Called by [/datum/reagents/proc/conditional_update] /datum/reagent/proc/on_update(atom/A) return -// Called if the reagent has passed the overdose threshold and is set to be triggering overdose effects +/// Called if the reagent has passed the overdose threshold and is set to be triggering overdose effects /datum/reagent/proc/overdose_process(mob/living/M) return +/// Called when an overdose starts /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 +/// Called when addiction hits stage1, see [/datum/reagents/proc/metabolize] /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 +/// Called when addiction hits stage2, see [/datum/reagents/proc/metabolize] /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 +/// Called when addiction hits stage3, see [/datum/reagents/proc/metabolize] /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 +/// Called when addiction hits stage4, see [/datum/reagents/proc/metabolize] /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 +///Convert reagent list to a printable string for logging etc /proc/pretty_string_from_reagent_list(list/reagent_list) - //Convert reagent list to a printable string for logging etc var/list/rs = list() for (var/datum/reagent/R in reagent_list) rs += "[R.name], [R.volume]" From af9184edd6e5c7ea1ade53be64d337ad3d55eea4 Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 03:48:01 -0400 Subject: [PATCH 08/17] Revert "fix reaction chambers sometimes not working" This reverts commit ec1b6984e312f14e54313fed0e34163872e6b792. --- code/__DEFINES/reagents.dm | 1 - code/modules/reagents/chemistry/holder.dm | 1 - 2 files changed, 2 deletions(-) diff --git a/code/__DEFINES/reagents.dm b/code/__DEFINES/reagents.dm index 6212b42153320..0c5cef33fb353 100644 --- a/code/__DEFINES/reagents.dm +++ b/code/__DEFINES/reagents.dm @@ -31,7 +31,6 @@ #define ADD_REAGENT 2 // reagent added #define REM_REAGENT 3 // reagent removed (may still exist) #define CLEAR_REAGENTS 4 // all reagents were cleared -#define REACT_REAGENTS 5 // a reaction occurred #define MIMEDRINK_SILENCE_DURATION 30 //ends up being 60 seconds given 1 tick every 2 seconds #define THRESHOLD_UNHUSK 50 //Health treshold for synthflesh and rezadone to unhusk someone diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index f003ea175f432..ebf9b3b901dee 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -597,7 +597,6 @@ ME2.name = "used slime extract" ME2.desc = "This extract has been used up." - my_atom?.on_reagent_change(REACT_REAGENTS) selected_reaction.on_reaction(src, multiplier) reaction_occurred = 1 From 50f02bd483bd425e9cd3bdf11a2a0b9480542e26 Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 03:49:08 -0400 Subject: [PATCH 09/17] gettem --- code/modules/reagents/chemistry/holder.dm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index ebf9b3b901dee..f897a9f1b715f 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -877,7 +877,12 @@ return FALSE -/// Check if this holder contains this reagent +/* +Check if this holder contains this reagent. +Reagent takes a PATH to a reagent. +Amount checks for having a specific amount of that chemical. +Needs metabolizing takes into consideration if the chemical is metabolizing when it's checked. +*/ /datum/reagents/proc/has_reagent(reagent, amount = -1, needs_metabolizing = FALSE) var/list/cached_reagents = reagent_list for(var/_reagent in cached_reagents) From 349a9ff9d2eaeecc53bea100d959f076d0dc23aa Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 04:15:42 -0400 Subject: [PATCH 10/17] exposure code --- .../dcs/signals/signals_atom/signals_atom.dm | 5 + code/datums/components/crafting/crafting.dm | 2 +- code/datums/status_effects/debuffs.dm | 6 +- code/game/atoms.dm | 21 ++++ code/game/machinery/cloning.dm | 2 +- code/game/objects/effects/decals/misc.dm | 4 +- .../effects/effect_system/effects_foam.dm | 6 +- .../effects/effect_system/effects_smoke.dm | 6 +- .../effects/effect_system/effects_water.dm | 6 +- code/game/objects/items/airlock_painter.dm | 4 +- code/game/objects/items/cigs_lighters.dm | 4 +- code/game/objects/items/crayons.dm | 10 +- code/game/objects/items/food/egg.dm | 2 +- code/game/objects/items/food/pie.dm | 2 +- code/game/objects/items/kitchen.dm | 2 +- code/game/objects/items/mop.dm | 2 +- code/game/objects/items/stacks/medical.dm | 2 +- code/game/objects/items/tanks/watertank.dm | 2 +- code/game/objects/items/toys.dm | 4 +- code/game/objects/objs.dm | 10 ++ code/game/objects/structures/janicart.dm | 2 +- code/game/objects/structures/shower.dm | 2 +- code/game/objects/structures/watercloset.dm | 2 +- code/game/turfs/turf_integrity.dm | 10 ++ .../antagonists/blob/blobstrains/_reagent.dm | 6 +- .../blob/blobstrains/blazing_oil.dm | 2 +- .../blob/blobstrains/cryogenic_poison.dm | 2 +- .../blob/blobstrains/electromagnetic_web.dm | 2 +- .../blob/blobstrains/energized_jelly.dm | 2 +- .../blob/blobstrains/explosive_lattice.dm | 2 +- .../blob/blobstrains/networked_fibers.dm | 2 +- .../blob/blobstrains/pressurized_slime.dm | 2 +- .../blob/blobstrains/reactive_spines.dm | 2 +- .../blob/blobstrains/regenerative_materia.dm | 2 +- .../blob/blobstrains/replicating_foam.dm | 2 +- .../blob/blobstrains/shifting_fragments.dm | 2 +- .../blob/blobstrains/synchronous_mesh.dm | 2 +- .../blob/blobstrains/zombifying_pods.dm | 2 +- .../detectivework/footprints_and_rag.dm | 4 +- code/modules/food_and_drinks/drinks/drinks.dm | 2 +- .../drinks/drinks/drinkingglass.dm | 4 +- .../modules/food_and_drinks/food/condiment.dm | 2 +- .../kitchen_machinery/deep_fryer.dm | 2 +- code/modules/hydroponics/grown.dm | 4 +- code/modules/hydroponics/plant_genes.dm | 2 +- .../mining/lavaland/necropolis_chests.dm | 2 +- code/modules/mob/living/living_defense.dm | 18 +++ .../mob/living/simple_animal/bot/medbot.dm | 2 +- .../mob/living/simple_animal/hostile/bees.dm | 4 +- .../mob/living/simple_animal/slime/life.dm | 2 +- .../plumbing/plumbers/_plumb_machinery.dm | 2 +- code/modules/pool/pool.dm | 4 +- .../projectile/bullets/dart_syringe.dm | 2 +- .../projectiles/projectile/energy/ebow.dm | 2 +- code/modules/reagents/chem_splash.dm | 2 +- code/modules/reagents/chemistry/holder.dm | 91 +++++--------- .../chemistry/machinery/smoke_machine.dm | 4 +- code/modules/reagents/chemistry/readme.md | 8 +- code/modules/reagents/chemistry/reagents.dm | 10 +- .../chemistry/reagents/alcohol_reagents.dm | 4 +- .../chemistry/reagents/drink_reagents.dm | 2 +- .../chemistry/reagents/food_reagents.dm | 26 ++-- .../chemistry/reagents/medicine_reagents.dm | 14 +-- .../chemistry/reagents/other_reagents.dm | 111 ++++++++---------- .../reagents/pyrotechnic_reagents.dm | 18 +-- .../chemistry/reagents/toxin_reagents.dm | 18 +-- code/modules/reagents/reagent_containers.dm | 4 +- .../reagents/reagent_containers/borghydro.dm | 2 +- .../reagents/reagent_containers/dropper.dm | 4 +- .../reagents/reagent_containers/glass.dm | 8 +- .../reagents/reagent_containers/hypospray.dm | 4 +- .../reagents/reagent_containers/medspray.dm | 2 +- .../reagents/reagent_containers/pill.dm | 2 +- .../reagents/reagent_containers/spray.dm | 2 +- .../reagents/reagent_containers/syringes.dm | 2 +- .../crossbreeding/_status_effects.dm | 2 +- code/modules/surgery/dental_implant.dm | 2 +- 77 files changed, 289 insertions(+), 261 deletions(-) diff --git a/code/__DEFINES/dcs/signals/signals_atom/signals_atom.dm b/code/__DEFINES/dcs/signals/signals_atom/signals_atom.dm index 21a56d0f7dc56..8872040d0a291 100644 --- a/code/__DEFINES/dcs/signals/signals_atom/signals_atom.dm +++ b/code/__DEFINES/dcs/signals/signals_atom/signals_atom.dm @@ -123,6 +123,11 @@ /// called when an atom stops orbiting another atom: (atom) #define COMSIG_ATOM_ORBIT_STOP "atom_orbit_stop" +///from base of atom/expose_reagents(): +#define COMSIG_ATOM_EXPOSE_REAGENTS "atom_expose_reagents" + /// Prevents the atom from being exposed to reagents if returned on [COMPONENT_ATOM_EXPOSE_REAGENTS] + #define COMPONENT_NO_EXPOSE_REAGENTS (1<<0) + ///This signal return value bitflags can be found in __DEFINES/misc.dm ///called for each movable in a turf contents on /turf/attempt_z_impact(): (atom/movable/A, levels) #define COMSIG_ATOM_INTERCEPT_Z_FALL "movable_intercept_z_impact" diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index b401e93ffd7e5..55ba1bae927fb 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -347,7 +347,7 @@ // If we consumed them in our crafting, we should dump their contents out before qdeling them. if(istype(DL, /obj/item/reagent_containers)) var/obj/item/reagent_containers/container = DL - container.reagents.reaction(container.loc, TOUCH) + container.reagents.expose(container.loc, TOUCH) else if(istype(DL, /obj/item/storage)) var/obj/item/storage/container = DL container.emptyStorage() diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index 75f70585a4c3d..069d910940008 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -260,14 +260,14 @@ /datum/status_effect/syringe/on_apply() . = ..() var/amount = syringe.initial_inject - syringe.reagents.reaction(owner, INJECT) + syringe.reagents.expose(owner, INJECT) syringe.reagents.trans_to(owner, max(3.1, amount * injectmult)) owner.throw_alert("syringealert", /atom/movable/screen/alert/syringe) /datum/status_effect/syringe/tick() . = ..() var/amount = syringe.units_per_tick - syringe.reagents.reaction(owner, INJECT, amount / 10)//so the slow drip-feed of reagents isn't exploited + syringe.reagents.expose(owner, INJECT, amount / 10)//so the slow drip-feed of reagents isn't exploited syringe.reagents.trans_to(owner, amount * injectmult) @@ -302,7 +302,7 @@ else to_chat(C, "You screw up, and inject yourself with more chemicals by mistake!") var/amount = syringe.initial_inject - syringe.reagents.reaction(C, INJECT) + syringe.reagents.expose(C, INJECT) syringe.reagents.trans_to(C, amount) syringe.forceMove(C.loc) qdel(syringestatus) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index c8ae188439383..1f5152e3abe5c 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -527,6 +527,27 @@ CREATION_TEST_IGNORE_SUBTYPES(/atom) /atom/proc/is_drainable() return reagents && (reagents.flags & DRAINABLE) +/** Handles exposing this atom to a list of reagents. + * + * Sends COMSIG_ATOM_EXPOSE_REAGENTS + * Calls expose_atom() for every reagent in the reagent list. + * + * Arguments: + * - [reagents][/list]: The list of reagents the atom is being exposed to. + * - [source][/datum/reagents]: The reagent holder the reagents are being sourced from. + * - method: How the atom is being exposed to the reagents. + * - volume_modifier: Volume multiplier. + * - show_message: Whether to display anything to mobs when they are exposed. + */ +/atom/proc/expose_reagents(list/reagents, datum/reagents/source, method=TOUCH, volume_modifier=1, show_message=TRUE) + . = SEND_SIGNAL(src, COMSIG_ATOM_EXPOSE_REAGENTS, reagents, source, method, volume_modifier, show_message) + if(. & COMPONENT_NO_EXPOSE_REAGENTS) + return + + for(var/reagent in reagents) + var/datum/reagent/R = reagent + . |= R.expose_atom(src, reagents[R] || (R.volume * volume_modifier)) + /// Is this atom grindable to get reagents /atom/proc/is_grindable() return reagents && (reagents.flags & ABSOLUTELY_GRINDABLE) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 2207b417ba41d..26a8b7f4375d9 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -102,7 +102,7 @@ if (alert(user, "Are you sure you want to empty the cloning pod?", "Empty Reagent Storage:", "Yes", "No") != "Yes") return to_chat(user, "You empty \the [src]'s release valve onto the floor.") - reagents.reaction(user.loc) + reagents.expose(user.loc) src.reagents.clear_reagents() /obj/machinery/clonepod/attack_ai(mob/user) diff --git a/code/game/objects/effects/decals/misc.dm b/code/game/objects/effects/decals/misc.dm index dc132da8e1b06..433cc25ba1951 100644 --- a/code/game/objects/effects/decals/misc.dm +++ b/code/game/objects/effects/decals/misc.dm @@ -61,12 +61,12 @@ lifetime-- else if(travelled_max_distance) lifetime-- - reagents?.reaction(turf_atom, VAPOR) + reagents?.expose(turf_atom, VAPOR) if(user) log_combat(user, turf_atom, "sprayed", sprayer, addition="which had [puff_reagents_string]") if(lifetime >= 0 && (!stream || travelled_max_distance)) - reagents?.reaction(our_turf, VAPOR) + reagents?.expose(our_turf, VAPOR) lifetime-- if(user) log_combat(user, our_turf, "sprayed", sprayer, addition="which had [puff_reagents_string]") diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm index 5ea702d1d52d5..805319dd62f17 100644 --- a/code/game/objects/effects/effect_system/effects_foam.dm +++ b/code/game/objects/effects/effect_system/effects_foam.dm @@ -164,7 +164,7 @@ if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE && HAS_TRAIT(O, TRAIT_T_RAY_VISIBLE)) continue if(lifetime % reagent_divisor) - reagents.reaction(O, VAPOR, fraction) + reagents.expose(O, VAPOR, fraction) var/hit = 0 for(var/mob/living/L in get_turf(src)) hit += foam_mob(L) @@ -172,7 +172,7 @@ lifetime++ //this is so the decrease from mobs hit and the natural decrease don't cumulate. var/T = get_turf(src) if(lifetime % reagent_divisor) - reagents.reaction(T, VAPOR, fraction) + reagents.expose(T, VAPOR, fraction) if(--amount < 0) return @@ -185,7 +185,7 @@ return 0 var/fraction = 1/initial(reagent_divisor) if(lifetime % reagent_divisor) - reagents.reaction(L, VAPOR, fraction) + reagents.expose(L, VAPOR, fraction) lifetime-- return 1 diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm index 62922d034df1b..6c7d1f0cb172b 100644 --- a/code/game/objects/effects/effect_system/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/effects_smoke.dm @@ -241,9 +241,9 @@ for(var/atom/movable/AM in T) if(AM.type == src.type) continue - reagents.reaction(AM, TOUCH, fraction) + reagents.expose(AM, TOUCH, fraction) - reagents.reaction(T, TOUCH, fraction) + reagents.expose(T, TOUCH, fraction) return 1 /obj/effect/particle_effect/smoke/chem/smoke_mob(mob/living/carbon/M) @@ -256,7 +256,7 @@ return 0 var/fraction = 1/initial(lifetime) reagents.copy_to(C, fraction*reagents.total_volume) - reagents.reaction(M, INGEST, fraction) + reagents.expose(M, INGEST, fraction) if(isapid(C)) C.SetSleeping(50) // Bees sleep when smoked M.log_message("breathed in some smoke with reagents [english_list(reagents.reagent_list)]", LOG_ATTACK, null, FALSE) // Do not log globally b/c spam diff --git a/code/game/objects/effects/effect_system/effects_water.dm b/code/game/objects/effects/effect_system/effects_water.dm index ad084f5689e54..5aee1a976623d 100644 --- a/code/game/objects/effects/effect_system/effects_water.dm +++ b/code/game/objects/effects/effect_system/effects_water.dm @@ -21,7 +21,7 @@ /obj/effect/particle_effect/water/Bump(atom/A) if(reagents) - reagents.reaction(A) + reagents.expose(A) return ..() ///Extinguisher snowflake @@ -31,9 +31,9 @@ . = ..() if(!reagents) return - reagents.reaction(get_turf(src)) + reagents.expose(get_turf(src)) for(var/atom/thing as anything in get_turf(src)) - reagents.reaction(thing) + reagents.expose(thing) ///////////////////////////////////////////// // GENERIC STEAM SPREAD SYSTEM diff --git a/code/game/objects/items/airlock_painter.dm b/code/game/objects/items/airlock_painter.dm index dcb8cb855d980..f11ef27d0e935 100644 --- a/code/game/objects/items/airlock_painter.dm +++ b/code/game/objects/items/airlock_painter.dm @@ -115,7 +115,7 @@ // make some colorful reagent, and apply it to the lungs L.create_reagents(10) L.reagents.add_reagent(/datum/reagent/colorful_reagent, 10) - L.reagents.reaction(L, TOUCH, 1) + L.reagents.expose(L, TOUCH, 1) // TODO maybe add some colorful vomit? @@ -128,7 +128,7 @@ else if(can_use(user) && !L) user.visible_message("[user] is spraying toner on [user.p_them()]self from [src]! It looks like [user.p_theyre()] trying to commit suicide.") user.reagents.add_reagent(/datum/reagent/colorful_reagent, 1) - user.reagents.reaction(user, TOUCH, 1) + user.reagents.expose(user, TOUCH, 1) return TOXLOSS else diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index b5fde44df77be..2b2f1781bb61c 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -299,7 +299,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM if (smoke_all) to_smoke = reagents.total_volume / (smoketime / dragtime) - reagents.reaction(C, INGEST, fraction) + reagents.expose(C, INGEST, fraction) if(!reagents.trans_to(C, to_smoke)) reagents.remove_any(to_smoke) return @@ -974,7 +974,7 @@ CREATION_TEST_IGNORE_SUBTYPES(/obj/item/clothing/mask/vape) var/mob/living/carbon/C = loc if (src == C.wear_mask) // if it's in the human/monkey mouth, transfer reagents to the mob var/fraction = min(REAGENTS_METABOLISM/reagents.total_volume, 1) //this will react instantly, making them a little more dangerous than cigarettes - reagents.reaction(C, INGEST, fraction) + reagents.expose(C, INGEST, fraction) if(!reagents.trans_to(C, REAGENTS_METABOLISM)) reagents.remove_any(REAGENTS_METABOLISM) if(reagents.get_reagent_amount(/datum/reagent/fuel)) diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index 9b06ed7837563..99f3d9da49cd5 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -411,7 +411,7 @@ if(affected_turfs.len) fraction /= affected_turfs.len for(var/t in affected_turfs) - reagents.reaction(t, TOUCH, fraction * volume_multiplier) + reagents.expose(t, TOUCH, fraction * volume_multiplier) reagents.trans_to(t, ., volume_multiplier, transfered_by = user) check_empty(user) @@ -422,7 +422,7 @@ if(check_empty(user)) //Prevents divsion by zero return var/fraction = min(eaten / reagents.total_volume, 1) - reagents.reaction(M, INGEST, fraction * volume_multiplier) + reagents.expose(M, INGEST, fraction * volume_multiplier) reagents.trans_to(M, eaten, volume_multiplier, transfered_by = user) // check_empty() is called during afterattack else @@ -634,7 +634,7 @@ H.update_body() var/used = use_charges(user, 10, FALSE) var/fraction = min(1, used / reagents.maximum_volume) - reagents.reaction(user, VAPOR, fraction * volume_multiplier) + reagents.expose(user, VAPOR, fraction * volume_multiplier) reagents.trans_to(user, used, volume_multiplier, transfered_by = user) return OXYLOSS @@ -691,7 +691,7 @@ . = use_charges(user, 10, FALSE) var/fraction = min(1, . / reagents.maximum_volume) - reagents.reaction(C, VAPOR, fraction * volume_multiplier) + reagents.expose(C, VAPOR, fraction * volume_multiplier) return @@ -726,7 +726,7 @@ if(!.) return FALSE var/fraction = min(1, . / reagents.maximum_volume) - reagents.reaction(target, TOUCH, fraction * volume_multiplier) + reagents.expose(target, TOUCH, fraction * volume_multiplier) reagents.trans_to(target, ., volume_multiplier, transfered_by = user) if(pre_noise || post_noise) diff --git a/code/game/objects/items/food/egg.dm b/code/game/objects/items/food/egg.dm index f5a1e479812fa..01ce93842a7e1 100644 --- a/code/game/objects/items/food/egg.dm +++ b/code/game/objects/items/food/egg.dm @@ -47,7 +47,7 @@ if(!..()) //was it caught by a mob? var/turf/T = get_turf(hit_atom) new/obj/effect/decal/cleanable/food/egg_smudge(T) - reagents.reaction(hit_atom, TOUCH) + reagents.expose(hit_atom, TOUCH) qdel(src) /obj/item/food/egg/attackby(obj/item/W, mob/user, params) diff --git a/code/game/objects/items/food/pie.dm b/code/game/objects/items/food/pie.dm index e88ce03a34511..da5720e7f3d31 100644 --- a/code/game/objects/items/food/pie.dm +++ b/code/game/objects/items/food/pie.dm @@ -62,7 +62,7 @@ var/turf/hit_turf = get_turf(hit_atom) new/obj/effect/decal/cleanable/food/pie_smudge(hit_turf) if(reagents?.total_volume) - reagents.reaction(hit_atom, TOUCH) + reagents.expose(hit_atom, TOUCH) var/is_creamable = TRUE if(isliving(hit_atom)) var/mob/living/living_target_getting_hit = hit_atom diff --git a/code/game/objects/items/kitchen.dm b/code/game/objects/items/kitchen.dm index 9949cd605d231..88cc00749bdca 100644 --- a/code/game/objects/items/kitchen.dm +++ b/code/game/objects/items/kitchen.dm @@ -68,7 +68,7 @@ if(!M.can_inject(user, 1)) amount_inject = 1 var/amount = min(amount_inject/reagents.total_volume,1) - reagents.reaction(M,INJECT,amount) + reagents.expose(M,INJECT,amount) reagents.trans_to(M,amount_inject) /obj/item/knife/kitchen diff --git a/code/game/objects/items/mop.dm b/code/game/objects/items/mop.dm index aa87ec7cd0bb2..82acb11e2fccb 100644 --- a/code/game/objects/items/mop.dm +++ b/code/game/objects/items/mop.dm @@ -33,7 +33,7 @@ /obj/item/mop/proc/clean(turf/A, mob/living/cleaner) if(reagents.has_reagent(/datum/reagent/water, 1) || reagents.has_reagent(/datum/reagent/water/holywater, 1) || reagents.has_reagent(/datum/reagent/consumable/ethanol/vodka, 1) || reagents.has_reagent(/datum/reagent/space_cleaner, 1)) A.wash(CLEAN_SCRUB) - reagents.reaction(A, TOUCH, 10) //Needed for proper floor wetting. + reagents.expose(A, TOUCH, 10) //Needed for proper floor wetting. reagents.remove_any(1) //reaction() doesn't use up the reagents diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 7813df163a3f0..905b3a784398b 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -154,7 +154,7 @@ CREATION_TEST_IGNORE_SUBTYPES(/obj/item/stack/medical) user.visible_message("[user] applies [src] to [M].", "You apply [src] to [M].") if(reagent) - reagents.reaction(M, PATCH, affecting = affecting) + reagents.expose(M, PATCH, affecting = affecting) M.reagents.add_reagent_list(reagent) //Stack size is reduced by one instead of actually removing reagents from the stack. C.update_damage_overlays() use(1) diff --git a/code/game/objects/items/tanks/watertank.dm b/code/game/objects/items/tanks/watertank.dm index 7c7c944d047eb..90378edd7ac80 100644 --- a/code/game/objects/items/tanks/watertank.dm +++ b/code/game/objects/items/tanks/watertank.dm @@ -716,7 +716,7 @@ return var/used_amount = (injection_amount * delta_time) /usage_ratio - reagents.reaction(user, INJECT,injection_amount,0) + reagents.expose(user, INJECT,injection_amount,0) reagents.trans_to(user,used_amount,multiplier=usage_ratio) update_icon() user.update_inv_back() //for overlays update diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index ee342362a003f..a7e4f78b3e4e2 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -123,9 +123,9 @@ else T = get_turf(src) T.visible_message("[src] bursts!","You hear a pop and a splash.") - reagents.reaction(T) + reagents.expose(T) for(var/atom/A in T) - reagents.reaction(A) + reagents.expose(A) icon_state = "burst" qdel(src) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index f0cee5f78010a..708a0c25dbac5 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -436,6 +436,16 @@ CREATION_TEST_IGNORE_SELF(/obj) if(resistance_flags & ON_FIRE) . += GLOB.fire_overlay +/// Handles exposing an object to reagents. +/obj/expose_reagents(list/reagents, datum/reagents/source, method=TOUCH, volume_modifier=1, show_message=TRUE) + . = ..() + if(. & COMPONENT_NO_EXPOSE_REAGENTS) + return + + for(var/reagent in reagents) + var/datum/reagent/R = reagent + R.expose_obj(src, reagents[R] || (R.volume * volume_modifier)) + ///attempt to freeze this obj if possible. returns TRUE if it succeeded, FALSE otherwise. /obj/proc/freeze() if(HAS_TRAIT(src, TRAIT_FROZEN)) diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 023d83c3ab83a..3d5a7d7d50505 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -109,7 +109,7 @@ if(I.use_tool(src, user, 30)) balloon_alert(user, "Dumped [src]") to_chat(usr, "You dump the contents of [src]'s bucket onto the floor.") - reagents.reaction(src.loc) + reagents.expose(src.loc) src.reagents.clear_reagents() else return ..() diff --git a/code/game/objects/structures/shower.dm b/code/game/objects/structures/shower.dm index 861513b38718e..b6dc19f739e35 100644 --- a/code/game/objects/structures/shower.dm +++ b/code/game/objects/structures/shower.dm @@ -136,7 +136,7 @@ A.wash(CLEAN_RAD | CLEAN_TYPE_WEAK) // Clean radiation non-instantly A.wash(CLEAN_WASH) SEND_SIGNAL(A, COMSIG_ADD_MOOD_EVENT, "shower", /datum/mood_event/nice_shower) - reagents.reaction(A, TOUCH, reaction_volume) + reagents.expose(A, TOUCH, reaction_volume) if(isliving(A)) check_heat(A) diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index ec5c105466509..698e7d3b5359e 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -346,7 +346,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/urinal, 32) O.acid_level = 0 create_reagents(5) reagents.add_reagent(dispensedreagent, 5) - reagents.reaction(O, TOUCH) + reagents.expose(O, TOUCH) user.visible_message("[user] washes [O] using [src].", \ "You wash [O] using [src].") return 1 diff --git a/code/game/turfs/turf_integrity.dm b/code/game/turfs/turf_integrity.dm index 316ea436512ec..699eb9d3bee3b 100644 --- a/code/game/turfs/turf_integrity.dm +++ b/code/game/turfs/turf_integrity.dm @@ -416,6 +416,16 @@ /turf/proc/Melt() return ScrapeAway(flags = CHANGETURF_INHERIT_AIR) +/// Handles exposing a turf to reagents. +/turf/expose_reagents(list/reagents, datum/reagents/source, method=TOUCH, volume_modifier=1, show_message=TRUE) + . = ..() + if(. & COMPONENT_NO_EXPOSE_REAGENTS) + return + + for(var/reagent in reagents) + var/datum/reagent/R = reagent + . |= R.expose_turf(src, reagents[R] || (R.volume * volume_modifier)) + /turf/proc/burn_tile() return diff --git a/code/modules/antagonists/blob/blobstrains/_reagent.dm b/code/modules/antagonists/blob/blobstrains/_reagent.dm index db27a51f40716..01a26770ebfe5 100644 --- a/code/modules/antagonists/blob/blobstrains/_reagent.dm +++ b/code/modules/antagonists/blob/blobstrains/_reagent.dm @@ -8,12 +8,12 @@ /datum/blobstrain/reagent/attack_living(var/mob/living/L) var/mob_protection = L.get_permeability_protection() - reagent.reaction_mob(L, VAPOR, 25, 1, mob_protection, overmind) + reagent.expose_mob(L, VAPOR, 25, 1, mob_protection, overmind) send_message(L) /datum/blobstrain/reagent/blobbernaut_attack(mob/living/L) var/mob_protection = L.get_permeability_protection() - reagent.reaction_mob(L, VAPOR, 20, 0, mob_protection, overmind)//this will do between 10 and 20 damage(reduced by mob protection), depending on chemical, plus 4 from base brute damage. + reagent.expose_mob(L, VAPOR, 20, 0, mob_protection, overmind)//this will do between 10 and 20 damage(reduced by mob protection), depending on chemical, plus 4 from base brute damage. /datum/blobstrain/reagent/on_sporedeath(mob/living/spore) spore.reagents.add_reagent(reagent.type, 10) @@ -27,7 +27,7 @@ taste_description = "bad code and slime" -/datum/reagent/blob/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) if(M.stat == DEAD || istype(M, /mob/living/simple_animal/hostile/blob)) return 0 //the dead, and blob mobs, don't cause reactions return round(reac_volume * min(1.5 - touch_protection, 1), 0.1) //full touch protection means 50% volume, any prot below 0.5 means 100% volume. diff --git a/code/modules/antagonists/blob/blobstrains/blazing_oil.dm b/code/modules/antagonists/blob/blobstrains/blazing_oil.dm index 42fb6feb1a791..ce4ecc5193e70 100644 --- a/code/modules/antagonists/blob/blobstrains/blazing_oil.dm +++ b/code/modules/antagonists/blob/blobstrains/blazing_oil.dm @@ -32,7 +32,7 @@ color = "#B68D00" chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN -/datum/reagent/blob/blazing_oil/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/blazing_oil/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() M.adjust_fire_stacks(round(reac_volume/10)) M.IgniteMob() diff --git a/code/modules/antagonists/blob/blobstrains/cryogenic_poison.dm b/code/modules/antagonists/blob/blobstrains/cryogenic_poison.dm index b019146f0bc6a..6f86417e8d424 100644 --- a/code/modules/antagonists/blob/blobstrains/cryogenic_poison.dm +++ b/code/modules/antagonists/blob/blobstrains/cryogenic_poison.dm @@ -16,7 +16,7 @@ color = "#8BA6E9" taste_description = "brain freeze" -/datum/reagent/blob/cryogenic_poison/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/cryogenic_poison/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() if(M.reagents) M.reagents.add_reagent(/datum/reagent/consumable/frostoil, 0.3*reac_volume) diff --git a/code/modules/antagonists/blob/blobstrains/electromagnetic_web.dm b/code/modules/antagonists/blob/blobstrains/electromagnetic_web.dm index 13331561436d5..61136ebcc8449 100644 --- a/code/modules/antagonists/blob/blobstrains/electromagnetic_web.dm +++ b/code/modules/antagonists/blob/blobstrains/electromagnetic_web.dm @@ -30,7 +30,7 @@ color = "#83ECEC" chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN -/datum/reagent/blob/electromagnetic_web/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/electromagnetic_web/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() if(prob(reac_volume*2)) M.emp_act(EMP_LIGHT) diff --git a/code/modules/antagonists/blob/blobstrains/energized_jelly.dm b/code/modules/antagonists/blob/blobstrains/energized_jelly.dm index 9d95096285b9a..13f799a6ca3a8 100644 --- a/code/modules/antagonists/blob/blobstrains/energized_jelly.dm +++ b/code/modules/antagonists/blob/blobstrains/energized_jelly.dm @@ -27,7 +27,7 @@ color = "#EFD65A" chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN -/datum/reagent/blob/energized_jelly/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/energized_jelly/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() M.losebreath += round(0.2*reac_volume) M.adjustStaminaLoss(reac_volume) diff --git a/code/modules/antagonists/blob/blobstrains/explosive_lattice.dm b/code/modules/antagonists/blob/blobstrains/explosive_lattice.dm index b4b95e46dfd26..83230cca0352e 100644 --- a/code/modules/antagonists/blob/blobstrains/explosive_lattice.dm +++ b/code/modules/antagonists/blob/blobstrains/explosive_lattice.dm @@ -24,7 +24,7 @@ color = "#8B2500" chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN -/datum/reagent/blob/explosive_lattice/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/explosive_lattice/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) var/initial_volume = reac_volume reac_volume = ..() if(reac_volume >= 10) //if it's not a spore cloud, bad time incoming diff --git a/code/modules/antagonists/blob/blobstrains/networked_fibers.dm b/code/modules/antagonists/blob/blobstrains/networked_fibers.dm index 3e71daf27d27a..c3a4353f3e9e8 100644 --- a/code/modules/antagonists/blob/blobstrains/networked_fibers.dm +++ b/code/modules/antagonists/blob/blobstrains/networked_fibers.dm @@ -32,7 +32,7 @@ color = "#CDC0B0" chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN -/datum/reagent/blob/networked_fibers/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/networked_fibers/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() M.apply_damage(0.6*reac_volume, BRUTE) if(M) diff --git a/code/modules/antagonists/blob/blobstrains/pressurized_slime.dm b/code/modules/antagonists/blob/blobstrains/pressurized_slime.dm index cc77b2fc298aa..34120a56f4be1 100644 --- a/code/modules/antagonists/blob/blobstrains/pressurized_slime.dm +++ b/code/modules/antagonists/blob/blobstrains/pressurized_slime.dm @@ -38,7 +38,7 @@ color = "#AAAABB" chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN -/datum/reagent/blob/pressurized_slime/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/pressurized_slime/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() var/turf/open/T = get_turf(M) if(istype(T) && prob(reac_volume)) diff --git a/code/modules/antagonists/blob/blobstrains/reactive_spines.dm b/code/modules/antagonists/blob/blobstrains/reactive_spines.dm index 4b562ea6b902c..e963828e61c42 100644 --- a/code/modules/antagonists/blob/blobstrains/reactive_spines.dm +++ b/code/modules/antagonists/blob/blobstrains/reactive_spines.dm @@ -25,7 +25,7 @@ color = "#9ACD32" chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN -/datum/reagent/blob/reactive_spines/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/reactive_spines/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) if(M.stat == DEAD || istype(M, /mob/living/simple_animal/hostile/blob)) return 0 //the dead, and blob mobs, don't cause reactions M.adjustBruteLoss(0.8*reac_volume) diff --git a/code/modules/antagonists/blob/blobstrains/regenerative_materia.dm b/code/modules/antagonists/blob/blobstrains/regenerative_materia.dm index 24606fc053522..252550b7ccff9 100644 --- a/code/modules/antagonists/blob/blobstrains/regenerative_materia.dm +++ b/code/modules/antagonists/blob/blobstrains/regenerative_materia.dm @@ -14,7 +14,7 @@ color = "#A88FB7" chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN -/datum/reagent/blob/regenerative_materia/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/regenerative_materia/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() M.adjust_drugginess(reac_volume) if(M.reagents) diff --git a/code/modules/antagonists/blob/blobstrains/replicating_foam.dm b/code/modules/antagonists/blob/blobstrains/replicating_foam.dm index 58c5cf96346a2..ef327c165d057 100644 --- a/code/modules/antagonists/blob/blobstrains/replicating_foam.dm +++ b/code/modules/antagonists/blob/blobstrains/replicating_foam.dm @@ -31,6 +31,6 @@ color = "#7B5A57" chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN -/datum/reagent/blob/replicating_foam/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/replicating_foam/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() M.apply_damage(0.7*reac_volume, BRUTE) diff --git a/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm b/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm index 9ba70ffbc69ee..ee96fce687271 100644 --- a/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm +++ b/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm @@ -32,6 +32,6 @@ color = "#C8963C" chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN -/datum/reagent/blob/shifting_fragments/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/shifting_fragments/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() M.apply_damage(0.7*reac_volume, BRUTE) diff --git a/code/modules/antagonists/blob/blobstrains/synchronous_mesh.dm b/code/modules/antagonists/blob/blobstrains/synchronous_mesh.dm index 351c578aa1b9a..ef7102831d406 100644 --- a/code/modules/antagonists/blob/blobstrains/synchronous_mesh.dm +++ b/code/modules/antagonists/blob/blobstrains/synchronous_mesh.dm @@ -30,7 +30,7 @@ color = "#65ADA2" chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN -/datum/reagent/blob/synchronous_mesh/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/synchronous_mesh/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() M.apply_damage(0.2*reac_volume, BRUTE) if(M && reac_volume) diff --git a/code/modules/antagonists/blob/blobstrains/zombifying_pods.dm b/code/modules/antagonists/blob/blobstrains/zombifying_pods.dm index 06e97d89a66c0..9615fb97fb80a 100644 --- a/code/modules/antagonists/blob/blobstrains/zombifying_pods.dm +++ b/code/modules/antagonists/blob/blobstrains/zombifying_pods.dm @@ -32,7 +32,7 @@ color = "#E88D5D" chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN -/datum/reagent/blob/zombifying_pods/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) +/datum/reagent/blob/zombifying_pods/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() M.apply_damage(0.6*reac_volume, TOX) if(O && ishuman(M) && (M.stat == UNCONSCIOUS || M.stat == HARD_CRIT)) diff --git a/code/modules/detectivework/footprints_and_rag.dm b/code/modules/detectivework/footprints_and_rag.dm index af4c592983fc5..448abc58820ef 100644 --- a/code/modules/detectivework/footprints_and_rag.dm +++ b/code/modules/detectivework/footprints_and_rag.dm @@ -29,12 +29,12 @@ var/reagentlist = pretty_string_from_reagent_list(reagents) var/log_object = "containing [reagentlist]" if(user.a_intent == INTENT_HARM && !C.is_mouth_covered()) - reagents.reaction(C, INGEST) + reagents.expose(C, INGEST) reagents.trans_to(C, reagents.total_volume, transfered_by = user) C.visible_message("[user] has smothered \the [C] with \the [src]!", "[user] has smothered you with \the [src]!", "You hear some struggling and muffled cries of surprise.") log_combat(user, C, "smothered", src, log_object) else - reagents.reaction(C, TOUCH) + reagents.expose(C, TOUCH) reagents.clear_reagents() C.visible_message("[user] has touched \the [C] with \the [src].") log_combat(user, C, "touched", src, log_object) diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index 5c90955d813b7..c00364caa8881 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -65,7 +65,7 @@ var/fraction = min(gulp_amount/reagents.total_volume, 1) checkLiked(fraction, M) - reagents.reaction(M, INGEST, fraction) + reagents.expose(M, INGEST, fraction) reagents.trans_to(M, gulp_amount, transfered_by = user) playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1) return 1 diff --git a/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm b/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm index c14efb097464b..abe97fd809b47 100644 --- a/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm +++ b/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm @@ -113,7 +113,7 @@ target.visible_message("[user] splashes the contents of [src] onto [target]!", \ "[user] splashes the contents of [src] onto you!") log_combat(user, target, "splashed", src) - reagents.reaction(target, TOUCH) + reagents.expose(target, TOUCH) reagents.clear_reagents() return ..() @@ -126,6 +126,6 @@ else if(reagents.total_volume && user.a_intent == INTENT_HARM) user.visible_message("[user] splashes the contents of [src] onto [target]!", \ "You splash the contents of [src] onto [target].") - reagents.reaction(target, TOUCH) + reagents.expose(target, TOUCH) reagents.clear_reagents() return diff --git a/code/modules/food_and_drinks/food/condiment.dm b/code/modules/food_and_drinks/food/condiment.dm index 94ca89876bcdc..c59ba6a104ca6 100644 --- a/code/modules/food_and_drinks/food/condiment.dm +++ b/code/modules/food_and_drinks/food/condiment.dm @@ -92,7 +92,7 @@ log_combat(user, M, "fed", reagents.log_list()) var/fraction = min(10/reagents.total_volume, 1) - reagents.reaction(M, INGEST, fraction) + reagents.expose(M, INGEST, fraction) reagents.trans_to(M, 10, transfered_by = user) playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1) return 1 diff --git a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm index 810690e1152dc..735f4210556b6 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm @@ -216,7 +216,7 @@ GLOBAL_LIST_INIT(oilfry_blacklisted_items, typecacheof(list( return var/mob/living/carbon/C = user.pulling user.visible_message("[user] dunks [C]'s face in [src]!") - reagents.reaction(C, TOUCH) + reagents.expose(C, TOUCH) log_combat(user, C, "fryer slammed") var/permeability = 1 - C.get_permeability_protection(list(HEAD)) C.apply_damage(min(30 * permeability, reagents.total_volume), BURN, BODY_ZONE_HEAD) diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index 4ae15a1479aaf..9945cc055ee6c 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -159,9 +159,9 @@ CREATION_TEST_IGNORE_SUBTYPES(/obj/item/food/grown) if(seed) for(var/datum/plant_gene/trait/trait in seed.genes) trait.on_squash(src, target) - reagents.reaction(T) + reagents.expose(T) for(var/A in T) - reagents.reaction(A) + reagents.expose(A) qdel(src) /obj/item/food/grown/proc/squashreact() diff --git a/code/modules/hydroponics/plant_genes.dm b/code/modules/hydroponics/plant_genes.dm index 38cc920c9b115..dff1f8b1e0ae1 100644 --- a/code/modules/hydroponics/plant_genes.dm +++ b/code/modules/hydroponics/plant_genes.dm @@ -466,7 +466,7 @@ var/injecting_amount = max(1, G.seed.potency*0.2) // Minimum of 1, max of 20 var/fraction = min(injecting_amount/G.reagents.total_volume, 1) - G.reagents.reaction(L, INJECT, fraction) + G.reagents.expose(L, INJECT, fraction) G.reagents.trans_to(L, injecting_amount) to_chat(L, "You are pricked by [G]!") return TRUE diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index a60c049535526..a678c0a5dc0a4 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -611,7 +611,7 @@ CREATION_TEST_IGNORE_SUBTYPES(/obj/item/shared_storage/blue) color = "#FFEBEB" chem_flags = CHEMICAL_RNG_FUN | CHEMICAL_RNG_BOTANY -/datum/reagent/flightpotion/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1) +/datum/reagent/flightpotion/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1) if(iscarbon(M) && M.stat != DEAD) var/mob/living/carbon/C = M var/holycheck = ishumanbasic(C) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 3e02d5a4e4875..54eaadcbf5421 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -614,3 +614,21 @@ user.visible_message("[user.name] shoves [name]!", "You shove [name]!", null, COMBAT_MESSAGE_RANGE) log_combat(user, src, "shoved", "disarm") + +/** Handles exposing a mob to reagents. + * + * If the method is INGEST the mob tastes the reagents. + * If the method is VAPOR it incorporates permiability protection. + */ +/mob/living/expose_reagents(list/reagents, datum/reagents/source, method=TOUCH, volume_modifier=1, show_message=TRUE) + . = ..() + if(. & COMPONENT_NO_EXPOSE_REAGENTS) + return + + if(method == INGEST) + taste(source) + + var/touch_protection = (method == VAPOR) ? get_permeability_protection() : 0 + for(var/reagent in reagents) + var/datum/reagent/R = reagent + . |= R.expose_mob(src, method, reagents[R] || (R.volume * volume_modifier), show_message, touch_protection) diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index d1d72c42c235b..95d6f1771af4d 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -661,7 +661,7 @@ CREATION_TEST_IGNORE_SUBTYPES(/mob/living/simple_animal/bot/medbot) var/fraction = min(injection_amount/reagent_glass.reagents.total_volume, 1) var/reagentlist = pretty_string_from_reagent_list(reagent_glass.reagents.reagent_list) log_combat(src, patient, "injected", "beaker source", "[reagentlist]:[injection_amount]") - reagent_glass.reagents.reaction(patient, INJECT, fraction) + reagent_glass.reagents.expose(patient, INJECT, fraction) reagent_glass.reagents.trans_to(patient,injection_amount/efficiency, efficiency) //Inject from beaker. if(!reagent_glass.reagents.total_volume && !synth_epi) //when empty, alert medbay unless we're on synth mode var/list/messagevoice = list("Can someone fill me back up?" = 'sound/voice/medbot/fillmebackup.ogg',"I need new medicine." = 'sound/voice/medbot/needmedicine.ogg',"I need to restock." = 'sound/voice/medbot/needtorestock.ogg') diff --git a/code/modules/mob/living/simple_animal/hostile/bees.dm b/code/modules/mob/living/simple_animal/hostile/bees.dm index d76476a02d804..fc8f7f41b6f93 100644 --- a/code/modules/mob/living/simple_animal/hostile/bees.dm +++ b/code/modules/mob/living/simple_animal/hostile/bees.dm @@ -161,7 +161,7 @@ if(. && beegent && isliving(target)) var/mob/living/L = target if(L.reagents) - beegent.reaction_mob(L, INJECT) + beegent.expose_mob(L, INJECT) L.reagents.add_reagent(beegent.type, rand(1,5)) @@ -246,7 +246,7 @@ . = ..() if(. && beegent && isliving(target)) var/mob/living/L = target - beegent.reaction_mob(L, TOUCH) + beegent.expose_mob(L, TOUCH) L.reagents.add_reagent(beegent.type, rand(1,5)) diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm index a043bcf72665a..1580a895caad2 100644 --- a/code/modules/mob/living/simple_animal/slime/life.dm +++ b/code/modules/mob/living/simple_animal/slime/life.dm @@ -140,7 +140,7 @@ var/mob/living/M = buckled if(transformeffects & SLIME_EFFECT_OIL) var/datum/reagent/fuel/fuel = new - fuel.reaction_mob(buckled,TOUCH,20) + fuel.expose_mob(buckled,TOUCH,20) qdel(fuel) if(M.stat == DEAD) if(client) diff --git a/code/modules/plumbing/plumbers/_plumb_machinery.dm b/code/modules/plumbing/plumbers/_plumb_machinery.dm index aa6a607e35bce..f5ec47fbc3b4b 100644 --- a/code/modules/plumbing/plumbers/_plumb_machinery.dm +++ b/code/modules/plumbing/plumbers/_plumb_machinery.dm @@ -50,7 +50,7 @@ CREATION_TEST_IGNORE_SUBTYPES(/obj/machinery/plumbing) to_chat(user, "You start furiously plunging [name].") if(do_after(user, 30, target = src)) to_chat(user, "You finish plunging the [name].") - reagents.reaction(get_turf(src), TOUCH) //splash on the floor + reagents.expose(get_turf(src), TOUCH) //splash on the floor reagents.clear_reagents() /obj/machinery/plumbing/welder_act(mob/living/user, obj/item/I) diff --git a/code/modules/pool/pool.dm b/code/modules/pool/pool.dm index 9639fa63eb569..da5652904aeda 100644 --- a/code/modules/pool/pool.dm +++ b/code/modules/pool/pool.dm @@ -295,9 +295,9 @@ GLOBAL_LIST_EMPTY(pool_filters) reagents.trans_to(splash_holder, trans_amount, transfered_by = src) splash_holder.chem_temp = current_temperature if(DT_PROB(80, delta_time)) - splash_holder.reaction(M, TOUCH) + splash_holder.expose(M, TOUCH) else //Sometimes the water penetrates a lil deeper than just a splosh. - splash_holder.reaction(M, INGEST) + splash_holder.expose(M, INGEST) splash_holder.trans_to(M, trans_amount, transfered_by = src) //Actually put reagents in the mob qdel(splash_holder) var/mob/living/carbon/C = M diff --git a/code/modules/projectiles/projectile/bullets/dart_syringe.dm b/code/modules/projectiles/projectile/bullets/dart_syringe.dm index 22538dff1cff9..89f16998acfc3 100644 --- a/code/modules/projectiles/projectile/bullets/dart_syringe.dm +++ b/code/modules/projectiles/projectile/bullets/dart_syringe.dm @@ -29,7 +29,7 @@ syringe.embed(M) return BULLET_ACT_HIT else - reagents.reaction(M, INJECT) + reagents.expose(M, INJECT) reagents.trans_to(M, reagents.total_volume) return BULLET_ACT_HIT else diff --git a/code/modules/projectiles/projectile/energy/ebow.dm b/code/modules/projectiles/projectile/energy/ebow.dm index e646332ded9c1..ffb5421382642 100644 --- a/code/modules/projectiles/projectile/energy/ebow.dm +++ b/code/modules/projectiles/projectile/energy/ebow.dm @@ -36,7 +36,7 @@ if(blocked != 100) // not completely blocked if(M.can_inject(null, FALSE, def_zone,)) // Pass the hit zone to see if it can inject by whether it hit the head or the body. ..() - reagents.reaction(M, INJECT) + reagents.expose(M, INJECT) reagents.trans_to(M, reagents.total_volume) M.adjustOrganLoss(ORGAN_SLOT_BRAIN, 15, 170) M.confused += 3 diff --git a/code/modules/reagents/chem_splash.dm b/code/modules/reagents/chem_splash.dm index 431754b4fce67..c3c2a92a09074 100644 --- a/code/modules/reagents/chem_splash.dm +++ b/code/modules/reagents/chem_splash.dm @@ -66,7 +66,7 @@ for(var/atom/A as() in reactable) var/distance = max(1,get_dist(A, epicenter)) var/fraction = 0.5/(2 ** distance) //50/25/12/6... for a 200u splash, 25/12/6/3... for a 100u, 12/6/3/1 for a 50u - splash_holder.reaction(A, TOUCH, fraction) + splash_holder.expose(A, TOUCH, fraction) qdel(splash_holder) return 1 diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index f897a9f1b715f..3662e72c1fa65 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -204,8 +204,8 @@ * * no_react - passed through to [/datum/reagents/proc/add_reagent] * * mob/transfered_by - used for logging * * remove_blacklisted - skips transferring of reagents with can_synth = FALSE - * * method - passed through to [/datum/reagents/proc/react_single] and [/datum/reagent/proc/on_transfer] - * * show_message - passed through to [/datum/reagents/proc/react_single] + * * method - passed through to [/datum/reagents/proc/expose_single] and [/datum/reagent/proc/on_transfer] + * * show_message - passed through to [/datum/reagents/proc/expose_single] * * round_robin - if round_robin=TRUE, so transfer 5 from 15 water, 15 sugar and 15 plasma becomes 10, 15, 15 instead of 13.3333, 13.3333 13.3333. Good if you hate floating point errors */ /datum/reagents/proc/trans_to(obj/target, amount = 1, multiplier = 1, preserve_data = TRUE, no_react = FALSE, mob/transfered_by, remove_blacklisted = FALSE, method = null, show_message = TRUE, round_robin = FALSE) @@ -241,7 +241,7 @@ if(!R.add_reagent(T.type, transfer_amount * multiplier, trans_data, chem_temp, no_react = TRUE)) //we only handle reaction after every reagent has been transfered. continue if(method) - R.react_single(T, target_atom, method, part, show_message) + R.expose_single(T, target_atom, method, part, show_message) T.on_transfer(target_atom, method, transfer_amount * multiplier) remove_reagent(T.type, transfer_amount) transfer_log[T.type] = transfer_amount @@ -262,7 +262,7 @@ continue to_transfer = max(to_transfer - transfer_amount , 0) if(method) - R.react_single(T, target_atom, method, transfer_amount, show_message) + R.expose_single(T, target_atom, method, transfer_amount, show_message) T.on_transfer(target_atom, method, transfer_amount * multiplier) remove_reagent(T.type, transfer_amount) transfer_log[T.type] = transfer_amount @@ -681,68 +681,37 @@ return can_process /** - * Applies the relevant reaction_ proc for every reagent in this holder - * * [/datum/reagent/proc/reaction_mob] - * * [/datum/reagent/proc/reaction_turf] - * * [/datum/reagent/proc/reaction_obj] + * Applies the relevant expose_ proc for every reagent in this holder + * * [/datum/reagent/proc/expose_mob] + * * [/datum/reagent/proc/expose_turf] + * * [/datum/reagent/proc/expose_obj] */ -/datum/reagents/proc/reaction(atom/A, method = TOUCH, volume_modifier = 1, show_message = 1, obj/item/bodypart/affecting) - var/react_type - if(isliving(A)) - react_type = "LIVING" - if(method == INGEST) - var/mob/living/L = A - L.taste(src) - else if(isturf(A)) - react_type = "TURF" - else if(isobj(A)) - react_type = "OBJ" - else - return +/datum/reagents/proc/expose(atom/A, method = TOUCH, volume_modifier = 1, show_message = 1, obj/item/bodypart/affecting) + if(isnull(A)) + return null + var/list/cached_reagents = reagent_list + if(!cached_reagents.len) + return null + + var/list/reagents = list() for(var/reagent in cached_reagents) var/datum/reagent/R = reagent - switch(react_type) - if("LIVING") - var/check = reaction_check(A, R) - if(!check) - continue - var/touch_protection = 0 - if(method == VAPOR) - var/mob/living/L = A - touch_protection = L.get_permeability_protection() - R.reaction_mob(A, method, R.volume * volume_modifier, show_message, touch_protection, affecting) - if("TURF") - R.reaction_turf(A, R.volume * volume_modifier, show_message) - if("OBJ") - R.reaction_obj(A, R.volume * volume_modifier, show_message) - -/// Same as [/datum/reagents/proc/reaction] but only for one reagent -/datum/reagents/proc/react_single(datum/reagent/R, atom/A, method = TOUCH, volume_modifier = 1, show_message = TRUE) - var/react_type - if(isliving(A)) - react_type = "LIVING" - if(method == INGEST) - var/mob/living/L = A - L.taste(src) - else if(isturf(A)) - react_type = "TURF" - else if(isobj(A)) - react_type = "OBJ" - else - return - switch(react_type) - if("LIVING") - var/touch_protection = 0 - if(method == VAPOR) - var/mob/living/L = A - touch_protection = L.get_permeability_protection() - R.reaction_mob(A, method, R.volume * volume_modifier, show_message, touch_protection) - if("TURF") - R.reaction_turf(A, R.volume * volume_modifier, show_message) - if("OBJ") - R.reaction_obj(A, R.volume * volume_modifier, show_message) + reagents[R] = R.volume * volume_modifier + + return A.expose_reagents(reagents, src, method, volume_modifier, show_message, affecting) + +/// Same as [/datum/reagents/proc/expose] but only for one reagent +/datum/reagents/proc/expose_single(datum/reagent/R, atom/A, method = TOUCH, volume_modifier = 1, show_message = TRUE) + if(isnull(A)) + return null + + if(!istype(R)) + R = get_reagent(R) + if(isnull(R)) + return null + return A.expose_reagents(list(R = R.volume * volume_modifier), src, method, volume_modifier, show_message) /// Is this holder full or not /datum/reagents/proc/holder_full() diff --git a/code/modules/reagents/chemistry/machinery/smoke_machine.dm b/code/modules/reagents/chemistry/machinery/smoke_machine.dm index 07955a7684af1..7edaf0cd5baf5 100644 --- a/code/modules/reagents/chemistry/machinery/smoke_machine.dm +++ b/code/modules/reagents/chemistry/machinery/smoke_machine.dm @@ -62,7 +62,7 @@ create_reagents(new_volume) reagents.maximum_volume = new_volume if(new_volume < reagents.total_volume) - reagents.reaction(loc, TOUCH) // if someone manages to downgrade it without deconstructing + reagents.expose(loc, TOUCH) // if someone manages to downgrade it without deconstructing reagents.clear_reagents() efficiency = 9 for(var/obj/item/stock_parts/capacitor/C in component_parts) @@ -106,7 +106,7 @@ return ..() /obj/machinery/smoke_machine/deconstruct() - reagents.reaction(loc, TOUCH) + reagents.expose(loc, TOUCH) reagents.clear_reagents() return ..() diff --git a/code/modules/reagents/chemistry/readme.md b/code/modules/reagents/chemistry/readme.md index e72fe3b83cc22..90c9e7af857a0 100644 --- a/code/modules/reagents/chemistry/readme.md +++ b/code/modules/reagents/chemistry/readme.md @@ -66,7 +66,7 @@ The holder (reagents datum) is the datum that holds a list of all reagents curre reaction(var/atom/A, var/method=TOUCH, var/volume_modifier=0) This proc calls the appropriate reaction procs of the reagents. - I.e. if A is an object, it will call the reagents reaction_obj + I.e. if A is an object, it will call the reagents expose_obj proc. The method var is used for reaction on mobs. It simply tells us if the mob TOUCHed the reagent, if it INGESTed the reagent, if the reagent was VAPORIZEd on them, if the reagent was INJECTed, or transfered via a PATCH to them. @@ -116,20 +116,20 @@ The holder (reagents datum) is the datum that holds a list of all reagents curre # About Reagents: Reagents are all the things you can mix and fille in bottles etc. This can be anything from rejuvs over water to ... iron. Each reagent also has a few procs - i'll explain those below. ``` - reaction_mob(var/mob/living/L, var/method=TOUCH) + expose_mob(var/mob/living/L, var/method=TOUCH) This is called by the holder's reation proc. This version is only called when the reagent reacts with a mob. The method var can be either TOUCH or INGEST. You'll want to put stuff like acid-facemelting in here. - reaction_obj(var/obj/O) + expose_obj(var/obj/O) This is called by the holder's reation proc. This version is called when the reagents reacts with an object. You'll want to put stuff like object melting in here ... or something. i dunno. - reaction_turf(var/turf/T) + expose_turf(var/turf/T) This is called by the holder's reation proc. This version is called when the reagents reacts with a turf. You'll want to put stuff like extra diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 3687b12cb6b56..3a77598e1a188 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -71,8 +71,12 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) . = ..() holder = null +/// Applies this reagent to an [/atom] +/datum/reagent/proc/expose_atom(atom/A, volume) + return + /// Applies this reagent to a [/mob/living] -/datum/reagent/proc/reaction_mob(mob/living/M, method = TOUCH, reac_volume, show_message = 1, touch_protection = 0, obj/item/bodypart/affecting) +/datum/reagent/proc/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0, obj/item/bodypart/affecting) if(!istype(M)) return FALSE if(method == VAPOR) //smoke, foam, spray @@ -84,12 +88,12 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) return TRUE /// Applies this reagent to an [/obj] -/datum/reagent/proc/reaction_obj(obj/O, volume) +/datum/reagent/proc/expose_obj(obj/O, volume) return /// Applies this reagent to a [/turf] -/datum/reagent/proc/reaction_turf(turf/T, volume) +/datum/reagent/proc/expose_turf(turf/T, volume) return /// Called from [/datum/reagents/proc/metabolize] diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index 16eb6462d09b5..29611ce72d79f 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -49,7 +49,7 @@ All effects don't start immediately, but rather get worse over time; the rate is L.applyOrganDamage(((max(sqrt(volume) * (boozepwr ** ALCOHOL_EXPONENT) * L.alcohol_tolerance, 0))/150)) return ..() -/datum/reagent/consumable/ethanol/reaction_obj(obj/O, reac_volume) +/datum/reagent/consumable/ethanol/expose_obj(obj/O, reac_volume) if(istype(O, /obj/item/paper)) var/obj/item/paper/paperaffected = O paperaffected.clear_paper() @@ -63,7 +63,7 @@ All effects don't start immediately, but rather get worse over time; the rate is O.visible_message("[O]'s ink is smeared by [name], but doesn't wash away!") return -/datum/reagent/consumable/ethanol/reaction_mob(mob/living/M, method=TOUCH, reac_volume)//Splashing people with ethanol isn't quite as good as fuel. +/datum/reagent/consumable/ethanol/expose_mob(mob/living/M, method=TOUCH, reac_volume)//Splashing people with ethanol isn't quite as good as fuel. if(!isliving(M)) return diff --git a/code/modules/reagents/chemistry/reagents/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drink_reagents.dm index 4d67bdd2f423d..5295970edce65 100644 --- a/code/modules/reagents/chemistry/reagents/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drink_reagents.dm @@ -174,7 +174,7 @@ SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "chemical_laughter", /datum/mood_event/chemical_laughter) ..() -/datum/reagent/consumable/laughter/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/consumable/laughter/expose_mob(mob/living/M, method=TOUCH, reac_volume) var/mob/living/carbon/human/reactor = M if(istype(reactor)) var/datum/component/mood/mood = reactor.GetComponent(/datum/component/mood) diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index edc67bc114664..97242be7c9693 100755 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -23,7 +23,7 @@ H.adjust_nutrition(nutriment_factor) holder.remove_reagent(type, metabolization_rate) -/datum/reagent/consumable/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/consumable/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == INGEST) if (quality && !HAS_TRAIT(M, TRAIT_AGEUSIA)) switch(quality) @@ -122,7 +122,7 @@ metabolization_rate = 10 * REAGENTS_METABOLISM var/fry_temperature = 450 //Around ~350 F (117 C) which deep fryers operate around in the real world -/datum/reagent/consumable/cooking_oil/reaction_obj(obj/exposed_obj, reac_volume) +/datum/reagent/consumable/cooking_oil/expose_obj(obj/exposed_obj, reac_volume) if(!holder || (holder.chem_temp <= fry_temperature)) return if(!isitem(exposed_obj) || HAS_TRAIT(exposed_obj, TRAIT_FOOD_FRIED)) @@ -141,7 +141,7 @@ exposed_obj.AddElement(/datum/element/fried_item, volume) exposed_obj.reagents.add_reagent(/datum/reagent/consumable/cooking_oil, reac_volume) -/datum/reagent/consumable/cooking_oil/reaction_mob(mob/living/exposed_mob, method = TOUCH, reac_volume, show_message = 1, touch_protection = 0) +/datum/reagent/consumable/cooking_oil/expose_mob(mob/living/exposed_mob, method = TOUCH, reac_volume, show_message = 1, touch_protection = 0) if(!(method == VAPOR || method == TOUCH) || isnull(holder) || (holder.chem_temp < fry_temperature)) return @@ -161,7 +161,7 @@ exposed_mob.adjustFireLoss(FryLoss) return TRUE -/datum/reagent/consumable/cooking_oil/reaction_turf(turf/open/exposed_turf, reac_volume) +/datum/reagent/consumable/cooking_oil/expose_turf(turf/open/exposed_turf, reac_volume) if(!istype(exposed_turf) || isgroundlessturf(exposed_turf) || (reac_volume < 5)) return @@ -291,7 +291,7 @@ M.adjust_bodytemperature(cooling, 50) ..() -/datum/reagent/consumable/frostoil/reaction_turf(turf/T, reac_volume) +/datum/reagent/consumable/frostoil/expose_turf(turf/T, reac_volume) if(reac_volume >= 5) for(var/mob/living/simple_animal/slime/M in T) M.adjustToxLoss(rand(15,30)) @@ -308,7 +308,7 @@ chem_flags = CHEMICAL_RNG_GENERAL | CHEMICAL_RNG_FUN | CHEMICAL_GOAL_BOTANIST_HARVEST taste_description = "scorching agony" -/datum/reagent/consumable/condensedcapsaicin/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/consumable/condensedcapsaicin/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(!ishuman(M) && !ismonkey(M)) return @@ -341,13 +341,13 @@ chem_flags = CHEMICAL_RNG_GENERAL | CHEMICAL_RNG_FUN | CHEMICAL_RNG_BOTANY taste_description = "salt" -/datum/reagent/consumable/sodiumchloride/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/consumable/sodiumchloride/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(!istype(M)) return if(M.has_bane(BANE_SALT)) M.mind.disrupt_spells(-200) -/datum/reagent/consumable/sodiumchloride/reaction_turf(turf/T, reac_volume) //Creates an umbra-blocking salt pile +/datum/reagent/consumable/sodiumchloride/expose_turf(turf/T, reac_volume) //Creates an umbra-blocking salt pile if(!istype(T)) return if(reac_volume < 1) @@ -471,7 +471,7 @@ chem_flags = CHEMICAL_RNG_GENERAL | CHEMICAL_RNG_FUN | CHEMICAL_GOAL_BOTANIST_HARVEST taste_description = "slime" -/datum/reagent/consumable/cornoil/reaction_turf(turf/open/T, reac_volume) +/datum/reagent/consumable/cornoil/expose_turf(turf/open/T, reac_volume) if (!istype(T)) return T.MakeSlippery(TURF_WET_LUBE, min_wet_time = 10 SECONDS, wet_time_to_add = reac_volume*2 SECONDS) @@ -529,7 +529,7 @@ chem_flags = NONE taste_description = "chalky wheat" -/datum/reagent/consumable/flour/reaction_turf(turf/T, reac_volume) +/datum/reagent/consumable/flour/expose_turf(turf/T, reac_volume) if(!isspaceturf(T)) var/obj/effect/decal/cleanable/food/flour/reagentdecal = new(T) reagentdecal = locate() in T //Might have merged with flour already there. @@ -614,7 +614,7 @@ M.adjustToxLoss(-1*REM+power, 0) ..() -/datum/reagent/consumable/honey/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/consumable/honey/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(iscarbon(M) && (method in list(TOUCH, VAPOR, PATCH))) var/mob/living/carbon/C = M for(var/s in C.surgeries) @@ -641,7 +641,7 @@ chem_flags = CHEMICAL_RNG_GENERAL | CHEMICAL_RNG_FUN | CHEMICAL_GOAL_BOTANIST_HARVEST taste_description = "bitterness" -/datum/reagent/consumable/tearjuice/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/consumable/tearjuice/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(!istype(M)) return var/unprotected = FALSE @@ -732,7 +732,7 @@ //Lazy list of mobs affected by the luminosity of this reagent. var/list/mobs_affected -/datum/reagent/consumable/tinlux/reaction_mob(mob/living/M) +/datum/reagent/consumable/tinlux/expose_mob(mob/living/M) add_reagent_light(M) /datum/reagent/consumable/tinlux/on_mob_end_metabolize(mob/living/M) diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index c38ccc49a781d..b1a69398d4668 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -237,7 +237,7 @@ ..() . = 1 -/datum/reagent/medicine/rezadone/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/medicine/rezadone/expose_mob(mob/living/M, method=TOUCH, reac_volume) . = ..() if(iscarbon(M)) var/mob/living/carbon/patient = M @@ -263,7 +263,7 @@ overdose_threshold = 100 metabolite = /datum/reagent/metabolite/medicine/silver_sulfadiazine -/datum/reagent/medicine/silver_sulfadiazine/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1, touch_protection, obj/item/bodypart/affecting) +/datum/reagent/medicine/silver_sulfadiazine/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1, touch_protection, obj/item/bodypart/affecting) if(iscarbon(M) && M.stat != DEAD) if(method in list(INGEST, VAPOR, INJECT)) M.adjustToxLoss(0.5*reac_volume) @@ -321,7 +321,7 @@ overdose_threshold = 100 metabolite = /datum/reagent/metabolite/medicine/styptic_powder -/datum/reagent/medicine/styptic_powder/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1, touch_protection, obj/item/bodypart/affecting) +/datum/reagent/medicine/styptic_powder/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1, touch_protection, obj/item/bodypart/affecting) if(iscarbon(M) && M.stat != DEAD) if(method in list(INGEST, VAPOR, INJECT)) M.adjustToxLoss(0.5*reac_volume) @@ -405,7 +405,7 @@ ..() return TRUE -/datum/reagent/medicine/mine_salve/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1) +/datum/reagent/medicine/mine_salve/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1) if(iscarbon(M) && M.stat != DEAD) if(method in list(INGEST, VAPOR, INJECT)) M.adjust_nutrition(-5) @@ -437,7 +437,7 @@ metabolization_rate = 2.5 * REAGENTS_METABOLISM overdose_threshold = 125 -/datum/reagent/medicine/synthflesh/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1, touch_protection, obj/item/bodypart/affecting) +/datum/reagent/medicine/synthflesh/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1, touch_protection, obj/item/bodypart/affecting) if(iscarbon(M)) if(M.stat == DEAD) show_message = FALSE @@ -946,7 +946,7 @@ metabolization_rate = 0.5 * REAGENTS_METABOLISM taste_description = "magnets" -/datum/reagent/medicine/strange_reagent/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/medicine/strange_reagent/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(M.stat == DEAD) if(M.suiciding || M.ishellbound()) //they are never coming back M.visible_message("[M]'s body does not react...") @@ -1691,7 +1691,7 @@ ..() . = 1 -/datum/reagent/medicine/polypyr/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/medicine/polypyr/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == TOUCH || method == VAPOR) if(M && ishuman(M) && reac_volume >= 0.5) var/mob/living/carbon/human/H = M diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 33bc534df3190..f8b18e3e9e35d 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -11,7 +11,7 @@ glass_desc = "Are you sure this is tomato juice?" shot_glass_icon_state = "shotglassred" -/datum/reagent/blood/reaction_mob(mob/living/L, method=TOUCH, reac_volume) +/datum/reagent/blood/expose_mob(mob/living/L, method=TOUCH, reac_volume) if(data && data["viruses"]) for(var/thing in data["viruses"]) var/datum/disease/D = thing @@ -77,7 +77,7 @@ var/datum/disease/D = thing . += D -/datum/reagent/blood/reaction_turf(turf/T, reac_volume)//splash the blood all over the place +/datum/reagent/blood/expose_turf(turf/T, reac_volume)//splash the blood all over the place if(!istype(T)) return if(reac_volume < 3) @@ -104,7 +104,7 @@ chem_flags = NONE taste_description = "slime" -/datum/reagent/vaccine/reaction_mob(mob/living/L, method=TOUCH, reac_volume) +/datum/reagent/vaccine/expose_mob(mob/living/L, method=TOUCH, reac_volume) if(islist(data) && (method == INGEST || method == INJECT)) for(var/thing in L.diseases) var/datum/disease/D = thing @@ -172,7 +172,7 @@ * Water reaction to turf */ -/datum/reagent/water/reaction_turf(turf/open/T, reac_volume) +/datum/reagent/water/expose_turf(turf/open/T, reac_volume) if(!istype(T)) return var/CT = cooling_temperature @@ -199,7 +199,7 @@ * Water reaction to an object */ -/datum/reagent/water/reaction_obj(obj/O, reac_volume) +/datum/reagent/water/expose_obj(obj/O, reac_volume) O.extinguish() O.acid_level = 0 // Monkey cube @@ -221,7 +221,7 @@ * Water reaction to a mob */ -/datum/reagent/water/reaction_mob(mob/living/M, method=TOUCH, reac_volume)//Splashing people with water can help put them out! +/datum/reagent/water/expose_mob(mob/living/M, method=TOUCH, reac_volume)//Splashing people with water can help put them out! if(!istype(M)) return if(isoozeling(M)) @@ -299,7 +299,7 @@ return holder.remove_reagent(type, 0.4) //fixed consumption to prevent balancing going out of whack -/datum/reagent/water/holywater/reaction_turf(turf/T, reac_volume) +/datum/reagent/water/holywater/expose_turf(turf/T, reac_volume) ..() if(!istype(T)) return @@ -314,7 +314,7 @@ chem_flags = CHEMICAL_RNG_GENERAL | CHEMICAL_RNG_FUN | CHEMICAL_RNG_BOTANY taste_description = "suffering" -/datum/reagent/fuel/unholywater/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/fuel/unholywater/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == TOUCH || method == VAPOR) M.reagents.add_reagent(type,reac_volume/4) return @@ -375,7 +375,7 @@ taste_description = "cherry" // by popular demand var/lube_kind = TURF_WET_LUBE ///What kind of slipperiness gets added to turfs. -/datum/reagent/lube/reaction_turf(turf/open/T, reac_volume) +/datum/reagent/lube/expose_turf(turf/open/T, reac_volume) if (!istype(T)) return if(reac_volume >= 1) @@ -398,7 +398,7 @@ overdose_threshold = 11 //Slightly more than one un-nozzled spraybottle. taste_description = "sour oranges" -/datum/reagent/spraytan/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1) +/datum/reagent/spraytan/expose_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1) if(ishuman(M)) if(method == PATCH || method == VAPOR) var/mob/living/carbon/human/N = M @@ -741,7 +741,7 @@ chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN taste_description = "slime" -/datum/reagent/aslimetoxin/reaction_mob(mob/living/L, method=TOUCH, reac_volume) +/datum/reagent/aslimetoxin/expose_mob(mob/living/L, method=TOUCH, reac_volume) if(method != TOUCH) L.ForceContractDisease(new /datum/disease/transformation/slime(), FALSE, TRUE) @@ -752,7 +752,7 @@ chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN taste_description = "decay" -/datum/reagent/gluttonytoxin/reaction_mob(mob/living/L, method=TOUCH, reac_volume) +/datum/reagent/gluttonytoxin/expose_mob(mob/living/L, method=TOUCH, reac_volume) L.ForceContractDisease(new /datum/disease/transformation/morph(), FALSE, TRUE) /datum/reagent/serotrotium @@ -778,13 +778,13 @@ taste_mult = 0 // oderless and tasteless -/datum/reagent/oxygen/reaction_obj(obj/O, reac_volume) +/datum/reagent/oxygen/expose_obj(obj/O, reac_volume) if((!O) || (!reac_volume)) return 0 var/temp = holder ? holder.chem_temp : T20C O.atmos_spawn_air("o2=[reac_volume/2];TEMP=[temp]") -/datum/reagent/oxygen/reaction_turf(turf/open/T, reac_volume) +/datum/reagent/oxygen/expose_turf(turf/open/T, reac_volume) if(istype(T)) var/temp = holder ? holder.chem_temp : T20C T.atmos_spawn_air("o2=[reac_volume/2];TEMP=[temp]") @@ -799,7 +799,7 @@ taste_description = "metal" -/datum/reagent/copper/reaction_obj(obj/O, reac_volume) +/datum/reagent/copper/expose_obj(obj/O, reac_volume) if(istype(O, /obj/item/stack/sheet/iron)) var/obj/item/stack/sheet/iron/M = O reac_volume = min(reac_volume, M.amount) @@ -815,13 +815,13 @@ taste_mult = 0 -/datum/reagent/nitrogen/reaction_obj(obj/O, reac_volume) +/datum/reagent/nitrogen/expose_obj(obj/O, reac_volume) if((!O) || (!reac_volume)) return 0 var/temp = holder ? holder.chem_temp : T20C O.atmos_spawn_air("n2=[reac_volume/2];TEMP=[temp]") -/datum/reagent/nitrogen/reaction_turf(turf/open/T, reac_volume) +/datum/reagent/nitrogen/expose_turf(turf/open/T, reac_volume) if(istype(T)) var/temp = holder ? holder.chem_temp : T20C T.atmos_spawn_air("n2=[reac_volume/2];TEMP=[temp]") @@ -876,7 +876,7 @@ chem_flags = CHEMICAL_BASIC_ELEMENT taste_description = "sour chalk" -/datum/reagent/carbon/reaction_turf(turf/T, reac_volume) +/datum/reagent/carbon/expose_turf(turf/T, reac_volume) if(!isspaceturf(T)) var/obj/effect/decal/cleanable/dirt/D = locate() in T.contents if(!D) @@ -954,7 +954,7 @@ chem_flags = CHEMICAL_RNG_GENERAL | CHEMICAL_RNG_FUN | CHEMICAL_RNG_BOTANY taste_description = "bitterness" -/datum/reagent/space_cleaner/sterilizine/reaction_mob(mob/living/carbon/C, method=TOUCH, reac_volume) +/datum/reagent/space_cleaner/sterilizine/expose_mob(mob/living/carbon/C, method=TOUCH, reac_volume) if(method in list(TOUCH, VAPOR, PATCH)) for(var/s in C.surgeries) var/datum/surgery/S = s @@ -976,7 +976,7 @@ C.blood_volume += 0.5 ..() -/datum/reagent/iron/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/iron/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(M.has_bane(BANE_IRON)) //If the target is weak to cold iron, then poison them. if(holder && holder.chem_temp < 100) // COLD iron. M.reagents.add_reagent(/datum/reagent/toxin, reac_volume) @@ -998,7 +998,7 @@ chem_flags = CHEMICAL_BASIC_ELEMENT taste_description = "expensive yet reasonable metal" -/datum/reagent/silver/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/silver/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(M.has_bane(BANE_SILVER)) M.reagents.add_reagent(/datum/reagent/toxin, reac_volume) ..() @@ -1017,7 +1017,7 @@ M.apply_effect(irradiation_level/M.metabolism_efficiency,EFFECT_IRRADIATE,0) ..() -/datum/reagent/uranium/reaction_turf(turf/T, reac_volume) +/datum/reagent/uranium/expose_turf(turf/T, reac_volume) if(reac_volume >= 3) if(!isspaceturf(T)) var/obj/effect/decal/cleanable/greenglow/GG = locate() in T.contents @@ -1046,7 +1046,7 @@ taste_description = "fizzling blue" process_flags = ORGANIC | SYNTHETIC -/datum/reagent/bluespace/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/bluespace/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == TOUCH || method == VAPOR) do_teleport(M, get_turf(M), (reac_volume / 5), asoundin = 'sound/effects/phasein.ogg', channel = TELEPORT_CHANNEL_BLUESPACE) //4 tiles per crystal ..() @@ -1092,7 +1092,7 @@ process_flags = ORGANIC | SYNTHETIC -/datum/reagent/fuel/reaction_mob(mob/living/M, method=TOUCH, reac_volume)//Splashing people with welding fuel to make them easy to ignite! +/datum/reagent/fuel/expose_mob(mob/living/M, method=TOUCH, reac_volume)//Splashing people with welding fuel to make them easy to ignite! if(method == TOUCH || method == VAPOR) M.adjust_fire_stacks(reac_volume / 10) return @@ -1119,10 +1119,10 @@ ..() return TRUE -/datum/reagent/space_cleaner/reaction_obj(obj/O, reac_volume) +/datum/reagent/space_cleaner/expose_obj(obj/O, reac_volume) O?.wash(clean_types) -/datum/reagent/space_cleaner/reaction_turf(turf/T, reac_volume) +/datum/reagent/space_cleaner/expose_turf(turf/T, reac_volume) if(reac_volume < 1) return @@ -1136,7 +1136,7 @@ for(var/mob/living/simple_animal/slime/M in T) M.adjustToxLoss(rand(5,10)) -/datum/reagent/space_cleaner/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/space_cleaner/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == TOUCH || method == VAPOR) M.wash(clean_types) else if(method == INGEST || method == INJECT) //why the fuck did you drink space cleaner you fucking buffoon @@ -1155,7 +1155,7 @@ M.adjustToxLoss(3.33) ..() -/datum/reagent/space_cleaner/ez_clean/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/space_cleaner/ez_clean/expose_mob(mob/living/M, method=TOUCH, reac_volume) ..() if((method == TOUCH || method == VAPOR) && !issilicon(M)) M.adjustBruteLoss(1.5) @@ -1200,7 +1200,7 @@ chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN taste_description = "sludge" -/datum/reagent/nanomachines/reaction_mob(mob/living/L, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0) +/datum/reagent/nanomachines/expose_mob(mob/living/L, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0) if(method==PATCH || method==INGEST || method==INJECT || (method == VAPOR && prob(min(reac_volume,100)*(1 - touch_protection)))) L.ForceContractDisease(new /datum/disease/transformation/robot(), FALSE, TRUE) @@ -1211,7 +1211,7 @@ chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN taste_description = "sludge" -/datum/reagent/xenomicrobes/reaction_mob(mob/living/L, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0) +/datum/reagent/xenomicrobes/expose_mob(mob/living/L, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0) if(method==PATCH || method==INGEST || method==INJECT || (method == VAPOR && prob(min(reac_volume,100)*(1 - touch_protection)))) L.ForceContractDisease(new /datum/disease/transformation/xeno(), FALSE, TRUE) @@ -1223,7 +1223,7 @@ taste_description = "slime" -/datum/reagent/fungalspores/reaction_mob(mob/living/L, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0) +/datum/reagent/fungalspores/expose_mob(mob/living/L, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0) if(method==PATCH || method==INGEST || method==INJECT || (method == VAPOR && prob(min(reac_volume,100)*(1 - touch_protection)))) L.ForceContractDisease(new /datum/disease/tuberculosis(), FALSE, TRUE) @@ -1234,7 +1234,7 @@ chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_FUN taste_description = "goo" -/datum/reagent/snail/reaction_mob(mob/living/L, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0) +/datum/reagent/snail/expose_mob(mob/living/L, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0) if(method==PATCH || method==INGEST || method==INJECT || (method == VAPOR && prob(min(reac_volume,100)*(1 - touch_protection)))) L.ForceContractDisease(new /datum/disease/gastrolosis(), FALSE, TRUE) @@ -1284,13 +1284,13 @@ chem_flags = NONE taste_description = "something unknowable" -/datum/reagent/carbondioxide/reaction_obj(obj/O, reac_volume) +/datum/reagent/carbondioxide/expose_obj(obj/O, reac_volume) if((!O) || (!reac_volume)) return 0 var/temp = holder ? holder.chem_temp : T20C O.atmos_spawn_air("co2=[reac_volume/5];TEMP=[temp]") -/datum/reagent/carbondioxide/reaction_turf(turf/open/T, reac_volume) +/datum/reagent/carbondioxide/expose_turf(turf/open/T, reac_volume) if(istype(T)) var/temp = holder ? holder.chem_temp : T20C T.atmos_spawn_air("co2=[reac_volume/5];TEMP=[temp]") @@ -1305,18 +1305,18 @@ chem_flags = NONE taste_description = "sweetness" -/datum/reagent/nitrous_oxide/reaction_obj(obj/O, reac_volume) +/datum/reagent/nitrous_oxide/expose_obj(obj/O, reac_volume) if((!O) || (!reac_volume)) return 0 var/temp = holder ? holder.chem_temp : T20C O.atmos_spawn_air("n2o=[reac_volume/5];TEMP=[temp]") -/datum/reagent/nitrous_oxide/reaction_turf(turf/open/T, reac_volume) +/datum/reagent/nitrous_oxide/expose_turf(turf/open/T, reac_volume) if(istype(T)) var/temp = holder ? holder.chem_temp : T20C T.atmos_spawn_air("n2o=[reac_volume/5];TEMP=[temp]") -/datum/reagent/nitrous_oxide/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/nitrous_oxide/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == VAPOR) M.drowsyness += max(round(reac_volume, 1), 2) @@ -1592,7 +1592,7 @@ taste_description = "carpet" // Your tongue feels furry. var/carpet_type = /turf/open/floor/carpet -/datum/reagent/carpet/reaction_turf(turf/T, reac_volume) +/datum/reagent/carpet/expose_turf(turf/T, reac_volume) if(isplatingturf(T) || istype(T, /turf/open/floor/iron)) var/turf/open/floor/F = T F.PlaceOnTop(carpet_type, flags = CHANGETURF_INHERIT_AIR) @@ -1727,21 +1727,12 @@ M.add_atom_colour(pick(random_color_list), WASHABLE_COLOUR_PRIORITY) return ..() -/datum/reagent/colorful_reagent/reaction_mob(mob/living/M, reac_volume) +/// Colors anything it touches a random color. +/datum/reagent/colorful_reagent/expose_atom(mob/living/M, reac_volume) if(can_colour_mobs) M.add_atom_colour(pick(random_color_list), WASHABLE_COLOUR_PRIORITY) ..() -/datum/reagent/colorful_reagent/reaction_obj(obj/O, reac_volume) - if(O) - O.add_atom_colour(pick(random_color_list), WASHABLE_COLOUR_PRIORITY) - ..() - -/datum/reagent/colorful_reagent/reaction_turf(turf/T, reac_volume) - if(T) - T.add_atom_colour(pick(random_color_list), WASHABLE_COLOUR_PRIORITY) - ..() - /datum/reagent/hair_dye name = "Quantum Hair Dye" description = "Has a high chance of making you look like a mad scientist." @@ -1751,7 +1742,7 @@ var/list/potential_colors = list("0ad","a0f","f73","d14","d14","0b5","0ad","f73","fc2","084","05e","d22","fa0") // fucking hair code // someone forgot how hair_color is programmed taste_description = "sourness" -/datum/reagent/hair_dye/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/hair_dye/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == TOUCH || method == VAPOR) if(M && ishuman(M)) var/mob/living/carbon/human/H = M @@ -1767,7 +1758,7 @@ chem_flags = CHEMICAL_RNG_GENERAL | CHEMICAL_RNG_FUN | CHEMICAL_GOAL_BOTANIST_HARVEST taste_description = "sourness" -/datum/reagent/barbers_aid/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/barbers_aid/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == TOUCH || method == VAPOR) if(M && ishuman(M)) var/mob/living/carbon/human/H = M @@ -1785,7 +1776,7 @@ chem_flags = CHEMICAL_RNG_GENERAL | CHEMICAL_RNG_FUN | CHEMICAL_RNG_BOTANY | CHEMICAL_GOAL_BOTANIST_HARVEST taste_description = "sourness" -/datum/reagent/concentrated_barbers_aid/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/concentrated_barbers_aid/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == TOUCH || method == VAPOR) if(M && ishuman(M)) var/mob/living/carbon/human/H = M @@ -1801,7 +1792,7 @@ chem_flags = CHEMICAL_RNG_GENERAL | CHEMICAL_RNG_FUN | CHEMICAL_RNG_BOTANY taste_description = "funky sugar" -/datum/reagent/barbers_afro_mania/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/barbers_afro_mania/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == TOUCH || method == VAPOR) if(M && ishuman(M)) var/mob/living/carbon/human/H = M @@ -1816,7 +1807,7 @@ chem_flags = CHEMICAL_RNG_GENERAL | CHEMICAL_RNG_FUN | CHEMICAL_RNG_BOTANY taste_description = "hairloss" -/datum/reagent/barbers_shaving_aid/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/barbers_shaving_aid/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == TOUCH || method == VAPOR) if(M && ishuman(M)) var/mob/living/carbon/human/H = M @@ -1851,11 +1842,11 @@ taste_description = "dryness" -/datum/reagent/drying_agent/reaction_turf(turf/open/T, reac_volume) +/datum/reagent/drying_agent/expose_turf(turf/open/T, reac_volume) if(istype(T)) T.MakeDry(ALL, TRUE, reac_volume * 5 SECONDS) //50 deciseconds per unit -/datum/reagent/drying_agent/reaction_obj(obj/O, reac_volume) +/datum/reagent/drying_agent/expose_obj(obj/O, reac_volume) if(O.type == /obj/item/clothing/shoes/galoshes) var/t_loc = get_turf(O) qdel(O) @@ -1961,7 +1952,7 @@ metabolization_rate = INFINITY taste_description = "brains" -/datum/reagent/romerol/reaction_mob(mob/living/carbon/human/H, method=TOUCH, reac_volume) +/datum/reagent/romerol/expose_mob(mob/living/carbon/human/H, method=TOUCH, reac_volume) // Silently add the zombie infection organ to be activated upon death if(!H.getorganslot(ORGAN_SLOT_ZOMBIE)) var/obj/item/organ/zombie_infection/nodamage/ZI = new() @@ -2029,7 +2020,7 @@ reagent_state = SOLID var/glitter_type = /obj/effect/decal/cleanable/glitter -/datum/reagent/glitter/reaction_turf(turf/T, reac_volume) +/datum/reagent/glitter/expose_turf(turf/T, reac_volume) if(!istype(T)) return new glitter_type(T) @@ -2131,7 +2122,7 @@ chem_flags = CHEMICAL_NOT_SYNTH | CHEMICAL_RNG_GENERAL | CHEMICAL_RNG_FUN taste_description = "inner peace" -/datum/reagent/tranquility/reaction_mob(mob/living/L, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0) +/datum/reagent/tranquility/expose_mob(mob/living/L, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0) if(method==PATCH || method==INGEST || method==INJECT || (method == VAPOR && prob(min(reac_volume,100)*(1 - touch_protection)))) L.ForceContractDisease(new /datum/disease/transformation/gondola(), FALSE, TRUE) @@ -2192,7 +2183,7 @@ metabolization_rate = 0.8 * REAGENTS_METABOLISM var/datum/language_holder/prev_language -/datum/reagent/consumable/ratlight/reaction_mob(mob/living/M) +/datum/reagent/consumable/ratlight/expose_mob(mob/living/M) M.set_light(2) ..() diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm index c22f01d136836..b7105cef549f3 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm @@ -8,7 +8,7 @@ taste_description = "sweet tasting metal" process_flags = ORGANIC | SYNTHETIC -/datum/reagent/thermite/reaction_turf(turf/T, reac_volume) +/datum/reagent/thermite/expose_turf(turf/T, reac_volume) if(reac_volume >= 1) T.AddComponent(/datum/component/thermite, reac_volume) @@ -49,7 +49,7 @@ ..() return TRUE -/datum/reagent/clf3/reaction_turf(turf/T, reac_volume) +/datum/reagent/clf3/expose_turf(turf/T, reac_volume) if(isplatingturf(T)) var/turf/open/floor/plating/F = T if(prob(10 + F.burnt + 5*F.broken)) //broken or burnt plating is more susceptible to being destroyed @@ -69,7 +69,7 @@ if(prob(reac_volume)) EX_ACT(W, EXPLODE_DEVASTATE) -/datum/reagent/clf3/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/clf3/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(istype(M)) if(method != INGEST && method != INJECT) M.adjust_fire_stacks(min(reac_volume/5, 10)) @@ -161,7 +161,7 @@ self_consuming = TRUE process_flags = ORGANIC | SYNTHETIC -/datum/reagent/phlogiston/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/phlogiston/expose_mob(mob/living/M, method=TOUCH, reac_volume) M.adjust_fire_stacks(1) var/burndmg = max(0.3*M.fire_stacks, 0.3) M.adjustFireLoss(burndmg, 0) @@ -189,7 +189,7 @@ M.adjust_fire_stacks(1) ..() -/datum/reagent/napalm/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/napalm/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(istype(M)) if(method != INGEST && method != INJECT) M.adjust_fire_stacks(min(reac_volume/4, 20)) @@ -214,7 +214,7 @@ humi.adjust_coretemperature(-15) ..() -/datum/reagent/cryostylane/reaction_turf(turf/T, reac_volume) +/datum/reagent/cryostylane/expose_turf(turf/T, reac_volume) if(reac_volume >= 5) for(var/mob/living/simple_animal/slime/M in T) M.adjustToxLoss(rand(15,30)) @@ -306,7 +306,7 @@ chem_flags = NONE taste_description = "the inside of a fire extinguisher" -/datum/reagent/firefighting_foam/reaction_turf(turf/open/T, reac_volume) +/datum/reagent/firefighting_foam/expose_turf(turf/open/T, reac_volume) if (!istype(T)) return @@ -326,10 +326,10 @@ G.react(src) qdel(hotspot) -/datum/reagent/firefighting_foam/reaction_obj(obj/O, reac_volume) +/datum/reagent/firefighting_foam/expose_obj(obj/O, reac_volume) O.extinguish() -/datum/reagent/firefighting_foam/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/firefighting_foam/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method in list(VAPOR, TOUCH)) M.adjust_fire_stacks(-reac_volume) M.ExtinguishMob() diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 567fc0d499958..f3543bebd638b 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -34,7 +34,7 @@ taste_description = "slime" taste_mult = 0.9 -/datum/reagent/toxin/mutagen/reaction_mob(mob/living/carbon/M, method=TOUCH, reac_volume) +/datum/reagent/toxin/mutagen/expose_mob(mob/living/carbon/M, method=TOUCH, reac_volume) if(!..()) return if(!M.has_dna()) @@ -70,7 +70,7 @@ C.adjustPlasma(20) return ..() -/datum/reagent/toxin/plasma/reaction_mob(mob/living/M, method=TOUCH, reac_volume)//Splashing people with plasma is stronger than fuel! +/datum/reagent/toxin/plasma/expose_mob(mob/living/M, method=TOUCH, reac_volume)//Splashing people with plasma is stronger than fuel! if(method == TOUCH || method == VAPOR) M.adjust_fire_stacks(reac_volume / 5) return @@ -209,7 +209,7 @@ toxpwr = 1 taste_mult = 1 -/datum/reagent/toxin/plantbgone/reaction_obj(obj/O, reac_volume) +/datum/reagent/toxin/plantbgone/expose_obj(obj/O, reac_volume) if(istype(O, /obj/structure/alien/weeds)) var/obj/structure/alien/weeds/alien_weeds = O alien_weeds.take_damage(rand(15,35), BRUTE, 0) // Kills alien weeds pretty fast @@ -219,7 +219,7 @@ var/obj/structure/spacevine/SV = O SV.on_chem_effect(src) -/datum/reagent/toxin/plantbgone/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/toxin/plantbgone/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == VAPOR) if(iscarbon(M)) var/mob/living/carbon/C = M @@ -240,7 +240,7 @@ chem_flags = CHEMICAL_RNG_GENERAL | CHEMICAL_RNG_FUN | CHEMICAL_RNG_BOTANY toxpwr = 1 -/datum/reagent/toxin/pestkiller/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/toxin/pestkiller/expose_mob(mob/living/M, method=TOUCH, reac_volume) ..() if(MOB_BUG in M.mob_biotypes) var/damage = min(round(0.4*reac_volume, 0.1),10) @@ -528,7 +528,7 @@ metabolization_rate = 0.4 * REAGENTS_METABOLISM toxpwr = 0 -/datum/reagent/toxin/itching_powder/reaction_mob(mob/living/M, method=TOUCH, reac_volume) +/datum/reagent/toxin/itching_powder/expose_mob(mob/living/M, method=TOUCH, reac_volume) if(method == TOUCH || method == VAPOR) M.reagents?.add_reagent(/datum/reagent/toxin/itching_powder, reac_volume) @@ -803,7 +803,7 @@ self_consuming = TRUE process_flags = ORGANIC | SYNTHETIC -/datum/reagent/toxin/acid/reaction_mob(mob/living/carbon/C, method=TOUCH, reac_volume) +/datum/reagent/toxin/acid/expose_mob(mob/living/carbon/C, method=TOUCH, reac_volume) if(!istype(C)) return reac_volume = round(reac_volume,0.1) @@ -815,13 +815,13 @@ return C.acid_act(acidpwr, reac_volume) -/datum/reagent/toxin/acid/reaction_obj(obj/O, reac_volume) +/datum/reagent/toxin/acid/expose_obj(obj/O, reac_volume) if(ismob(O.loc)) //handled in human acid_act() return reac_volume = round(reac_volume,0.1) O.acid_act(acidpwr, reac_volume) -/datum/reagent/toxin/acid/reaction_turf(turf/T, reac_volume) +/datum/reagent/toxin/acid/expose_turf(turf/T, reac_volume) if (!istype(T)) return reac_volume = round(reac_volume,0.1) diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 97516887556a5..be30b92be4ad6 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -120,7 +120,7 @@ CREATION_TEST_IGNORE_SUBTYPES(/obj/item/reagent_containers) if(thrownby) log_combat(thrown_by, M, "splashed", R) - reagents.reaction(target, TOUCH) + reagents.expose(target, TOUCH) else if(bartender_check(target) && thrown) visible_message("[src] lands onto the [target.name] without spilling a single drop.") @@ -132,7 +132,7 @@ CREATION_TEST_IGNORE_SUBTYPES(/obj/item/reagent_containers) log_game("[key_name(thrown_by)] splashed (thrown) [english_list(reagents.reagent_list)] on [target] in [AREACOORD(target)].") message_admins("[ADMIN_LOOKUPFLW(thrown_by)] splashed (thrown) [english_list(reagents.reagent_list)] on [target] in [ADMIN_VERBOSEJMP(target)].") visible_message("[src] spills its contents all over [target].") - reagents.reaction(target, TOUCH) + reagents.expose(target, TOUCH) if(QDELETED(src)) return diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index a406ccf40967c..c7e1c82f426df 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -106,7 +106,7 @@ Borg Hypospray to_chat(M, "You feel a tiny prick!") to_chat(user, "You inject [M] with the injector.") var/fraction = min(amount_per_transfer_from_this/R.total_volume, 1) - R.reaction(M, INJECT, fraction) + R.expose(M, INJECT, fraction) if(M.reagents) var/trans = R.trans_to(M, amount_per_transfer_from_this, transfered_by = user) to_chat(user, "[trans] unit\s injected. [R.total_volume] unit\s remaining.") diff --git a/code/modules/reagents/reagent_containers/dropper.dm b/code/modules/reagents/reagent_containers/dropper.dm index 595ed64dea8da..aeb7c6879fd2a 100644 --- a/code/modules/reagents/reagent_containers/dropper.dm +++ b/code/modules/reagents/reagent_containers/dropper.dm @@ -37,7 +37,7 @@ if(!safe_thing.reagents) safe_thing.create_reagents(100) - reagents.reaction(safe_thing, TOUCH, fraction) + reagents.expose(safe_thing, TOUCH, fraction) trans = reagents.trans_to(safe_thing, amount_per_transfer_from_this, transfered_by = user) target.visible_message("[user] tries to squirt something into [target]'s eyes, but fails!", \ @@ -53,7 +53,7 @@ target.visible_message("[user] squirts something into [target]'s eyes!", \ "[user] squirts something into your eyes!") - reagents.reaction(target, TOUCH, fraction) + reagents.expose(target, TOUCH, fraction) var/mob/M = target var/R if(reagents) diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index 91eae09b1b5e3..16ce40b8f90e8 100755 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -32,7 +32,7 @@ if(isturf(target) && reagents.reagent_list.len && thrownby) log_combat(thrownby, target, "splashed (thrown) [english_list(reagents.reagent_list)]") message_admins("[ADMIN_LOOKUPFLW(thrownby)] splashed (thrown) [english_list(reagents.reagent_list)] on [target] at [ADMIN_VERBOSEJMP(target)].") - reagents.reaction(M, TOUCH) + reagents.expose(M, TOUCH) log_combat(user, M, "splashed", R) reagents.clear_reagents() else @@ -49,7 +49,7 @@ else to_chat(user, "You swallow a gulp of [src].") var/fraction = min(5/reagents.total_volume, 1) - reagents.reaction(M, INGEST, fraction) + reagents.expose(M, INGEST, fraction) addtimer(CALLBACK(reagents, TYPE_PROC_REF(/datum/reagents, trans_to), M, 5), 5) playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1) @@ -89,7 +89,7 @@ if(user.a_intent == INTENT_HARM) user.visible_message("[user] splashes the contents of [src] onto [target]!", \ "You splash the contents of [src] onto [target].") - reagents.reaction(target, TOUCH) + reagents.expose(target, TOUCH) reagents.clear_reagents() /obj/item/reagent_containers/glass/attackby(obj/item/I, mob/user, params) @@ -278,7 +278,7 @@ if (slot == ITEM_SLOT_HEAD) if(reagents.total_volume) to_chat(user, "[src]'s contents spill all over you!") - reagents.reaction(user, TOUCH) + reagents.expose(user, TOUCH) reagents.clear_reagents() reagents.flags = NONE diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index e9e9f590f46d1..8e498dd9d2b0e 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -43,7 +43,7 @@ playsound(loc, pick('sound/items/hypospray.ogg','sound/items/hypospray2.ogg'), 50, TRUE) var/fraction = min(amount_per_transfer_from_this/reagents.total_volume, 1) - reagents.reaction(M, INJECT, fraction) + reagents.expose(M, INJECT, fraction) if(M.reagents) var/trans = 0 if(!infinite) @@ -66,7 +66,7 @@ return if(isturf(usr.loc) && src.loc == usr) to_chat(usr, "You empty \the [src] onto the floor.") - reagents.reaction(usr.loc) + reagents.expose(usr.loc) src.reagents.clear_reagents() /obj/item/reagent_containers/hypospray/CMO diff --git a/code/modules/reagents/reagent_containers/medspray.dm b/code/modules/reagents/reagent_containers/medspray.dm index bcc6dcb8c2a91..47766fc24c1f6 100644 --- a/code/modules/reagents/reagent_containers/medspray.dm +++ b/code/modules/reagents/reagent_containers/medspray.dm @@ -88,7 +88,7 @@ log_combat(user, M, "applied", src, reagents.log_list()) playsound(src, 'sound/effects/spray2.ogg', 50, 1, -6) var/fraction = min(amount_per_transfer_from_this/reagents.total_volume, 1) - reagents.reaction(M, apply_type, fraction, affecting = affecting) + reagents.expose(M, apply_type, fraction, affecting = affecting) reagents.trans_to(M, amount_per_transfer_from_this, transfered_by = user) return diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index 4efc4fbe5c21e..423ff781f9951 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -57,7 +57,7 @@ addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(to_chat), M, "[makes_me_think]"), 5 SECONDS) if(reagents.total_volume) - reagents.reaction(M, apply_type, affecting = affecting) + reagents.expose(M, apply_type, affecting = affecting) reagents.trans_to(M, reagents.total_volume, transfered_by = user) qdel(src) return TRUE diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index ae636947e99ae..d8143b8a3522f 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -113,7 +113,7 @@ return if(isturf(usr.loc) && src.loc == usr) to_chat(usr, "You empty \the [src] onto the floor.") - reagents.reaction(usr.loc) + reagents.expose(usr.loc) src.reagents.clear_reagents() /obj/item/reagent_containers/spray/on_reagent_change(changetype) diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 0f2f8f13a8cb3..0e90f12ddb82d 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -189,7 +189,7 @@ if(CONFIG_GET(flag/biohazards_allowed)) transfer_diseases(L) var/fraction = min(amount_per_transfer_from_this/reagents.total_volume, 1) - reagents.reaction(L, INJECT, fraction) + reagents.expose(L, INJECT, fraction) reagents.trans_to(target, amount_per_transfer_from_this, transfered_by = user) balloon_alert(user, "You inject [amount_per_transfer_from_this]u.") to_chat(user, "You inject [amount_per_transfer_from_this] units of the solution. The syringe now contains [reagents.total_volume] units.") diff --git a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm index 103f411d41e9a..48f358d4389c8 100644 --- a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm +++ b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm @@ -607,7 +607,7 @@ to_chat(owner, "[linked_extract] coats you in a watery goo, extinguishing the flames.") var/obj/O = owner.get_active_held_item() if(O) - O.extinguish() //All shamelessly copied from water's reaction_obj, since I didn't seem to be able to get it here for some reason. + O.extinguish() //All shamelessly copied from water's expose_obj, since I didn't seem to be able to get it here for some reason. O.acid_level = 0 // Monkey cube if(istype(O, /obj/item/food/monkeycube)) diff --git a/code/modules/surgery/dental_implant.dm b/code/modules/surgery/dental_implant.dm index 0b448fa3906cc..8278ef8e4d825 100644 --- a/code/modules/surgery/dental_implant.dm +++ b/code/modules/surgery/dental_implant.dm @@ -40,7 +40,7 @@ to_chat(owner, "You grit your teeth and burst the implanted [target.name]!") log_combat(owner, null, "swallowed an implanted pill", target) if(target.reagents.total_volume) - target.reagents.reaction(owner, INGEST) + target.reagents.expose(owner, INGEST) target.reagents.trans_to(owner, target.reagents.total_volume, transfered_by = owner) qdel(target) return TRUE From b923241872592d9a245e963c8e5face35121b1d3 Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 04:59:09 -0400 Subject: [PATCH 11/17] reagent transfer fix --- code/game/atoms.dm | 5 ++--- code/game/objects/items/storage/belt.dm | 19 +++++++++++++++++++ code/game/objects/objs.dm | 5 ++--- code/game/turfs/turf_integrity.dm | 5 ++--- code/modules/mob/living/living_defense.dm | 5 ++--- code/modules/reagents/chemistry/holder.dm | 9 +++++---- .../chemistry/reagents/medicine_reagents.dm | 3 ++- 7 files changed, 34 insertions(+), 17 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 1f5152e3abe5c..33267c0d25c5f 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -540,13 +540,12 @@ CREATION_TEST_IGNORE_SUBTYPES(/atom) * - show_message: Whether to display anything to mobs when they are exposed. */ /atom/proc/expose_reagents(list/reagents, datum/reagents/source, method=TOUCH, volume_modifier=1, show_message=TRUE) - . = SEND_SIGNAL(src, COMSIG_ATOM_EXPOSE_REAGENTS, reagents, source, method, volume_modifier, show_message) - if(. & COMPONENT_NO_EXPOSE_REAGENTS) + if((. = SEND_SIGNAL(src, COMSIG_ATOM_EXPOSE_REAGENTS, reagents, source, method, volume_modifier, show_message)) & COMPONENT_NO_EXPOSE_REAGENTS) return for(var/reagent in reagents) var/datum/reagent/R = reagent - . |= R.expose_atom(src, reagents[R] || (R.volume * volume_modifier)) + . |= R.expose_atom(src, reagents[R]) /// Is this atom grindable to get reagents /atom/proc/is_grindable() diff --git a/code/game/objects/items/storage/belt.dm b/code/game/objects/items/storage/belt.dm index 20589f52313a8..c387fbd98418b 100644 --- a/code/game/objects/items/storage/belt.dm +++ b/code/game/objects/items/storage/belt.dm @@ -564,6 +564,25 @@ new /obj/item/multitool/abductor(src) new /obj/item/stack/cable_coil/white(src) +//Im pissed off at the amount of times I have to do this. So its a belt now +/obj/item/storage/belt/military/abductor/med + name = "agent belt" + desc = "A belt used by abductor agents." + icon = 'icons/obj/abductor.dmi' + icon_state = "belt" + item_state = "security" + worn_icon_state = "security" + +/obj/item/storage/belt/military/abductor/med/PopulateContents() + new /obj/item/scalpel/alien(src) + new /obj/item/hemostat/alien(src) + new /obj/item/retractor/alien(src) + new /obj/item/circular_saw/alien(src) + new /obj/item/surgicaldrill/alien(src) + new /obj/item/cautery/alien(src) + new /obj/item/surgical_drapes(src) + new /obj/item/blood_filter(src) + /obj/item/storage/belt/military/army name = "army belt" desc = "A belt used by military forces." diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 708a0c25dbac5..045627629c509 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -438,13 +438,12 @@ CREATION_TEST_IGNORE_SELF(/obj) /// Handles exposing an object to reagents. /obj/expose_reagents(list/reagents, datum/reagents/source, method=TOUCH, volume_modifier=1, show_message=TRUE) - . = ..() - if(. & COMPONENT_NO_EXPOSE_REAGENTS) + if((. = ..()) & COMPONENT_NO_EXPOSE_REAGENTS) return for(var/reagent in reagents) var/datum/reagent/R = reagent - R.expose_obj(src, reagents[R] || (R.volume * volume_modifier)) + . |= R.expose_obj(src, reagents[R]) ///attempt to freeze this obj if possible. returns TRUE if it succeeded, FALSE otherwise. /obj/proc/freeze() diff --git a/code/game/turfs/turf_integrity.dm b/code/game/turfs/turf_integrity.dm index 699eb9d3bee3b..67f2dcf787fe5 100644 --- a/code/game/turfs/turf_integrity.dm +++ b/code/game/turfs/turf_integrity.dm @@ -418,13 +418,12 @@ /// Handles exposing a turf to reagents. /turf/expose_reagents(list/reagents, datum/reagents/source, method=TOUCH, volume_modifier=1, show_message=TRUE) - . = ..() - if(. & COMPONENT_NO_EXPOSE_REAGENTS) + if((. = ..()) & COMPONENT_NO_EXPOSE_REAGENTS) return for(var/reagent in reagents) var/datum/reagent/R = reagent - . |= R.expose_turf(src, reagents[R] || (R.volume * volume_modifier)) + . |= R.expose_turf(src, reagents[R]) /turf/proc/burn_tile() return diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 54eaadcbf5421..203c6e4cc6efa 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -621,8 +621,7 @@ * If the method is VAPOR it incorporates permiability protection. */ /mob/living/expose_reagents(list/reagents, datum/reagents/source, method=TOUCH, volume_modifier=1, show_message=TRUE) - . = ..() - if(. & COMPONENT_NO_EXPOSE_REAGENTS) + if((. = ..()) & COMPONENT_NO_EXPOSE_REAGENTS) return if(method == INGEST) @@ -631,4 +630,4 @@ var/touch_protection = (method == VAPOR) ? get_permeability_protection() : 0 for(var/reagent in reagents) var/datum/reagent/R = reagent - . |= R.expose_mob(src, method, reagents[R] || (R.volume * volume_modifier), show_message, touch_protection) + . |= R.expose_mob(src, method, reagents[R], show_message, touch_protection) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 3662e72c1fa65..35c0a6cb45efe 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -706,12 +706,13 @@ if(isnull(A)) return null - if(!istype(R)) + if(ispath(R)) R = get_reagent(R) - if(isnull(R)) - return null + if(isnull(R)) + return null - return A.expose_reagents(list(R = R.volume * volume_modifier), src, method, volume_modifier, show_message) + // Yes, we need the parentheses. + return A.expose_reagents(list((R) = R.volume * volume_modifier), src, method, volume_modifier, show_message) /// Is this holder full or not /datum/reagents/proc/holder_full() diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index b1a69398d4668..74d2aba307c69 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -442,7 +442,8 @@ if(M.stat == DEAD) show_message = FALSE if(method == PATCH) - if(affecting.heal_damage(reac_volume, reac_volume)) + //you could be targeting a limb that doesnt exist while applying the patch, so lets avoid a runtime + if(affecting?.heal_damage(brute = reac_volume, burn = reac_volume)) M.update_damage_overlays() M.adjustStaminaLoss(reac_volume*2) if(show_message) From 34d0ae28eda9a21f5296abaeafc841fc8f04ca31 Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 05:30:38 -0400 Subject: [PATCH 12/17] fixing jupyter's shit --- code/game/machinery/iv_drip.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index d97a421c71fda..02a402d59ff4c 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -147,7 +147,7 @@ if(istype(beaker, /obj/item/reagent_containers/blood)) // speed up transfer on blood packs transfer_amount *= 2 - beaker.reagents.trans_to(attached, transfer_amount, method = INJECT, show_message = FALSE) //make reagents reacts, but don't spam messages + beaker.reagents.trans_to(attached, transfer_amount * delta_time * 0.5, methods = INJECT, show_message = FALSE) //make reagents reacts, but don't spam messages update_icon() // Take blood From 1dea661f4ed68f318e6a213ec9b490e4d2de7d79 Mon Sep 17 00:00:00 2001 From: RKz Date: Sun, 15 Sep 2024 05:34:27 -0400 Subject: [PATCH 13/17] bad pathing --- code/game/machinery/iv_drip.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index 02a402d59ff4c..a8ef92aa67005 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -147,7 +147,7 @@ if(istype(beaker, /obj/item/reagent_containers/blood)) // speed up transfer on blood packs transfer_amount *= 2 - beaker.reagents.trans_to(attached, transfer_amount * delta_time * 0.5, methods = INJECT, show_message = FALSE) //make reagents reacts, but don't spam messages + beaker.reagents.trans_to(attached, transfer_amount * delta_time * 0.5, method = INJECT, show_message = FALSE) //make reagents reacts, but don't spam messages update_icon() // Take blood From 9826ec53b361464d0e29c45e5af4789e2c84535e Mon Sep 17 00:00:00 2001 From: RKz Date: Thu, 9 Jan 2025 10:08:26 -0500 Subject: [PATCH 14/17] clean up --- code/modules/reagents/chemistry/holder.dm | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 35c0a6cb45efe..971b14e37e276 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -529,7 +529,7 @@ if(cached_my_atom.type == C.required_container) matching_container = 1 if (isliving(cached_my_atom) && !C.mob_react) //Makes it so certain chemical reactions don't occur in mobs - return + matching_container = FALSE if(!C.required_other) matching_other = 1 @@ -638,7 +638,6 @@ qdel(R) if(my_atom) my_atom.on_reagent_change(DEL_REAGENT) - return 1 /// Updates [/datum/reagents/var/total_volume] /datum/reagents/proc/update_total() @@ -651,17 +650,14 @@ else total_volume += R.volume - return 0 /// Removes all reagents /datum/reagents/proc/clear_reagents() var/list/cached_reagents = reagent_list - for(var/reagent in cached_reagents) - var/datum/reagent/R = reagent - del_reagent(R.type) + for(var/datum/reagent/reagent as anything in cached_reagents) + del_reagent(reagent.type) if(my_atom) my_atom.on_reagent_change(CLEAR_REAGENTS) - return 0 //Checks if the reaction is valid for IPC /datum/reagents/proc/reaction_check(mob/living/M, datum/reagent/R) @@ -860,17 +856,14 @@ Needs metabolizing takes into consideration if the chemical is metabolizing when if (R.type == reagent) if(!amount) if(needs_metabolizing && !R.metabolizing) - return + return FALSE return R else if(round(R.volume, CHEMICAL_QUANTISATION_LEVEL) >= amount) if(needs_metabolizing && !R.metabolizing) - return + return FALSE return R - else - return - - return + return FALSE /// Get the amount of this reagen /datum/reagents/proc/get_reagent_amount(reagent) @@ -879,7 +872,6 @@ Needs metabolizing takes into consideration if the chemical is metabolizing when var/datum/reagent/R = _reagent if (R.type == reagent) return round(R.volume, CHEMICAL_QUANTISATION_LEVEL) - return 0 /// Get a comma separated string of every reagent name in this holder From 2fde9b06e9e106eed222e665e0cb20ab6dce4bec Mon Sep 17 00:00:00 2001 From: RKz Date: Thu, 9 Jan 2025 10:59:11 -0500 Subject: [PATCH 15/17] fixes the issue --- code/modules/reagents/chemistry/holder.dm | 41 ++++++++++----------- code/modules/reagents/reagent_containers.dm | 18 ++++----- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 971b14e37e276..5ba87c23b5218 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -114,14 +114,14 @@ /// Remove an amount of reagents without caring about what they are /datum/reagents/proc/remove_any(amount = 1) var/list/cached_reagents = reagent_list - var/total_transfered = 0 + var/total_removed = 0 var/current_list_element = 1 var/initial_list_length = cached_reagents.len //stored here because removing can cause some reagents to be deleted, ergo length change. current_list_element = rand(1, cached_reagents.len) - while(total_transfered != amount) - if(total_transfered >= amount) + while(total_removed != amount) + if(total_removed >= amount) break if(total_volume <= 0 || !cached_reagents.len) break @@ -130,25 +130,24 @@ current_list_element = 1 var/datum/reagent/R = cached_reagents[current_list_element] - var/remove_amt = min(amount-total_transfered,round(amount/rand(2,initial_list_length),round(amount/10,0.01))) //double round to keep it at a somewhat even spread relative to amount without getting funky numbers. + var/remove_amt = min(amount-total_removed,round(amount/rand(2,initial_list_length),round(amount/10,0.01))) //double round to keep it at a somewhat even spread relative to amount without getting funky numbers. //min ensures we don't go over amount. remove_reagent(R.type, remove_amt) current_list_element++ - total_transfered += remove_amt + total_removed += remove_amt update_total() handle_reactions() - return total_transfered //this should be amount unless the loop is prematurely broken, in which case it'll be lower. It shouldn't ever go OVER amount. + return total_removed //this should be amount unless the loop is prematurely broken, in which case it'll be lower. It shouldn't ever go OVER amount. /// Removes all reagents from this holder /datum/reagents/proc/remove_all(amount = 1) var/list/cached_reagents = reagent_list if(total_volume > 0) var/part = amount / total_volume - for(var/reagent in cached_reagents) - var/datum/reagent/R = reagent - remove_reagent(R.type, R.volume * part) + for(var/datum/reagent/reagent as anything in cached_reagents) + remove_reagent(reagent.type, reagent.volume * part) update_total() handle_reactions() @@ -632,10 +631,12 @@ R.metabolizing = FALSE R.on_mob_end_metabolize(mob_consumer) R.on_mob_delete(mob_consumer) + //Clear from relevant lists addiction_list -= R reagent_list -= R qdel(R) + update_total() if(my_atom) my_atom.on_reagent_change(DEL_REAGENT) @@ -643,12 +644,11 @@ /datum/reagents/proc/update_total() var/list/cached_reagents = reagent_list total_volume = 0 - for(var/reagent in cached_reagents) - var/datum/reagent/R = reagent - if(R.volume < 0.1) - del_reagent(R.type) + for(var/datum/reagent/reagent as anything in cached_reagents) + if(reagent.volume < 0.1) + del_reagent(reagent.type) else - total_volume += R.volume + total_volume += reagent.volume /// Removes all reagents @@ -814,7 +814,6 @@ /// Remove a specific reagent /datum/reagents/proc/remove_reagent(reagent, amount, safety)//Added a safety check for the trans_id_to - if(isnull(amount)) amount = 0 CRASH("null amount passed to reagent code") @@ -826,21 +825,19 @@ return FALSE var/list/cached_reagents = reagent_list - - for(var/A in cached_reagents) - var/datum/reagent/R = A - if (R.type == reagent) + for(var/datum/reagent/cached_reagent as anything in cached_reagents) + if (cached_reagent.type == reagent) //clamp the removal amount to be between current reagent amount //and zero, to prevent removing more than the holder has stored - amount = clamp(amount, 0, R.volume) - R.volume -= amount + amount = clamp(amount, 0, cached_reagent.volume) + cached_reagent.volume -= amount update_total() if(!safety)//So it does not handle reactions when it need not to handle_reactions() if(my_atom) my_atom.on_reagent_change(REM_REAGENT) - return TRUE + return TRUE return FALSE /* diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index ecadb3cc4bcba..b1c3547cdd0f8 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -187,17 +187,16 @@ CREATION_TEST_IGNORE_SUBTYPES(/obj/item/reagent_containers) /obj/item/reagent_containers/on_reagent_change(changetype) update_icon() -/obj/item/reagent_containers/update_icon(dont_fill = FALSE) - if(!fill_icon_thresholds || dont_fill) - return ..() - - cut_overlays() +/obj/item/reagent_containers/update_overlays() + . = ..() + if(!fill_icon_thresholds) + return if(!reagents.total_volume) if(label_icon && (name != initial(name) || desc != initial(desc))) var/mutable_appearance/label = mutable_appearance('icons/obj/chemical.dmi', "[label_icon]") - add_overlay(label) - return ..() + . += label + return var/fill_name = fill_icon_state ? fill_icon_state : icon_state var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "[fill_name][fill_icon_thresholds[1]]") @@ -209,11 +208,10 @@ CREATION_TEST_IGNORE_SUBTYPES(/obj/item/reagent_containers) filling.icon_state = "[fill_name][fill_icon_thresholds[i]]" filling.color = mix_color_from_reagents(reagents.reagent_list) - add_overlay(filling) + . += filling if(label_icon && (name != initial(name) || desc != initial(desc))) var/mutable_appearance/label = mutable_appearance('icons/obj/chemical.dmi', "[label_icon]") - add_overlay(label) - return ..() + . += label /obj/item/reagent_containers/extrapolator_act(mob/living/user, obj/item/extrapolator/extrapolator, dry_run = FALSE) // Always attempt to isolate diseases from reagent containers, if possible. From 95b88aecc2e1606efedc23b5068bc0ea48963061 Mon Sep 17 00:00:00 2001 From: RKz Date: Thu, 9 Jan 2025 11:19:54 -0500 Subject: [PATCH 16/17] what a mess --- code/modules/reagents/chemistry/holder.dm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 5ba87c23b5218..e2a8339c35e19 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -639,6 +639,7 @@ update_total() if(my_atom) my_atom.on_reagent_change(DEL_REAGENT) + return 1 /// Updates [/datum/reagents/var/total_volume] /datum/reagents/proc/update_total() @@ -650,6 +651,8 @@ else total_volume += reagent.volume + return 0 + /// Removes all reagents /datum/reagents/proc/clear_reagents() @@ -658,6 +661,7 @@ del_reagent(reagent.type) if(my_atom) my_atom.on_reagent_change(CLEAR_REAGENTS) + return 0 //Checks if the reaction is valid for IPC /datum/reagents/proc/reaction_check(mob/living/M, datum/reagent/R) @@ -853,14 +857,17 @@ Needs metabolizing takes into consideration if the chemical is metabolizing when if (R.type == reagent) if(!amount) if(needs_metabolizing && !R.metabolizing) - return FALSE + return return R else if(round(R.volume, CHEMICAL_QUANTISATION_LEVEL) >= amount) if(needs_metabolizing && !R.metabolizing) - return FALSE + return return R - return FALSE + else + return + + return /// Get the amount of this reagen /datum/reagents/proc/get_reagent_amount(reagent) From df3c34affc6b0acbb8667110fbfe21d20d4c967e Mon Sep 17 00:00:00 2001 From: RKz Date: Sat, 11 Jan 2025 17:27:50 -0500 Subject: [PATCH 17/17] args SUCK --- code/modules/mob/living/living_defense.dm | 4 ++-- code/modules/reagents/chemistry/holder.dm | 18 +++++++++++++----- .../chemistry/reagents/medicine_reagents.dm | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 7bc764b9160b3..e2c7a1d48916e 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -620,7 +620,7 @@ * If the method is INGEST the mob tastes the reagents. * If the method is VAPOR it incorporates permiability protection. */ -/mob/living/expose_reagents(list/reagents, datum/reagents/source, method=TOUCH, volume_modifier=1, show_message=TRUE) +/mob/living/expose_reagents(list/reagents, datum/reagents/source, method=TOUCH, volume_modifier=1, show_message=TRUE, obj/item/bodypart/affecting) if((. = ..()) & COMPONENT_NO_EXPOSE_REAGENTS) return @@ -630,4 +630,4 @@ var/touch_protection = (method == VAPOR) ? getarmor(null, BIO) * 0.01 : 0 for(var/reagent in reagents) var/datum/reagent/R = reagent - . |= R.expose_mob(src, method, reagents[R], show_message, touch_protection) + . |= R.expose_mob(src, method, reagents[R], show_message, touch_protection, affecting) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index e2a8339c35e19..83365cf30a54d 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -680,12 +680,20 @@ can_process = TRUE return can_process +//================================Exposure(to apply reagent effects)====================== /** - * Applies the relevant expose_ proc for every reagent in this holder - * * [/datum/reagent/proc/expose_mob] - * * [/datum/reagent/proc/expose_turf] - * * [/datum/reagent/proc/expose_obj] - */ + * Applies the relevant expose_ proc for every reagent in this holder + * * [/datum/reagent/proc/expose_mob] + * * [/datum/reagent/proc/expose_turf] + * * [/datum/reagent/proc/expose_obj] + * + * Arguments + * - Atom/target: What mob/turf/object is being exposed to reagents? This is your reaction target. + * - Method: What reaction type is the reagent itself going to call on the reaction target? Types are TOUCH, INGEST, VAPOR, PATCH, and INJECT. + * - Volume_modifier: What is the reagent volume multiplied by when exposed? Note that this is called on the volume of EVERY reagent in the base body, so factor in your Maximum_Volume if necessary! + * - Show_message: Whether to display anything to mobs when they are exposed. + * - + */ /datum/reagents/proc/expose(atom/A, method = TOUCH, volume_modifier = 1, show_message = 1, obj/item/bodypart/affecting) if(isnull(A)) return null diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 470cf0720c206..26739528dbe87 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -442,7 +442,7 @@ show_message = FALSE if(method == PATCH) //you could be targeting a limb that doesnt exist while applying the patch, so lets avoid a runtime - if(affecting?.heal_damage(brute = reac_volume, burn = reac_volume)) + if(affecting.heal_damage(brute = reac_volume, burn = reac_volume)) M.update_damage_overlays() M.adjustStaminaLoss(reac_volume*2) if(show_message)