From 47f9d5a2efba83053ffd2c6ccd3e09d116ddd052 Mon Sep 17 00:00:00 2001 From: DGamerL <108773801+DGamerL@users.noreply.github.com> Date: Mon, 29 Dec 2025 06:21:28 +0100 Subject: [PATCH] Kidney overhaul (#31324) * The Kidneying * Oculine --- .../mob/living/carbon/human/human_life.dm | 32 +++++++++++++++++-- .../chemistry/reagents/drinks_reagents.dm | 1 + .../reagents/chemistry/reagents/medicine.dm | 9 ++++++ .../reagents/chemistry/reagents_datum.dm | 3 ++ code/modules/surgery/organs/kidneys.dm | 11 ------- 5 files changed, 42 insertions(+), 14 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_life.dm b/code/modules/mob/living/carbon/human/human_life.dm index f25b9c41406..8dac4c2b2a1 100644 --- a/code/modules/mob/living/carbon/human/human_life.dm +++ b/code/modules/mob/living/carbon/human/human_life.dm @@ -13,6 +13,7 @@ voice = GetVoice() if(.) //not dead + handle_kidneys() if(check_mutations) domutcheck(src) @@ -981,6 +982,31 @@ AdjustLoseBreath(40 SECONDS, bound_lower = 0, bound_upper = 50 SECONDS) adjustOxyLoss(20) -// Need this in species. -//#undef HUMAN_MAX_OXYLOSS -//#undef HUMAN_CRIT_MAX_OXYLOSS +/mob/living/carbon/human/proc/handle_kidneys() + var/obj/item/organ/kidneys = get_int_organ(/obj/item/organ/internal/kidneys) + if(isslimeperson(src)) + kidneys = get_int_organ(/obj/item/organ/internal/brain) + + var/damage_percentage = 0 + if(kidneys && !(kidneys.status & ORGAN_DEAD)) // No kidneys = full damage + damage_percentage = ((kidneys.max_damage - kidneys.damage) / kidneys.max_damage) * 100 + if(damage_percentage >= 75) // Above 75% HP, no damage + return + + var/total_damage = 0 + for(var/datum/reagent/chem as anything in reagents.reagent_list) + total_damage += chem.max_kidney_damage + + if(!total_damage) + return // No damage + + switch(damage_percentage) + // No 0 since that's full damage + if(1 to 25) + total_damage *= 0.5 + if(25 to 50) + total_damage *= 0.2 + if(50 to 75) + total_damage *= 0.05 + + adjustToxLoss(total_damage) diff --git a/code/modules/reagents/chemistry/reagents/drinks_reagents.dm b/code/modules/reagents/chemistry/reagents/drinks_reagents.dm index 4b670bdb2d9..670d2825043 100644 --- a/code/modules/reagents/chemistry/reagents/drinks_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drinks_reagents.dm @@ -1076,6 +1076,7 @@ taste_description = "salt" adj_dizzy = -5 SECONDS process_flags = ORGANIC | SYNTHETIC + max_kidney_damage = 3 /datum/reagent/consumable/drink/electrolytes/on_mob_life(mob/living/M) M.AdjustConfused(-5 SECONDS) diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index 36eebc358ad..8262274d174 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -144,6 +144,7 @@ color = "#8523be" taste_description = "nurturing" goal_difficulty = REAGENT_GOAL_NORMAL + max_kidney_damage = 0 /datum/reagent/medicine/mitocholide/on_mob_life(mob/living/M) if(ishuman(M)) @@ -449,6 +450,7 @@ reagent_state = LIQUID taste_description = "dust" goal_difficulty = REAGENT_GOAL_EASY + max_kidney_damage = 0 /datum/reagent/medicine/charcoal/on_mob_life(mob/living/M) var/update_flags = STATUS_UPDATE_NONE @@ -472,6 +474,7 @@ addiction_threshold = 5 harmless = FALSE taste_description = "health" + max_kidney_damage = 0 /datum/reagent/medicine/omnizine/on_mob_life(mob/living/carbon/human/H) var/update_flags = STATUS_UPDATE_NONE @@ -641,6 +644,7 @@ metabolization_rate = 0.2 taste_description = "safety" goal_difficulty = REAGENT_GOAL_NORMAL + max_kidney_damage = 0 /datum/reagent/medicine/salbutamol/on_mob_life(mob/living/M) var/update_flags = STATUS_UPDATE_NONE @@ -663,6 +667,7 @@ harmless = FALSE taste_description = "oxygenation" goal_difficulty = REAGENT_GOAL_NORMAL + max_kidney_damage = 0 /datum/reagent/medicine/perfluorodecalin/on_mob_life(mob/living/carbon/human/M) var/update_flags = STATUS_UPDATE_NONE @@ -833,6 +838,7 @@ color = "#757377" taste_description = "clarity" goal_difficulty = REAGENT_GOAL_HARD + max_kidney_damage = 0 /datum/reagent/medicine/oculine/on_mob_life(mob/living/M) var/update_flags = STATUS_UPDATE_NONE @@ -1013,6 +1019,7 @@ harmless = FALSE overdose_threshold = 15 goal_difficulty = REAGENT_GOAL_HARD + max_kidney_damage = 4 /datum/reagent/medicine/sanguine_reagent/on_mob_life(mob/living/M) if(!ishuman(M)) @@ -1069,6 +1076,7 @@ harmless = FALSE overdose_threshold = 30 //so a single shotgun dart can't cause the tumor effect goal_difficulty = REAGENT_GOAL_HARD + max_kidney_damage = 4 // So much calcium /datum/reagent/medicine/osseous_reagent/on_mob_life(mob/living/M) var/update_flags = STATUS_UPDATE_NONE @@ -1096,6 +1104,7 @@ color = "#D1D1F1" taste_description = "sweetness" goal_difficulty = REAGENT_GOAL_EASY + max_kidney_damage = 0 /datum/reagent/medicine/mannitol/on_mob_life(mob/living/M) var/update_flags = STATUS_UPDATE_NONE diff --git a/code/modules/reagents/chemistry/reagents_datum.dm b/code/modules/reagents/chemistry/reagents_datum.dm index 823e0a3e4b6..033a878d341 100644 --- a/code/modules/reagents/chemistry/reagents_datum.dm +++ b/code/modules/reagents/chemistry/reagents_datum.dm @@ -55,6 +55,9 @@ /// If we burn in a fire, what color do we have? var/burn_color + /// How much damage can this reagent do when you have no kidneys? + var/max_kidney_damage = 2 + /datum/reagent/Destroy() . = ..() holder = null diff --git a/code/modules/surgery/organs/kidneys.dm b/code/modules/surgery/organs/kidneys.dm index 9d3048beaba..3beca546083 100644 --- a/code/modules/surgery/organs/kidneys.dm +++ b/code/modules/surgery/organs/kidneys.dm @@ -6,17 +6,6 @@ parent_organ = "groin" slot = "kidneys" -/obj/item/organ/internal/kidneys/on_life() - // Coffee is really bad for you with busted kidneys. - // This should probably be expanded in some way, but fucked if I know - // what else kidneys can process in our reagent list. - var/datum/reagent/coffee = locate(/datum/reagent/consumable/drink/coffee) in owner.reagents.reagent_list - if(coffee) - if(is_bruised()) - owner.adjustToxLoss(0.1 * PROCESS_ACCURACY) - else if(is_broken()) - owner.adjustToxLoss(0.3 * PROCESS_ACCURACY) - /obj/item/organ/internal/kidneys/cybernetic name = "cybernetic kidneys" icon_state = "kidneys-c"