Adds an universal object health system. (#21266)

https://www.youtube.com/watch?v=ZpUYjpKg9KY

As per title. The goal is to add health to most objects in the game and
thus allow them to be dynamically destructible, while also avoiding
shitcode like each structure having its own snowflake health update
proc.

---------

Signed-off-by: Matt Atlas <mattiathebest2000@hotmail.it>
Co-authored-by: Matt Atlas <liermattia@gmail.com>
Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com>
This commit is contained in:
Matt Atlas
2026-04-17 01:22:08 +02:00
committed by GitHub
parent 1d2871729f
commit d5931c5ffe
213 changed files with 1448 additions and 1424 deletions
+1 -1
View File
@@ -175,7 +175,7 @@
return
else //and if it's beating, let's see if it should
var/should_stop = prob(80) && circulation < BLOOD_VOLUME_SURVIVE //cardiovascular shock, not enough liquid to pump
should_stop = should_stop || prob(max(0, owner.getBrainLoss() - owner.maxHealth * 0.75)) //brain failing to work heart properly
should_stop = should_stop || prob(max(0, owner.getBrainLoss() - owner.maxhealth * 0.75)) //brain failing to work heart properly
should_stop = should_stop || (prob(fibrillation_stop_risk) && pulse == PULSE_THREADY) //erratic heart patterns, usually caused by oxyloss
should_stop = should_stop || owner.chem_effects[CE_NOPULSE]
if(should_stop) // The heart has stopped due to going into traumatic or cardiovascular shock.
+1 -1
View File
@@ -107,7 +107,7 @@ INITIALIZE_IMMEDIATE(/obj/item/organ)
/obj/item/organ/attack_self(var/mob/user)
return (owner && loc == owner && owner == user)
/obj/item/organ/proc/update_health()
/obj/item/organ/proc/update_organ_health()
return
/obj/item/organ/proc/set_dna(var/datum/dna/new_dna)
+2 -3
View File
@@ -381,9 +381,8 @@
return
remove_verb(owner, /mob/living/carbon/human/proc/undislocate)
/obj/item/organ/external/update_health()
/obj/item/organ/external/update_organ_health()
damage = min(max_damage, (brute_dam + burn_dam))
return
/obj/item/organ/external/replaced(var/mob/living/carbon/human/target)
..()
@@ -685,7 +684,7 @@ This function completely restores a damaged organ to perfect condition.
fluid_loss_severity = FLUIDLOSS_WIDE_BURN
if(INJURY_TYPE_LASER)
fluid_loss_severity = FLUIDLOSS_CONC_BURN
var/fluid_loss = (damage/(owner.maxHealth - GLOB.config.health_threshold_dead)) * DEFAULT_BLOOD_AMOUNT * fluid_loss_severity
var/fluid_loss = (damage/(owner.maxhealth - GLOB.config.health_threshold_dead)) * DEFAULT_BLOOD_AMOUNT * fluid_loss_severity
owner.remove_blood_simple(fluid_loss)
// first check whether we can widen an existing wound