Skip to content

Commit

Permalink
Metabolism changes (#8142)
Browse files Browse the repository at this point in the history
* temp commit

* lovely screwed branches

* better

* me dumb

* removed math that caused a bug with synaptizine

* made the math more sane to look at

* removed the reagent clamp

* made bleeding take heart efficiency into account
  • Loading branch information
RikuTheKiller authored Jun 16, 2023
1 parent b2d7a20 commit c8f0121
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 40 deletions.
3 changes: 0 additions & 3 deletions code/__DEFINES/chemistry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@

#define REAGENTS_OVERDOSE 30

#define REAGENTS_MIN_EFFECT_MULTIPLIER 0.2
#define REAGENTS_MAX_EFFECT_MULTIPLIER 2.5

#define CHEM_SYNTH_ENERGY 3000 // How much energy does it take to synthesize 1 unit of chemical, in Joules.

#define CE_STABLE "stabilization" // Inaprovaline
Expand Down
1 change: 1 addition & 0 deletions code/modules/organs/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
blood_max += W.damage * WOUND_BLEED_MULTIPLIER
if (temp.open)
blood_max += OPEN_ORGAN_BLEED_AMOUNT //Yer stomach is cut open
blood_max *= get_organ_efficiency(OP_HEART) //Hey check out how hard I can bleed

// bloodclotting slows bleeding
if(chem_effects[CE_BLOODCLOT])
Expand Down
69 changes: 32 additions & 37 deletions code/modules/reagents/reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,49 +66,44 @@

/datum/reagent/proc/consumed_amount(mob/living/carbon/M, alien, location)
if(ishuman(M))
return consumed_amount_human(M, alien,location) // Since humans should scale off livers , hearts and stomachs
return consumed_amount_human(M, alien,location) // Humans have additional metabolism changes based on their organs.

var/removed = metabolism
if(location == CHEM_INGEST)
if(ingest_met)
removed = ingest_met
else
removed = removed/2
if(touch_met && (location == CHEM_TOUCH))
removed = touch_met
// on half of overdose, chemicals will start be metabolized faster,
// also blood circulation affects chemical strength (meaining if target has low blood volume or has something that lowers blood circulation chemicals will be consumed less and effect will diminished)
if(location == CHEM_BLOOD)
if(!constant_metabolism)
if(overdose)
removed = CLAMP(metabolism * volume/(overdose/2) * M.get_blood_circulation()/100, metabolism * REAGENTS_MIN_EFFECT_MULTIPLIER, metabolism * REAGENTS_MAX_EFFECT_MULTIPLIER)
else
removed = CLAMP(metabolism * volume/(REAGENTS_OVERDOSE/2) * M.get_blood_circulation()/100, metabolism * REAGENTS_MIN_EFFECT_MULTIPLIER, metabolism * REAGENTS_MAX_EFFECT_MULTIPLIER)
removed = max(round(removed, 0.01), 0.01)
removed = min(removed, volume)

switch(location)
if(CHEM_INGEST)
removed = ingest_met ? ingest_met : removed * 0.5
if(CHEM_TOUCH)
removed = touch_met ? touch_met : removed

// The faster the blood circulation, the faster the reagents process. Blood volume affects blood circulation as well, leading to diminished effects.
if(!constant_metabolism && (location == CHEM_BLOOD || location == CHEM_INGEST))
removed *= M.get_blood_circulation()/100

removed = CLAMP(removed, 0, volume)

return removed

/datum/reagent/proc/consumed_amount_human(mob/living/carbon/human/consumer, alien, location)
var/removed = metabolism
if(location == CHEM_INGEST)
var/calculated_buff = ((consumer.get_organ_efficiency(OP_LIVER) + consumer.get_organ_efficiency(OP_HEART) + consumer.get_organ_efficiency(OP_STOMACH)) / 3) / 100
if(ingest_met)
removed = ingest_met * calculated_buff
else
removed = (metabolism / 2) * calculated_buff
if(touch_met && (location == CHEM_TOUCH))
removed = touch_met // This doesn't get a buff , there is no organ that can count for this , really.
// on half of overdose, chemicals will start be metabolized faster,
// also blood circulation affects chemical strength (meaining if target has low blood volume or has something that lowers blood circulation chemicals will be consumed less and effect will diminished)
if(location == CHEM_BLOOD)
var/calculated_buff = ((consumer.get_organ_efficiency(OP_LIVER) + consumer.get_organ_efficiency(OP_HEART) * 2) / 3) / 100
if(!constant_metabolism)
if(overdose)
removed = CLAMP(metabolism * volume/(overdose/2) * consumer.get_blood_circulation()/100 * calculated_buff, metabolism * REAGENTS_MIN_EFFECT_MULTIPLIER, metabolism * REAGENTS_MAX_EFFECT_MULTIPLIER)
else
removed = CLAMP(metabolism * volume/(REAGENTS_OVERDOSE/2) * consumer.get_blood_circulation()/100 * calculated_buff, metabolism * REAGENTS_MIN_EFFECT_MULTIPLIER, metabolism * REAGENTS_MAX_EFFECT_MULTIPLIER)
removed = max(round(removed, 0.01), 0.01)
removed = min(removed, volume)
var/calculated_buff = 1

switch(location)
if(CHEM_INGEST)
calculated_buff = ((consumer.get_organ_efficiency(OP_LIVER) + consumer.get_organ_efficiency(OP_HEART) + consumer.get_organ_efficiency(OP_STOMACH)) / 3) / 100
removed = ingest_met ? ingest_met : removed * 0.5
if(CHEM_TOUCH)
removed = touch_met ? touch_met : removed // This isn't directly affected by any of the existing organs.
if(CHEM_BLOOD)
calculated_buff = ((consumer.get_organ_efficiency(OP_LIVER) + consumer.get_organ_efficiency(OP_HEART) * 2) / 3) / 100

removed *= calculated_buff

// The faster the blood circulation, the faster the reagents process. Blood volume affects blood circulation as well, leading to diminished effects.
if(!constant_metabolism && (location == CHEM_BLOOD || location == CHEM_INGEST))
removed *= consumer.get_blood_circulation()/100

removed = CLAMP(removed, 0, volume)

return removed

Expand Down

0 comments on commit c8f0121

Please sign in to comment.