mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-12 16:44:43 +01:00
922bd0cb92
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. /🆑
70 lines
2.6 KiB
Plaintext
70 lines
2.6 KiB
Plaintext
/obj/item/grenade/hypnotic
|
|
name = "flashbang"
|
|
desc = "A modified flashbang which uses hypnotic flashes and mind-altering soundwaves to induce an instant trance upon detonation."
|
|
icon_state = "flashbang"
|
|
inhand_icon_state = "flashbang"
|
|
lefthand_file = 'icons/mob/inhands/equipment/security_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/equipment/security_righthand.dmi'
|
|
var/flashbang_range = 7
|
|
|
|
/obj/item/grenade/hypnotic/apply_grenade_fantasy_bonuses(quality)
|
|
flashbang_range = modify_fantasy_variable("flashbang_range", flashbang_range, quality)
|
|
|
|
/obj/item/grenade/hypnotic/remove_grenade_fantasy_bonuses(quality)
|
|
flashbang_range = reset_fantasy_variable("flashbang_range", flashbang_range)
|
|
|
|
/obj/item/grenade/hypnotic/detonate(mob/living/lanced_by)
|
|
. = ..()
|
|
if(!.)
|
|
return
|
|
|
|
update_mob()
|
|
var/flashbang_turf = get_turf(src)
|
|
if(!flashbang_turf)
|
|
return
|
|
do_sparks(rand(5, 9), FALSE, src)
|
|
playsound(flashbang_turf, 'sound/effects/screech.ogg', 100, TRUE, 8, 0.9)
|
|
new /obj/effect/dummy/lighting_obj (flashbang_turf, flashbang_range + 2, 4, LIGHT_COLOR_PURPLE, 2)
|
|
for(var/mob/living/living_mob in get_hearers_in_view(flashbang_range, flashbang_turf))
|
|
bang(get_turf(living_mob), living_mob)
|
|
qdel(src)
|
|
|
|
/obj/item/grenade/hypnotic/proc/bang(turf/turf, mob/living/living_mob)
|
|
if(living_mob.stat == DEAD) //They're dead!
|
|
return
|
|
var/distance = get_dist(get_turf(src), turf)
|
|
|
|
//Bang
|
|
var/hypno_sound = FALSE
|
|
|
|
//Hearing protection check
|
|
if(living_mob.get_ear_protection() < 0)
|
|
hypno_sound = TRUE
|
|
|
|
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(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 = 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)
|