Files
VMSolidus e117ef3f87 Nuke Limb Processing (#22814)
<img width="1549" height="857" alt="image"
src="https://github.com/user-attachments/assets/3830233d-0635-4942-b2aa-024651e6cffa"
/>

Limbs make up roughly half of the "Per additional player" processing
overhead, while Organs make up most of the other half.
Not every organ is an easy candidate for "Event-only processing", but
external limbs are significantly easier to do so.

So this PR makes it so that External Limbs no longer require Processing
unless an event happens that would justify them requiring processing.
Which SIGNIFICANTLY reduces the overall additional cost to the
Processing subsystem per player that joins the server.

Oh and I also made the Appendix and Kidneys not require constant
processing. The Appendix will only process if it is hit by an
Appendicitis event, and the Kidneys will only process if they are either
damaged, or you get poisoned.
2026-07-12 20:45:24 +00:00

78 lines
3.2 KiB
Plaintext

/obj/item/organ/internal/kidneys
name = "kidneys"
desc = "Found right above the kidshins."
icon_state = "kidneys"
gender = PLURAL
organ_tag = BP_KIDNEYS
parent_organ = BP_GROIN
robotic_name = "prosthetic kidneys"
min_bruised_damage = 25
min_broken_damage = 45
max_damage = 70
relative_size = 10
toxin_type = CE_NEPHROTOXIC
/// The amount of toxin damage to take per second from coffee while the kidneys are bruised.
var/bruised_tox_damage_from_coffee = 0.2
/// The amount of toxin damage to take per second from coffee while the kidneys are broken.
var/broken_tox_damage_from_coffee = 0.6
/// Bruised kidneys will leak up to this amount of potassium into the bloodstream.
var/bruised_max_potassium = 5
/**
* Damaged kidneys leak potassium into the blood when processing any medical chems.
* This is the amount of reagents of potassium per second added to the bloodstream while the kidneys are bruised.
*/
var/bruised_potassium_per_second = 0.1
/// Broken kidneys will leak up to this amount of potassium into the bloodstream. This number should generally be higher than the bruised value.
var/broken_max_potassium = 15
/**
* Damaged kidneys leak potassium into the blood when processing any medical chems.
* This is the amount of reagents of potassium per second added to the bloodstream while the kidneys are broken.
*/
var/broken_potassium_per_second = 4
/// The amount of toxin damage per second taken by a body with broken kidneys.
var/broken_toxin_accumulation_per_second = 0.33
/// The amount of toxin damage per second taken by a body with dead kidneys.
var/dead_toxin_accumulation_per_second = 0.66
/obj/item/organ/internal/kidneys/process(seconds_per_tick)
. = ..()
if(. == PROCESS_KILL || !owner)
return PROCESS_KILL
if(owner.stasis_value > 0) // Decrease the effective tickrate when in stasis.
seconds_per_tick /= owner.stasis_value
// 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.
if(REAGENT_VOLUME(owner.reagents, /singleton/reagent/drink/coffee))
if(is_bruised())
owner.adjustToxLoss(bruised_tox_damage_from_coffee * seconds_per_tick)
else if(is_broken())
owner.adjustToxLoss(broken_tox_damage_from_coffee * seconds_per_tick)
if(is_bruised())
if(REAGENT_VOLUME(reagents, /singleton/reagent/potassium) < bruised_max_potassium)
reagents.add_reagent(/singleton/reagent/potassium, bruised_potassium_per_second * seconds_per_tick)
if(is_broken())
if(REAGENT_VOLUME(owner.reagents, /singleton/reagent/potassium) < broken_max_potassium)
owner.reagents.add_reagent(/singleton/reagent/potassium, broken_potassium_per_second * seconds_per_tick)
//If your kidneys aren't working, your body's going to have a hard time cleaning your blood.
if(!owner.chem_effects[CE_ANTITOXIN]) // Dylovene fully prevents the toxin accumulation from kidneys.
if(is_broken())
owner.adjustToxLoss(broken_toxin_accumulation_per_second * seconds_per_tick)
if(status & ORGAN_DEAD)
owner.adjustToxLoss(dead_toxin_accumulation_per_second * seconds_per_tick)
if (!owner.getToxLoss() && !damage) // None of the conditions triggered, therefore we have healthy kidneys that we don't care about.
return PROCESS_KILL