diff --git a/code/game/objects/items/grenades/flashbang.dm b/code/game/objects/items/grenades/flashbang.dm index 2bc9401c774..41d370d7bdd 100644 --- a/code/game/objects/items/grenades/flashbang.dm +++ b/code/game/objects/items/grenades/flashbang.dm @@ -5,7 +5,12 @@ lefthand_file = 'icons/mob/inhands/equipment/security_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/security_righthand.dmi' possible_fuse_time = list("3", "4", "5") - var/flashbang_range = 7 //how many tiles away the mob will be stunned. + //how many tiles away the mob will be affected by the flashbang. + var/flashbang_range = 7 + //The devision for the sweetspot culations. if set to 1, the sweetspot is ostensibly the flashbang range. + var/sweetspot_divider = 3 + //The light emitted by this flashbang to indicate the sweetspot. + var/flashbang_light = LIGHT_COLOR_INTENSE_RED /obj/item/grenade/flashbang/apply_grenade_fantasy_bonuses(quality) flashbang_range = modify_fantasy_variable("flashbang_range", flashbang_range, quality) @@ -13,6 +18,14 @@ /obj/item/grenade/flashbang/remove_grenade_fantasy_bonuses(quality) flashbang_range = reset_fantasy_variable("flashbang_range", flashbang_range) +/obj/item/grenade/flashbang/arm_grenade(mob/user, delayoverride, msg = TRUE, volume = 60) + . = ..() + if(!.) + return + + var/sweetspot_range = clamp(CEILING(flashbang_range/sweetspot_divider, 1), 0, flashbang_range) + set_light(sweetspot_range, sweetspot_range, flashbang_light) + /obj/item/grenade/flashbang/detonate(mob/living/lanced_by) . = ..() if(!.) @@ -34,22 +47,38 @@ return living_mob.show_message(span_warning("BANG"), MSG_AUDIBLE) var/distance = max(0, get_dist(get_turf(src), turf)) + var/sweetspot_range = clamp(CEILING(flashbang_range/sweetspot_divider, 1), 0, flashbang_range) //Flash - if(living_mob.flash_act(affect_silicon = 1)) - living_mob.Paralyze(max(20/max(1, distance), 5)) - living_mob.Knockdown(max(200/max(1, distance), 60)) + var/attempt_flash = living_mob.flash_act(affect_silicon = 1) + if(attempt_flash == FLASH_COMPLETED) + if(distance <= sweetspot_range || issilicon(living_mob)) + living_mob.Paralyze(max(20/max(1, distance), 5)) + living_mob.Knockdown(max(200/max(1, distance), 60)) + else + living_mob.adjust_dizzy_up_to(max(200/max(1, distance), 5), 20 SECONDS) + living_mob.dropItemToGround(living_mob.get_active_held_item()) + living_mob.dropItemToGround(living_mob.get_inactive_held_item()) //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) - else - if(distance <= 1) // Adds more stun as to not prime n' pull (#45381) - living_mob.Paralyze(5) - living_mob.Knockdown(30) + living_mob.soundbang_act(2, 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) + return + + if(distance <= sweetspot_range) living_mob.soundbang_act(1, max(200 / max(1, distance), 60), rand(0, 5)) + return + + if(!living_mob.soundbang_act(1, 0, rand(0, 2))) + return + + living_mob.adjust_staggered_up_to(max(200/max(1, distance), 5), 10 SECONDS) + living_mob.dropItemToGround(living_mob.get_active_held_item()) + living_mob.dropItemToGround(living_mob.get_inactive_held_item()) /obj/item/grenade/stingbang name = "stingbang" diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 1a3629883b2..6efffa7824f 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -508,28 +508,29 @@ var/ear_safety = get_ear_protection() var/obj/item/organ/ears/ears = get_organ_slot(ORGAN_SLOT_EARS) var/effect_amount = intensity - ear_safety - if(effect_amount > 0) - if(stun_pwr) - Paralyze((stun_pwr*effect_amount)*0.1) - Knockdown(stun_pwr*effect_amount) + if(effect_amount <= 0) + return FALSE - if(ears && (deafen_pwr || damage_pwr)) - var/ear_damage = damage_pwr * effect_amount - var/deaf = deafen_pwr * effect_amount - ears.adjustEarDamage(ear_damage,deaf) + if(stun_pwr) + Paralyze((stun_pwr*effect_amount)*0.1) + Knockdown(stun_pwr*effect_amount) - if(ears.damage >= 15) - to_chat(src, span_warning("Your ears start to ring badly!")) - if(prob(ears.damage - 5)) - to_chat(src, span_userdanger("You can't hear anything!")) - // Makes you deaf, enough that you need a proper source of healing, it won't self heal - // you need earmuffs, inacusiate, or replacement - ears.set_organ_damage(ears.maxHealth) - else if(ears.damage >= 5) - to_chat(src, span_warning("Your ears start to ring!")) - SEND_SOUND(src, sound('sound/items/weapons/flash_ring.ogg',0,1,0,250)) - return effect_amount //how soundbanged we are + if(ears && (deafen_pwr || damage_pwr)) + var/ear_damage = damage_pwr * effect_amount + var/deaf = deafen_pwr * effect_amount + ears.adjustEarDamage(ear_damage,deaf) + . = effect_amount //how soundbanged we are + SEND_SOUND(src, sound('sound/items/weapons/flash_ring.ogg',0,1,0,250)) + + if(ears.damage < 5) + return + if(ears.damage >= 15 && prob(ears.damage - 5)) + to_chat(src, span_userdanger("You can't hear anything!")) + // Makes you deaf, enough that you need a proper source of healing, it won't self heal + // you need earmuffs, inacusiate, or replacement + ears.set_organ_damage(ears.maxHealth) + to_chat(src, span_warning("Your ears start to ring[ears.damage >= 15 ? " badly!":"!"]")) /mob/living/carbon/damage_clothes(damage_amount, damage_type = BRUTE, damage_flag = 0, def_zone) if(damage_type != BRUTE && damage_type != BURN)