Files
Bubberstation/code/__HELPERS/honkerblast.dm
Ghom ca2cc70322 Organ damage refactor/cleanup (#93436)
## About The Pull Request
So, my original goal was just a refactor for the emissive overlays of
eyes, as a way to implement the specular emissive introduced by smartkar
some time ago, but somehow I found myself dragged into a bigger refactor
or cleanup of organ damage, thresholds, failures. One of the main
problem was that there were no procs called when a organ suffered enough
damage to fail or when recovering from failure. It'd just enable or
disable a bitflag, leaving it up to subtypes to decide how to tackle
organ failure their own ways: diverse, funky and sometimes incompatible.
More often than not relying on their very own "update_thingamajig" kinda
procs that run whenever the organ takes damage, rather than just when
the threshold is reached (low, high, failure. There are however a couple
organs with their own quirky thresholds, I let those slide).

There's also a bit of old code, especially for ears, with the
`AdjustEarDamage` and temporary deafness both predating the framework
for organ damage as far as I know. It really needed a coat of fresh
paint.

Oh, there were also more than a handful of organs that still heavily
relied on some ORGAN_TRAIT source instead of the `organ_traits` list and
the two add/remove procs `add_organ_trait` or `remove_organ_trait`. This
include organs that lose or gain specific traits when failing et
viceversa.

~~Lastly, felinids (and the halloween ghost species) having reflective
eyes. It's just a nod to the tapetum lucidum that animals with night
vision often have (including cats), which is why their eyes are a bit
brighter in the dark. Felinids however, do not have night vision (nor do
ghosts). This is merely cosmetic.~~ Cut out for the time being due to
issues with the specular emissive...

## Why It's Good For The Game
Refactoring / cleaning up old organ code.

## Changelog

🆑
refactor: Refactored organ damage code a little. Hopefully there won't
be issues (otherwise report them).
/🆑
2025-10-21 16:52:28 -05:00

45 lines
1.7 KiB
Plaintext

///Unleashes a honkerblast similar to the honkmech weapon, but with more granular control.
/proc/honkerblast(atom/origin, light_range = 1, medium_range = 0, heavy_range = 0)
var/origin_turf = get_turf(origin)
var/list/lightly_honked = list()
var/list/properly_honked = list()
var/list/severely_honked = list()
playsound(origin_turf, 'sound/items/airhorn/airhorn.ogg', 100, TRUE)
for(var/mob/living/carbon/victim in hearers(max(light_range, medium_range, heavy_range), origin_turf))
if(!victim.can_hear())
continue
var/distance = get_dist(origin_turf, victim.loc)
if(distance <= heavy_range)
severely_honked += victim
else if(distance <= medium_range)
properly_honked += victim
else if(distance <= light_range)
lightly_honked += victim
for(var/mob/living/carbon/victim in severely_honked)
victim.Unconscious(40)
victim.Stun(100)
victim.adjust_stutter(30 SECONDS)
victim.set_jitter_if_lower(1000 SECONDS)
victim.sound_damage(10, 30 SECONDS)
to_chat(victim, "<font color='red' size='8'>HONK</font>")
var/obj/item/clothing/shoes/victim_shoes = victim.get_item_by_slot(ITEM_SLOT_FEET)
if(!victim_shoes || victim_shoes.fastening_type == SHOES_SLIPON)
continue
victim_shoes.adjust_laces(SHOES_KNOTTED)
for(var/mob/living/carbon/victim in properly_honked)
victim.Paralyze(20)
victim.Stun(50)
victim.set_jitter_if_lower(500 SECONDS)
victim.sound_damage(7, 20 SECONDS)
to_chat(victim, "<font color='red' size='5'>HONK</font>")
for(var/mob/living/carbon/victim in lightly_honked)
victim.Knockdown(20)
victim.set_jitter_if_lower(200 SECONDS)
victim.sound_damage(4, 10 SECONDS)
to_chat(victim, "<font color='red' size='2'>HONK</font>")