Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 531ed1e

Browse files
committed
minor rework
1 parent acdf759 commit 531ed1e

File tree

3 files changed

+29
-40
lines changed

3 files changed

+29
-40
lines changed

code/modules/mob/living/carbon/human/species_types/polysmorphs.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
coldmod = 0.75
2020
heatmod = 1.5
2121
pressuremod = 0.75 //Xenos are completely pressure immune, they're bargain bin xenos
22+
toxmod = 0.8 //their blood is acid, their liver is pretty used to fucked up things
2223
acidmod = 0.2 //Their blood is literally acid
2324
action_speed_coefficient = 1.1 //claws aren't dextrous like hands
2425
speedmod = -0.1 //apex predator humanoid hybrid

code/modules/reagents/chemistry/reagents/toxin_reagents.dm

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@
88
taste_description = "bitterness"
99
taste_mult = 1.2
1010
evaporation_rate = 3 //6x faster than normal chems
11+
/// Handled by the liver, does full damage for the highest toxpwr, and reduced for every following one
1112
var/toxpwr = 1.5
1213
var/silent_toxin = FALSE //won't produce a pain message when processed by liver/Life(seconds_per_tick = SSMOBS_DT, times_fired) if there isn't another non-silent toxin present.
1314

14-
/datum/reagent/toxin/on_mob_life(mob/living/carbon/M)
15-
if(toxpwr)
16-
M.adjustToxLoss(toxpwr*REM, 0)
17-
. = TRUE
18-
..()
19-
2015
/datum/reagent/toxin/amatoxin
2116
name = "Amatoxin"
2217
description = "A powerful poison derived from certain species of mushroom."

code/modules/surgery/organs/liver.dm

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#define LIVER_DEFAULT_TOX_TOLERANCE 3 //amount of toxins the liver can filter out
2-
#define LIVER_DEFAULT_TOX_LETHALITY 0.01 //lower values lower how harmful toxins are to the liver
1+
#define LIVER_DEFAULT_TOX_LETHALITY 1 //lower values lower how harmful toxins are to the liver
32

43
/obj/item/organ/liver
54
name = "liver"
@@ -12,38 +11,40 @@
1211
maxHealth = STANDARD_ORGAN_THRESHOLD
1312
healing_factor = STANDARD_ORGAN_HEALING
1413
decay_factor = STANDARD_ORGAN_DECAY // smack in the middle of decay times
15-
var/operated = FALSE //whether we can still have our damages fixed through surgery
16-
var/alcohol_tolerance = ALCOHOL_RATE//affects how much damage the liver takes from alcohol
17-
var/toxTolerance = LIVER_DEFAULT_TOX_TOLERANCE//maximum amount of toxins the liver can just shrug off
18-
var/toxLethality = LIVER_DEFAULT_TOX_LETHALITY//affects how much damage toxins do to the liver
19-
var/filterToxins = TRUE //whether to filter toxins
20-
21-
#define HAS_SILENT_TOXIN 0 //don't provide a feedback message if this is the only toxin present
22-
#define HAS_NO_TOXIN 1
23-
#define HAS_PAINFUL_TOXIN 2
14+
/// whether we can still have our damages fixed through surgery
15+
var/operated = FALSE
16+
/// affects how much damage the liver takes from alcohol
17+
var/alcohol_tolerance = ALCOHOL_RATE
18+
/// modifier to toxpwr for liver and toxin damage taken
19+
var/toxLethality = LIVER_DEFAULT_TOX_LETHALITY
2420

2521
/obj/item/organ/liver/on_life()
2622
var/mob/living/carbon/C = owner
2723
..() //perform general on_life()
2824
if(istype(C))
2925
if(!(organ_flags & ORGAN_FAILING))//can't process reagents with a failing liver
3026

