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
+8 -1
View File
@@ -346,6 +346,12 @@
else
return 50 //if the projectile doesn't do damage, play its hitsound at 50% volume
/obj/projectile/proc/get_structure_damage_sound()
if(damage_type == DAMAGE_BRUTE)
return 'sound/effects/metalping.ogg'
else if(damage_type == DAMAGE_BURN)
return pick(SOUNDS_LASER_METAL)
/obj/projectile/proc/on_ricochet(atom/A)
if(!ricochet_auto_aim_angle || !ricochet_auto_aim_range)
return
@@ -1226,7 +1232,7 @@
if(!P || !P.ping_effect)
return
var/image/I = image('icons/obj/projectiles.dmi', src,P.ping_effect,10, pixel_x = pixel_x_offset, pixel_y = pixel_y_offset)
var/image/I = image('icons/obj/projectiles.dmi', src, P.ping_effect, 10, pixel_x = pixel_x_offset, pixel_y = pixel_y_offset)
var/angle = (P.firer && prob(60)) ? round(get_angle(P.firer,src)) : round(rand(1,359))
I.pixel_x += rand(-6,6)
I.pixel_y += rand(-6,6)
@@ -1235,6 +1241,7 @@
rotate.Turn(angle)
I.transform = rotate
// Need to do this in order to prevent the ping from being deleted
playsound(src, P.get_structure_damage_sound(), P.vol_by_damage())
addtimer(CALLBACK(I, TYPE_PROC_REF(/image, flick_overlay), src, 3), 1)
/image/proc/flick_overlay(var/atom/A, var/duration)
@@ -8,6 +8,7 @@
embed = TRUE
sharp = TRUE
shrapnel_type = /obj/item/material/shard/shrapnel
ping_effect = "ping_b"
projectile_piercing = PASSMOB|PASSFLAPS|PASSGRILLE //These are the things it can piece, a number of times up to 'penetrating', if it actually does pierce is decided by projectile/prehit_pierce()
muzzle_type = /obj/effect/projectile/muzzle/bullet