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-16 23:22:08 +00:00
committed by GitHub
co-authored by Matt Atlas SleepyGemmy
parent 1d2871729f
commit d5931c5ffe
213 changed files with 1448 additions and 1424 deletions
@@ -37,6 +37,6 @@
if(!..())
return 0
newVars = list("maxHealth" = 20 + spell_levels[Sp_POWER]*5, "health" = 20 + spell_levels[Sp_POWER]*5, "melee_damage_lower" = 10 + spell_levels[Sp_POWER], "melee_damage_upper" = 10 + spell_levels[Sp_POWER]*2)
newVars = list("maxhealth" = 20 + spell_levels[Sp_POWER]*5, "health" = 20 + spell_levels[Sp_POWER]*5, "melee_damage_lower" = 10 + spell_levels[Sp_POWER], "melee_damage_upper" = 10 + spell_levels[Sp_POWER]*2)
return "Your bats are now stronger."
@@ -65,12 +65,12 @@
M.status_flags |= GODMODE //dont want him to die or breathe or do ANYTHING
spawn(duration)
M.status_flags &= ~GODMODE //no more godmode.
var/ratio = trans.health/trans.maxHealth
var/ratio = trans.health/trans.maxhealth
if(ratio <= 0) //if he dead dont bother transforming them.
qdel(M)
return
if(share_damage)
M.adjustBruteLoss(M.maxHealth - round(M.maxHealth*(trans.health/trans.maxHealth))) //basically I want the % hp to be the same afterwards
M.adjustBruteLoss(M.maxhealth - round(M.maxhealth*(trans.health/trans.maxhealth))) //basically I want the % hp to be the same afterwards
if(trans.mind)
trans.mind.transfer_to(M)
else