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
@@ -311,14 +311,15 @@
to_chat(user, SPAN_WARNING("\The [attacking_item] is off."))
return TRUE
if(!damage)
if(health >= maxhealth)
to_chat(user, SPAN_WARNING("\The [src] does not require repairs."))
return TRUE
to_chat(user, SPAN_NOTICE("You begin repairing the damage to \the [src]..."))
playsound(get_turf(src), 'sound/items/Welder.ogg', 100, 1)
var/damage = maxhealth - health
if(WT.use(round(damage / 75)) && do_after(user, damage / 10, src, DO_REPAIR_CONSTRUCT))
damage = 0
health = maxhealth
to_chat(user, SPAN_NOTICE("You fully repair \the [src]."))
update_icon()
return TRUE
@@ -354,6 +355,15 @@
if(do_after(user, 1 SECONDS))
visible_message(SPAN_NOTICE("[user] slots \the [access_cable] into \the [src]."))
universal_port.insert_cable(access_cable, user)
if(user?.a_intent == I_HURT && maxhealth)
user.do_attack_animation(src)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
visible_message(SPAN_DANGER("[user] [pick(attacking_item.attack_verb)] \the [src]!"))
add_damage(attacking_item.force, attacking_item.damage_flags(), attacking_item.damtype, attacking_item.armor_penetration, attacking_item)
playsound(user, 'sound/effects/metalhit.ogg', attacking_item.get_clamped_volume())
return TRUE
return ..()
/obj/item/modular_computer/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)