diff --git a/code/modules/mob/_modifiers/modifiers.dm b/code/modules/mob/_modifiers/modifiers.dm
index 115acb1b3e9..6e738094a12 100644
--- a/code/modules/mob/_modifiers/modifiers.dm
+++ b/code/modules/mob/_modifiers/modifiers.dm
@@ -45,6 +45,8 @@
var/icon_scale_percent // Makes the holder's icon get scaled up or down.
var/attack_speed_percent // Makes the holder's 'attack speed' (click delay) shorter or longer.
var/pain_immunity // Makes the holder not care about pain while this is on. Only really useful to human mobs.
+ var/pulse_modifier // Modifier for pulse, will be rounded on application, then added to the normal 'pulse' multiplier which ranges between 0 and 5 normally. Only applied if they're living.
+ var/pulse_set_level // Positive number. If this is non-null, it will hard-set the pulse level to this. Pulse ranges from 0 to 5 normally.
/datum/modifier/New(var/new_holder, var/new_origin)
holder = new_holder
diff --git a/code/modules/mob/_modifiers/modifiers_misc.dm b/code/modules/mob/_modifiers/modifiers_misc.dm
index fc714f30f81..42dd125d8b5 100644
--- a/code/modules/mob/_modifiers/modifiers_misc.dm
+++ b/code/modules/mob/_modifiers/modifiers_misc.dm
@@ -268,3 +268,17 @@ the artifact triggers the rage.
if(L.get_poison_protection() >= 1)
return FALSE
return TRUE
+<<<<<<< HEAD
+=======
+
+// Pulse modifier.
+/datum/modifier/false_pulse
+ name = "false pulse"
+ desc = "Your blood flows, despite all other factors."
+
+ on_created_text = "You feel alive."
+ on_expired_text = "You feel.. different."
+ stacks = MODIFIER_STACK_EXTEND
+
+ pulse_set_level = PULSE_NORM
+>>>>>>> 3661d6f... Merge pull request #6081 from Mechoid/PulseBasedReagentProcessing
diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm
index 6b15fc069ee..32cc8939bc3 100644
--- a/code/modules/mob/living/carbon/human/life.dm
+++ b/code/modules/mob/living/carbon/human/life.dm
@@ -1550,20 +1550,67 @@
/mob/living/carbon/human/proc/handle_pulse()
if(life_tick % 5) return pulse //update pulse every 5 life ticks (~1 tick/sec, depending on server load)
- if(!internal_organs_by_name[O_HEART])
- return PULSE_NONE //No blood, no pulse.
-
- if(stat == DEAD)
- return PULSE_NONE //that's it, you're dead, nothing can influence your pulse
-
var/temp = PULSE_NORM
+ var/modifier_shift = 0
+ var/modifier_set
+
+ if(modifiers && modifiers.len)
+ for(var/datum/modifier/mod in modifiers)
+ if(isnull(modifier_set) && !isnull(mod.pulse_set_level))
+ modifier_set = round(mod.pulse_set_level) // Should be a whole number, but let's not take chances.
+ else if(mod.pulse_set_level > modifier_set)
+ modifier_set = round(mod.pulse_set_level)
+
+ modifier_set = max(0, modifier_set) // No setting to negatives.
+
+ if(mod.pulse_modifier)
+ modifier_shift += mod.pulse_modifier
+
+ modifier_shift = round(modifier_shift)
+
+ if(!internal_organs_by_name[O_HEART])
+ temp = PULSE_NONE
+ if(!isnull(modifier_set))
+ temp = modifier_set
+ return temp //No blood, no pulse.
+
+ if(stat == DEAD)
+ temp = PULSE_NONE
+ if(!isnull(modifier_set))
+ temp = modifier_set
+ return temp //that's it, you're dead, nothing can influence your pulse, aside from outside means.
+
+ var/obj/item/organ/internal/heart/Pump = internal_organs_by_name[O_HEART]
+
+ if(Pump)
+ temp += Pump.standard_pulse_level - PULSE_NORM
+
if(round(vessel.get_reagent_amount("blood")) <= BLOOD_VOLUME_BAD) //how much blood do we have
- temp = PULSE_THREADY //not enough :(
+ temp = temp + 3 //not enough :(
if(status_flags & FAKEDEATH)
temp = PULSE_NONE //pretend that we're dead. unlike actual death, can be inflienced by meds
+ if(!isnull(modifier_set))
+ temp = modifier_set
+
+ temp = max(0, temp + modifier_shift) // No negative pulses.
+
+ if(Pump)
+ for(var/datum/reagent/R in reagents.reagent_list)
+ if(R.id in bradycardics)
+ if(temp <= Pump.standard_pulse_level + 3 && temp >= Pump.standard_pulse_level)
+ temp--
+ if(R.id in tachycardics)
+ if(temp <= Pump.standard_pulse_level + 1 && temp >= PULSE_NONE)
+ temp++
+ if(R.id in heartstopper) //To avoid using fakedeath
+ temp = PULSE_NONE
+ if(R.id in cheartstopper) //Conditional heart-stoppage
+ if(R.volume >= R.overdose)
+ temp = PULSE_NONE
+ return temp
//handles different chems' influence on pulse
for(var/datum/reagent/R in reagents.reagent_list)
if(R.id in bradycardics)
diff --git a/code/modules/organs/internal/heart.dm b/code/modules/organs/internal/heart.dm
index 10fdcada69c..b65b3bc7098 100644
--- a/code/modules/organs/internal/heart.dm
+++ b/code/modules/organs/internal/heart.dm
@@ -7,6 +7,8 @@
parent_organ = BP_TORSO
dead_icon = "heart-off"
+ var/standard_pulse_level = PULSE_NORM // We run on a normal clock. This is NOT CONNECTED to species heart-rate modifier.
+
/obj/item/organ/internal/heart/handle_germ_effects()
. = ..() //Up should return an infection level as an integer
diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm
index 21775ea17ef..8ad8b6486d6 100644
--- a/code/modules/reagents/Chemistry-Reagents.dm
+++ b/code/modules/reagents/Chemistry-Reagents.dm
@@ -12,6 +12,7 @@
var/list/data = null
var/volume = 0
var/metabolism = REM // This would be 0.2 normally
+ var/list/filtered_organs = list() // Organs that will slow the processing of this chemical.
var/mrate_static = FALSE //If the reagent should always process at the same speed, regardless of species, make this TRUE
var/ingest_met = 0
var/touch_met = 0
@@ -69,6 +70,22 @@
// Metabolism
removed *= active_metab.metabolism_speed
+ if(ishuman(M))
+ var/mob/living/carbon/human/H = M
+ if(H.species.has_organ[O_HEART])
+ var/obj/item/organ/internal/heart/Pump = H.internal_organs_by_name[O_HEART]
+ if(!Pump)
+ removed *= 0.1
+ else if(Pump.standard_pulse_level == PULSE_NONE) // No pulse normally means chemicals process a little bit slower than normal.
+ removed *= 0.8
+ else // Otherwise, chemicals process as per percentage of your current pulse, or, if you have no pulse but are alive, by a miniscule amount.
+ removed *= max(0.1, H.pulse / Pump.standard_pulse_level)
+ if(filtered_organs && filtered_organs.len)
+ for(var/organ_tag in filtered_organs)
+ var/obj/item/organ/internal/O = H.internal_organs_by_name[organ_tag]
+ if(O && !O.is_broken() && prob(max(0, O.max_damage - O.damage)))
+ removed *= 0.8
+
if(ingest_met && (active_metab.metabolism_class == CHEM_INGEST))
removed = ingest_met
if(touch_met && (active_metab.metabolism_class == CHEM_TOUCH))
diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm
index 6595343169e..59716a5493f 100644
--- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm
+++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm
@@ -9,6 +9,7 @@
reagent_state = LIQUID
color = "#CF3600"
metabolism = REM * 0.25 // 0.05 by default. Hopefully enough to get some help, or die horribly, whatever floats your boat
+ filtered_organs = list(O_LIVER, O_KIDNEYS)
var/strength = 4 // How much damage it deals per unit
/datum/reagent/toxin/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
@@ -253,6 +254,7 @@
color = "#669900"
metabolism = REM
strength = 3
+ mrate_static = TRUE
/datum/reagent/toxin/zombiepowder/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
..()
diff --git a/html/changelogs/Mechoid - OrgansAndChems.yml b/html/changelogs/Mechoid - OrgansAndChems.yml
new file mode 100644
index 00000000000..0cc59e11f18
--- /dev/null
+++ b/html/changelogs/Mechoid - OrgansAndChems.yml
@@ -0,0 +1,39 @@
+################################
+# Example Changelog File
+#
+# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
+#
+# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
+# When it is, any changes listed below will disappear.
+#
+# Valid Prefixes:
+# bugfix
+# wip (For works in progress)
+# tweak
+# soundadd
+# sounddel
+# rscadd (general adding of nice things)
+# rscdel (general deleting of nice things)
+# imageadd
+# imagedel
+# maptweak
+# spellcheck (typo fixes)
+# experiment
+#################################
+
+# Your name.
+author: Mechoid
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
+# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - rscadd: "Reagents can now have a list of organs specified to slow their processing."
+ - rscadd: "Reagents now process in the bloodstream at a rate determined by current pulse. No pulse, for any reason, will cause slightly slower processing if your species has a heart."
+ - rscadd: "The heart organ determines the 'standard pulse' if the species has one."
+ - rscadd: "Modifiers can set pulse directly, or shift it."