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.
This commit is contained in:
VMSolidus
2026-07-12 20:45:24 +00:00
committed by GitHub
parent 48d8a06d1c
commit e117ef3f87
44 changed files with 310 additions and 216 deletions
+1 -1
View File
@@ -87,7 +87,7 @@
if(!B.can_prepare)
to_chat(user, SPAN_WARNING("\The [B] is incompatible with [src]!"))
return
if(B.damage >= B.max_damage)
if(B.get_damage() >= B.max_damage)
to_chat(user, SPAN_WARNING("That brain is well and truly dead."))
return
else if(!B.brainmob)
+3 -3
View File
@@ -256,16 +256,16 @@ and some alternative things that are toxic to other life, such as radium and mut
if (life_tick % LIFETICK_INTERVAL_LESS == 0)
if (bad_internal_organs.len)
for (var/obj/item/organ/O in bad_internal_organs)
var/CL = O.damage
var/CL = O.get_damage()
var/value
if(total_radiation > 0)
value = min(CL, total_radiation, 2 * DS.healing_factor * LIFETICK_INTERVAL_LESS)
O.damage += value/-1.5
O.add_damage(value/-1.5)
total_radiation -= value
CL = getCloneLoss()
value = min(CL, DS.stored_energy, 1 * DS.healing_factor * LIFETICK_INTERVAL_LESS)
O.damage += value/-3
O.add_damage(value/-3)
DS.stored_energy -= value
//Last up, growing brand new limbs and organs to replace those lost or removed.
@@ -114,9 +114,10 @@
if(!O)
to_chat(usr, SPAN_WARNING("\The [H] doesn't have that organ!"))
return
var/organ_damage = O.get_damage()
switch(params["action"])
if("damage")
var/damage_dealt = tgui_input_number(usr, "How much damage do you want to deal? (Current Damage: [O.damage])", "Brute Damage")
var/damage_dealt = tgui_input_number(usr, "How much damage do you want to deal? (Current Damage: [organ_damage])", "Brute Damage")
if(damage_dealt)
O.take_internal_damage(damage_dealt)
log_and_message_admins("used the Damage Menu to deal [damage_dealt] [params["action"]] to [H]'s [params["name"]]", usr, get_turf(H))
@@ -129,12 +130,12 @@
O.decrease_germ_level()
log_and_message_admins("used the Damage Menu to decrease the infection level of [H]'s [params["name"]]", usr, get_turf(H))
if("bruise")
if(O.damage < O.min_bruised_damage)
O.take_damage(O.damage + (O.min_bruised_damage - O.damage) + 1)
if(organ_damage < O.min_bruised_damage)
O.take_damage(organ_damage + (O.min_bruised_damage - organ_damage) + 1)
log_and_message_admins("used the Damage Menu to bruise [H]'s [params["name"]]", usr, get_turf(H))
if("break")
if(O.damage < O.min_broken_damage)
O.take_damage(O.damage + (O.min_broken_damage - O.damage) + 1)
if(organ_damage < O.min_broken_damage)
O.take_damage(organ_damage + (O.min_broken_damage - organ_damage) + 1)
log_and_message_admins("used the Damage Menu to break [H]'s [params["name"]]", usr, get_turf(H))
if("remove")
O.removed(H)
@@ -1128,7 +1128,7 @@
..()
if(should_have_organ(BP_STOMACH))
var/obj/item/organ/internal/stomach/stomach = internal_organs_by_name[BP_STOMACH]
if(!stomach || stomach.is_broken() || (stomach.is_bruised() && prob(stomach.damage)))
if(!stomach || stomach.is_broken() || (stomach.is_bruised() && prob(stomach.get_damage())))
if(should_have_organ(BP_HEART))
vessel.trans_to_obj(vomit, 5)
else
@@ -44,7 +44,7 @@
if(should_have_organ(BP_BRAIN) && internal_organs_by_name)
var/obj/item/organ/internal/brain/sponge = internal_organs_by_name[BP_BRAIN]
if(sponge)
sponge.damage = min(max(amount, 0),sponge.species.total_health)
sponge.set_damage(min(max(amount, 0),sponge.species.total_health))
updatehealth()
/mob/living/carbon/human/getBrainLoss()
@@ -63,7 +63,7 @@
if(sponge.status & ORGAN_DEAD)
return sponge.species.total_health
else
return sponge.damage
return sponge.get_damage()
else
return species.total_health
return 0
@@ -223,6 +223,9 @@
if(kidneys)
pick_organs -= kidneys
pick_organs.Insert(1, kidneys)
if (!heal)
// Kindly inform the kidneys that there's going to be poison to remove. :)
START_PROCESSING(SSprocessing, kidneys)
var/obj/item/organ/internal/liver/liver = null
@@ -247,15 +250,16 @@
break
if(BP_IS_ROBOTIC(I))
continue //Chems won't help, you need surgery to fix robot organs
var/organ_damage = I.get_damage()
if(heal)
if(I.damage < amount)
amount -= I.damage
I.damage = 0
if(organ_damage < amount)
amount -= organ_damage
I.set_damage(0)
else
I.damage -= amount
I.add_damage(-amount)
amount = 0
else
var/cap_dam = I.max_damage - I.damage
var/cap_dam = I.max_damage - organ_damage
if(amount >= cap_dam)
I.take_internal_damage(cap_dam, silent=TRUE)
amount -= cap_dam
@@ -195,7 +195,7 @@
if(!brain || stat == DEAD || (status_flags & FAKEDEATH))
brain_result = 0
else if(stat != DEAD)
brain_result = round(max(0,(1 - brain.damage/brain.max_damage)*100))
brain_result = round(max(0,(1 - brain.get_damage()/brain.max_damage)*100))
else
brain_result = -1
return brain_result
+1 -1
View File
@@ -470,7 +470,7 @@
for(var/obj/item/organ/external/O in organs)
if(QDELETED(O))
continue
if((O.damage + LOW_PRESSURE_DAMAGE) < O.max_damage)
if((O.get_damage() + LOW_PRESSURE_DAMAGE) < O.max_damage)
O.take_damage(brute = LOW_PRESSURE_DAMAGE, used_weapon = "Low Pressure")
if(getOxyLoss() < 55)
adjustOxyLoss(4)
@@ -103,7 +103,7 @@
for(var/obj/item/organ/I in H.internal_organs)
if((I.status & ORGAN_DEAD) || BP_IS_ROBOTIC(I))
continue
if(I.damage > 2)
if(I.get_damage() > 2)
if(prob(2))
var/obj/item/organ/external/parent = H.get_organ(I.parent_organ)
H.custom_emote(VISIBLE_MESSAGE, "clutches [H.get_pronoun("his")] [parent.name]!")
@@ -506,5 +506,5 @@
if(istype(voice_synth))
if(voice_synth.is_bruised())
// at most, 30 * 2 + 10 = 70, which is the maximum value we can use for Gibberish
message = Gibberish(message, voice_synth.damage * 2 + (voice_synth.is_broken() ? 10 : 0))
message = Gibberish(message, voice_synth.get_damage() * 2 + (voice_synth.is_broken() ? 10 : 0))
return list(HSP_MSG = message, HSP_VERB = pick(list("crackles", "buzzes")))
+2 -2
View File
@@ -557,8 +557,8 @@ default behaviour is:
if(repair_brain && should_have_organ(BP_BRAIN))
repair_brain = FALSE
var/obj/item/organ/internal/brain/brain = internal_organs_by_name[BP_BRAIN]
if(brain.damage > (brain.max_damage/2))
brain.damage = (brain.max_damage/2)
if(brain.get_damage() > (brain.max_damage/2))
brain.set_damage(brain.max_damage/2)
if(brain.status & ORGAN_DEAD)
brain.status &= ~ORGAN_DEAD
START_PROCESSING(SSprocessing, brain)
@@ -107,7 +107,7 @@
if(machine_organ.get_integrity() < 100)
to_chat(user, "<font color='#FFA500'><b>[machine_organ.name]:</b> Integrity damage detected.</font>")
found_damage = TRUE
else if(O.damage)
else if(O.get_damage())
to_chat(user, SPAN_WARNING("<b>[O.name]:</b> Core damage detected."))
found_damage = TRUE
if(!found_damage)