31-
var/provide_pain_message = HAS_NO_TOXIN
32-
if(filterToxins && !HAS_TRAIT(owner, TRAIT_TOXINLOVER))
33-
//handle liver toxin filtration
34-
for(var/datum/reagent/toxin/T in C.reagents.reagent_list)
35-
var/thisamount = C.reagents.get_reagent_amount(T.type)
36-
if (thisamount && thisamount <= toxTolerance)
37-
C.reagents.remove_reagent(T.type, 1)
38-
else
39-
damage += (thisamount*toxLethality)
40-
if(provide_pain_message != HAS_PAINFUL_TOXIN)
41-
provide_pain_message = T.silent_toxin ? HAS_SILENT_TOXIN : HAS_PAINFUL_TOXIN
27+
var/provide_pain_message = FALSE
28+
var/damage_multiplier = 1 //reduced for every toxin
29+
var/list/toxpwr = list()
30+
31+
for(var/datum/reagent/toxin/T in C.reagents.reagent_list)
32+
toxpwr += T.toxpwr
33+
provide_pain_message = provide_pain_message || !T.silent_toxin
34+
35+
sort_list(toxpwr, cmp = /proc/cmp_numeric_dsc) //sort all toxpowers scaling from highest to lowest
36+
37+
for(var/dmg in toxpwr)
38+
var/real_damage = dmg * toxLethality * damage_multiplier
39+
damage_multiplier *= 0.5 //reduce the damage dealt for every subsequent toxin
40+
C.adjustToxLoss(real_damage)
41+
if(!HAS_TRAIT(owner, TRAIT_TOXINLOVER)) //don't hurt the liver if they like toxins
42+
damage += (real_damage)
4243

4344
//metabolize reagents
4445
C.reagents.metabolize(C, can_overdose=TRUE)
4546

46-
if(provide_pain_message && damage > 10 && prob(damage/3))//the higher the damage the higher the probability
47+
if(provide_pain_message && damage > 10 && !HAS_TRAIT(owner, TRAIT_TOXINLOVER) && prob(damage/3))//the higher the damage the higher the probability
4748
to_chat(C, span_warning("You feel a dull pain in your abdomen."))
4849
else //for when our liver's failing
4950
C.reagents.end_metabolization(C, keep_liverless = TRUE) //Stops trait-based effects on reagents, to prevent permanent buffs
@@ -57,10 +58,6 @@
5758
if(damage > maxHealth)//cap liver damage
5859
damage = maxHealth
5960

60-
#undef HAS_SILENT_TOXIN
61-
#undef HAS_NO_TOXIN
62-
#undef HAS_PAINFUL_TOXIN
63-
6461
/obj/item/organ/liver/prepare_eat()
6562
var/obj/S = ..()
6663
S.reagents.add_reagent(/datum/reagent/iron, 5)
@@ -84,8 +81,7 @@
8481
name = "alien liver" // doesnt matter for actual aliens because they dont take toxin damage
8582
icon_state = "liver-x" // Same sprite as fly-person liver.
8683
desc = "A liver that used to belong to a killer alien, who knows what it used to eat."
87-
toxLethality = LIVER_DEFAULT_TOX_LETHALITY * 2.5 // rejects its owner early after too much punishment
88-
toxTolerance = 15 // complete toxin immunity like xenos have would be too powerful
84+
toxLethality = LIVER_DEFAULT_TOX_LETHALITY * 0.5
8985

9086
/obj/item/organ/liver/cybernetic
9187
name = "cybernetic liver"
@@ -94,8 +90,7 @@
9490
organ_flags = ORGAN_SYNTHETIC
9591
alcohol_tolerance = 0.001
9692
maxHealth = 2 * STANDARD_ORGAN_THRESHOLD
97-
toxTolerance = 3.3
98-
toxLethality = 0.009
93+
toxLethality = LIVER_DEFAULT_TOX_LETHALITY * 0.9
9994

10095
/obj/item/organ/liver/cybernetic/upgraded
10196
name = "upgraded cybernetic liver"
@@ -104,8 +99,7 @@
10499
alcohol_tolerance = 0.0005
105100
maxHealth = 3 * STANDARD_ORGAN_THRESHOLD //300% health of a normal liver
106101
healing_factor = 2 * STANDARD_ORGAN_HEALING //Can regenerate from damage quicker
107-
toxTolerance = 20
108-
toxLethality = 0.007
102+
toxLethality = LIVER_DEFAULT_TOX_LETHALITY * 0.7
109103

110104
/obj/item/organ/liver/cybernetic/upgraded/on_life()
111105
. = ..()
@@ -125,7 +119,6 @@
125119
attack_verb = list("processed")
126120
desc = "A machine component, installed in the chest. This grants the machine the ability to process chemicals that enter its systems."
127121
alcohol_tolerance = 0
128-
toxTolerance = -1
129122
toxLethality = 0
130123
status = ORGAN_ROBOTIC
131124
compatible_biotypes = ALL_BIOTYPES

0 commit comments

Comments
 (0)