mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 16:47:13 +01:00
Refactor get_ear_protection() and soundbang_act() to be less bs (#93472)
so, the current `COMSIG_CARBON_SOUNDBANG` signal is kinda lame because: 1) it's relegated to carbon mobs 2) it means ear protection equipment actually has no effect when `get_ear_protection` is called instead. 3) It's sent in more than one place in the code So I replaced it with another signal, this one properly sent in `get_ear_protection`, and therefore `soundbang_act` as well. What's also lame is that the code for both `get_ear_protection` and `soundbang_act` can be easily moved to the living type, and it wouldn't make a huge impact aside causing simple mobs to be stunned very briefly by flashbangs since they cannot be knocked down anyway. The less the code is specific to a subtype, the easier it's to work with, the fewer the paradigms etc. Another lame thing is some of the code being kinda old. Also I wanted to fix an issue with the shriek ling ability detailed in #93401. I wanted to make the ability more consistent with how other sound-related abilities work by making it use `soundbang_act`, but with an intensity higher than any other feature so far, beside point-blank flashbangs (holding on standing on one). I've also buffed the "ear protection" offered by vacuums from 1 to 3, meaning nothing but point-blank flashbangs will go through. Yes, this means shrieks are not good in a vacuum because sound generally propagate in absence of molecules that can transmit the vibration... at least IRL. The game's an approximation anyway, but it's still inconsistent, like a fuckton of other things that are even more outside of the scope of this PR. Well, at least it affects simple/basic mobs too now. ## Why It's Good For The Game This will fix #93401 and make some code less old and bad. ## Changelog 🆑 refactor: refactored code for ear/soundbang protection. Flashbangs and other things can now affect simple/basic mobs as well, not just carbon and occasionally silicons. balance: Aliens are no longer impervious to soundbang_act. Still very resistant to it due to their hardcoded ear protection balance: How the resonant shriek changeling ability works is now slightly more consistent with the ear/soundbang protection, meaning it won't work well in a vacuum, but at least it works on simple mobs now. fix: Everyone can now hear a changeling shriek, unless they're already deafened or in a vacuum. /🆑
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
if(living_mob.stat == DEAD) //They're dead!
|
||||
return
|
||||
living_mob.show_message(span_warning("BANG"), MSG_AUDIBLE)
|
||||
var/distance = max(0, get_dist(get_turf(src), turf))
|
||||
var/distance = get_dist(get_turf(src), turf)
|
||||
var/sweetspot_range = clamp(CEILING(flashbang_range/sweetspot_divider, 1), 0, flashbang_range)
|
||||
|
||||
//Flash
|
||||
@@ -61,19 +61,19 @@
|
||||
living_mob.dropItemToGround(living_mob.get_inactive_held_item())
|
||||
|
||||
//Bang
|
||||
if(!distance || loc == living_mob || loc == living_mob.loc)
|
||||
living_mob.soundbang_act(2, 20 SECONDS, 10, 15)
|
||||
if(!distance)
|
||||
living_mob.soundbang_act(SOUNDBANG_OVERWHELMING, 20 SECONDS, 10, 15)
|
||||
return
|
||||
|
||||
if(distance <= 1) // Adds more stun as to not prime n' pull (#45381)
|
||||
living_mob.soundbang_act(2, 3 SECONDS, 5)
|
||||
living_mob.soundbang_act(SOUNDBANG_STRONG, 3 SECONDS, 5)
|
||||
return
|
||||
|
||||
if(distance <= sweetspot_range)
|
||||
living_mob.soundbang_act(1, max(200 / max(1, distance), 60), rand(0, 5))
|
||||
living_mob.soundbang_act(SOUNDBANG_NORMAL, max(20 SECONDS / max(1, distance), 60), rand(0, 5))
|
||||
return
|
||||
|
||||
if(!living_mob.soundbang_act(1, 0, rand(0, 2)))
|
||||
if(!living_mob.soundbang_act(SOUNDBANG_NORMAL, 0, rand(0, 2)))
|
||||
return
|
||||
|
||||
living_mob.adjust_staggered_up_to(max(200/max(1, distance), 5), 10 SECONDS)
|
||||
@@ -133,17 +133,17 @@
|
||||
if(living_mob.stat == DEAD) //They're dead!
|
||||
return
|
||||
living_mob.show_message(span_warning("POP"), MSG_AUDIBLE)
|
||||
var/distance = max(0, get_dist(get_turf(src), turf))
|
||||
var/distance = get_dist(get_turf(src), turf)
|
||||
//Flash
|
||||
if(living_mob.flash_act(affect_silicon = 1))
|
||||
living_mob.Paralyze(max(10/max(1, distance), 5))
|
||||
living_mob.Knockdown(max(100/max(1, distance), 60))
|
||||
|
||||
//Bang
|
||||
if(!distance || loc == living_mob || loc == living_mob.loc)
|
||||
living_mob.Paralyze(20)
|
||||
living_mob.Knockdown(200)
|
||||
living_mob.soundbang_act(1, 200, 10, 15)
|
||||
if(!distance)
|
||||
living_mob.Paralyze(2 SECONDS)
|
||||
living_mob.Knockdown(20 SECONDS)
|
||||
living_mob.soundbang_act(SOUNDBANG_NORMAL, 200, 10, 15)
|
||||
if(living_mob.apply_damages(brute = 10, burn = 10))
|
||||
to_chat(living_mob, span_userdanger("The blast from \the [src] bruises and burns you!"))
|
||||
|
||||
|
||||
@@ -32,46 +32,38 @@
|
||||
/obj/item/grenade/hypnotic/proc/bang(turf/turf, mob/living/living_mob)
|
||||
if(living_mob.stat == DEAD) //They're dead!
|
||||
return
|
||||
var/distance = max(0, get_dist(get_turf(src), turf))
|
||||
var/distance = get_dist(get_turf(src), turf)
|
||||
|
||||
//Bang
|
||||
var/hypno_sound = FALSE
|
||||
|
||||
//Hearing protection check
|
||||
if(iscarbon(living_mob))
|
||||
var/mob/living/carbon/target = living_mob
|
||||
var/list/reflist = list(1)
|
||||
SEND_SIGNAL(target, COMSIG_CARBON_SOUNDBANG, reflist)
|
||||
var/intensity = reflist[1]
|
||||
var/ear_safety = target.get_ear_protection()
|
||||
var/effect_amount = intensity - ear_safety
|
||||
if(effect_amount > 0)
|
||||
hypno_sound = TRUE
|
||||
if(living_mob.get_ear_protection() < 0)
|
||||
hypno_sound = TRUE
|
||||
|
||||
if(!distance || loc == living_mob || loc == living_mob.loc)
|
||||
living_mob.Paralyze(10)
|
||||
living_mob.Knockdown(100)
|
||||
if(!distance)
|
||||
living_mob.Paralyze(1 SECONDS)
|
||||
living_mob.Knockdown(10 SECONDS)
|
||||
to_chat(living_mob, span_hypnophrase("The sound echoes in your brain..."))
|
||||
living_mob.adjust_hallucinations(150 SECONDS)
|
||||
|
||||
else
|
||||
if(distance <= 1)
|
||||
living_mob.Paralyze(5)
|
||||
living_mob.Knockdown(30)
|
||||
living_mob.Paralyze(0.5 SECONDS)
|
||||
living_mob.Knockdown(3 SECONDS)
|
||||
if(hypno_sound)
|
||||
to_chat(living_mob, span_hypnophrase("The sound echoes in your brain..."))
|
||||
living_mob.adjust_hallucinations(150 SECONDS)
|
||||
|
||||
//Flash
|
||||
if(living_mob.flash_act(affect_silicon = 1))
|
||||
living_mob.Paralyze(max(10/max(1, distance), 5))
|
||||
living_mob.Knockdown(max(100/max(1, distance), 40))
|
||||
if(iscarbon(living_mob))
|
||||
var/mob/living/carbon/target = living_mob
|
||||
if(target.hypnosis_vulnerable()) //The sound causes the necessary conditions unless the target has mindshield or hearing protection
|
||||
target.apply_status_effect(/datum/status_effect/trance, 100, TRUE)
|
||||
else
|
||||
to_chat(target, span_hypnophrase("The light is so pretty..."))
|
||||
target.adjust_drowsiness_up_to(20 SECONDS, 40 SECONDS)
|
||||
target.adjust_confusion_up_to(10 SECONDS, 20 SECONDS)
|
||||
target.adjust_dizzy_up_to(20 SECONDS, 40 SECONDS)
|
||||
if(!living_mob.flash_act(affect_silicon = TRUE))
|
||||
return
|
||||
living_mob.Paralyze(max(1 SECONDS / (distance || 1), 0.5 SECONDS))
|
||||
living_mob.Knockdown(max(10 SECONDS / (distance || 1), 4 SECONDS))
|
||||
if(living_mob.hypnosis_vulnerable()) //The sound causes the necessary conditions unless the target has mindshield or hearing protection
|
||||
living_mob.apply_status_effect(/datum/status_effect/trance, 10 SECONDS, TRUE)
|
||||
return
|
||||
to_chat(living_mob, span_hypnophrase("The light is so pretty..."))
|
||||
living_mob.adjust_drowsiness_up_to(20 SECONDS, 40 SECONDS)
|
||||
living_mob.adjust_confusion_up_to(10 SECONDS, 20 SECONDS)
|
||||
living_mob.adjust_dizzy_up_to(20 SECONDS, 40 SECONDS)
|
||||
|
||||
@@ -373,7 +373,7 @@
|
||||
span_danger("The siren pierces your hearing!"),
|
||||
)
|
||||
for(var/mob/living/carbon/carbon in get_hearers_in_view(9, user))
|
||||
if(carbon.get_ear_protection())
|
||||
if(carbon.get_ear_protection() > 0)
|
||||
continue
|
||||
carbon.adjust_confusion(6 SECONDS)
|
||||
|
||||
@@ -386,18 +386,20 @@
|
||||
to_chat(robot_user.connected_ai, "<br>[span_notice("NOTICE - Peacekeeping 'HARM ALARM' used by: [user]")]<br>")
|
||||
else
|
||||
user.audible_message("<font color='red' size='7'>BZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZT</font>")
|
||||
for(var/mob/living/carbon/carbon in get_hearers_in_view(9, user))
|
||||
var/bang_effect = carbon.soundbang_act(2, 0, 0, 5)
|
||||
for(var/mob/living/living in get_hearers_in_view(9, user))
|
||||
var/bang_effect = living.soundbang_act(SOUNDBANG_STRONG, 0, 0, 5)
|
||||
switch(bang_effect)
|
||||
if(0)
|
||||
continue
|
||||
if(1)
|
||||
carbon.adjust_confusion(5 SECONDS)
|
||||
carbon.adjust_stutter(20 SECONDS)
|
||||
carbon.adjust_jitter(20 SECONDS)
|
||||
if(2)
|
||||
carbon.Paralyze(40)
|
||||
carbon.adjust_confusion(10 SECONDS)
|
||||
carbon.adjust_stutter(30 SECONDS)
|
||||
carbon.adjust_jitter(50 SECONDS)
|
||||
living.adjust_confusion(5 SECONDS)
|
||||
living.adjust_stutter(20 SECONDS)
|
||||
living.adjust_jitter(20 SECONDS)
|
||||
else
|
||||
living.Paralyze(4 SECONDS)
|
||||
living.adjust_confusion(10 SECONDS)
|
||||
living.adjust_stutter(30 SECONDS)
|
||||
living.adjust_jitter(50 SECONDS)
|
||||
playsound(get_turf(src), 'sound/machines/warning-buzzer.ogg', 130, 3)
|
||||
COOLDOWN_START(src, alarm_cooldown, HARM_ALARM_NO_SAFETY_COOLDOWN)
|
||||
user.log_message("used an emagged Cyborg Harm Alarm", LOG_ATTACK)
|
||||
|
||||
Reference in New Issue
Block a user