Flash and flashbang tweaks and fixes (#15651)

This commit is contained in:
Wildkins
2023-01-25 06:41:17 -05:00
committed by GitHub
parent c081ebcedd
commit b381d6f124
13 changed files with 75 additions and 46 deletions
+8 -6
View File
@@ -92,6 +92,11 @@
if(!L || !user || !clumsy_check(user) || !cooldown())
return
if(L == user)
if(user.a_intent == I_HURT)
attack_self(user)
return
L.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been flashed (attempt) with [src.name] by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <span class='warning'>Used the [src.name] to flash [L.name] ([L.ckey])</span>")
msg_admin_attack("[user.name] ([user.ckey]) Used the [src.name] to flash [L.name] ([L.ckey]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)",ckey=key_name(user),ckey_target=key_name(L))
@@ -118,17 +123,14 @@
else
user.visible_message(SPAN_NOTICE("[user] fails to blind [L] with \the [src]."))
/obj/item/device/flash/attack_hand(mob/living/carbon/user)
if(!user || loc != user || user.a_intent != I_HURT)
return ..()
attack_self(user)
/obj/item/device/flash/attack_self(mob/living/carbon/user as mob, flag = 0, emp = 0)
// AOE flash
if(!user || !clumsy_check(user)|| !cooldown())
return
if(user.a_intent != I_HURT)
return
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(broken)
@@ -27,10 +27,13 @@
if(M.flash_act(ignore_inherent = TRUE))
M.Weaken(10)
// 1 - 9x/70 gives us an intensity of 100% at zero,
// 87% at one turf, all the way to 10% at 7 tiles
var/bang_intensity = 1 - (9 * get_dist(T,M) / 70)
M.soundbang_act(bang_intensity, 3, 10, 15)
// 1 - 9x/70 gives us 100% at zero, 87% at 1 turf, all the way to 10% at 7
var/bang_intensity = 1 - (9 * get_dist(T, M) / 70)
M.noise_act(intensity = EAR_PROTECTION_MAJOR, damage_pwr = 10 * bang_intensity, deafen_pwr = 15 * (1 - bang_intensity))
if(M.get_hearing_sensitivity()) // we only stun if they've got sensitive ears
// checking for protection is handled by noise_act
M.noise_act(intensity = EAR_PROTECTION_MAJOR, stun_pwr = 2)
M.disable_cloaking_device()
M.update_icon()