Flash and flashbang tweaks and fixes (#15651)

This commit is contained in:
Wildkins
2023-01-25 12:41:17 +01:00
committed by GitHub
parent c081ebcedd
commit b381d6f124
13 changed files with 75 additions and 46 deletions
@@ -821,14 +821,14 @@
if (!ignore_inherent && species.inherent_eye_protection)
. = max(species.inherent_eye_protection, flash_protection)
else
. = flash_protection
return flash_protection
if(!flash_protection && HAS_TRAIT(src, TRAIT_ORIGIN_LIGHT_SENSITIVE))
return species.inherent_eye_protection ? species.inherent_eye_protection - 1 : FLASH_PROTECTION_REDUCED
if(HAS_TRAIT(src, TRAIT_ORIGIN_LIGHT_SENSITIVE))
return max(. - 1, FLASH_PROTECTION_REDUCED)
/mob/living/carbon/human/flash_act(intensity = FLASH_PROTECTION_MODERATE, override_blindness_check = FALSE, affect_silicon = FALSE, ignore_inherent = FALSE, type = /obj/screen/fullscreen/flash, length = 2.5 SECONDS)
if(..())
var/obj/item/organ/E = get_eyes()
var/obj/item/organ/E = get_eyes(no_synthetic = !affect_silicon)
if(istype(E))
return E.flash_act(intensity, override_blindness_check, affect_silicon, ignore_inherent, type, length)
else if(intensity == get_flash_protection(ignore_inherent))
@@ -303,18 +303,18 @@
return species.icon_y_offset
/mob/living/carbon/human/get_hearing_protection()
return (l_ear?.item_flags & SOUNDPROTECTION) || (r_ear?.item_flags & SOUNDPROTECTION) || (head?.item_flags & SOUNDPROTECTION)
. = EAR_PROTECTION_NONE
/mob/living/carbon/human/soundbang_act(intensity = 1, stun_pwr = 20, damage_pwr = 5, deafen_pwr = 15)
// First, increase intensity for sensitive hearing
intensity *= (1 + 0.25 * get_hearing_sensitivity())
if(!intensity || get_hearing_protection())
return FALSE
if ((l_ear?.item_flags & SOUNDPROTECTION) || (r_ear?.item_flags & SOUNDPROTECTION) || (head?.item_flags & SOUNDPROTECTION))
return EAR_PROTECTION_MAJOR
if(istype(head, /obj/item/clothing/head/helmet))
intensity -= 0.5
if(HAS_FLAG(mutations, HULK))
intensity -= 0.5
if(istype(head, /obj/item/clothing/head/helmet) || HAS_FLAG(mutations, HULK))
. = EAR_PROTECTION_MODERATE
return max(EAR_PROTECTION_REDUCED, . - (get_hearing_sensitivity() / 2))
/mob/living/carbon/human/noise_act(intensity = EAR_PROTECTION_MODERATE, stun_pwr = 0, damage_pwr = 0, deafen_pwr = 0)
intensity -= get_hearing_protection()
if(intensity <= 0)
return FALSE
@@ -325,7 +325,7 @@
if(deafen_pwr || damage_pwr)
var/ear_damage = damage_pwr * intensity
var/deaf = deafen_pwr * intensity
adjustEarDamage(ear_damage, deaf, TRUE)
adjustEarDamage(rand(1, ear_damage), deaf, TRUE)
sound_to(src, sound('sound/weapons/flash_ring.ogg',0,1,0,100))
return intensity
@@ -374,7 +374,7 @@
return TRUE
return FALSE
/mob/living/carbon/human/proc/get_hearing_sensitivity()
/mob/living/carbon/human/get_hearing_sensitivity()
return species.hearing_sensitivity
/mob/living/carbon/human/proc/is_listening()
@@ -632,7 +632,7 @@ mob/living/carbon/human/proc/change_monitor()
visible_message("<span class='danger'>\The [src] shrieks!</span>")
playsound(src.loc, 'sound/species/revenant/grue_screech.ogg', 100, 1)
for (var/mob/living/carbon/human/T in hearers(4, src) - src)
if(T.get_hearing_protection())
if(T.get_hearing_protection() >= EAR_PROTECTION_MAJOR)
continue
if (T.get_hearing_sensitivity() == HEARING_VERY_SENSITIVE)
earpain(2, TRUE, 1)
@@ -829,7 +829,7 @@ mob/living/carbon/human/proc/change_monitor()
var/list/victims = list()
for (var/mob/living/carbon/human/T in hearers(4, src) - src)
if(T.get_hearing_protection())
if(T.get_hearing_protection() >= EAR_PROTECTION_MAJOR)
continue
if (T.get_hearing_sensitivity() == HEARING_VERY_SENSITIVE)
earpain(3, TRUE, 1)
@@ -837,7 +837,7 @@ mob/living/carbon/human/proc/change_monitor()
earpain(2, TRUE, 2)
for (var/mob/living/carbon/human/T in hearers(2, src) - src)
if(T.get_hearing_protection())
if(T.get_hearing_protection() >= EAR_PROTECTION_MAJOR)
continue
to_chat(T, SPAN_DANGER("You hear an ear piercing shriek and feel your senses go dull!"))
+5 -1
View File
@@ -1412,9 +1412,13 @@
if(ear_deaf <= 1 && (sdisabilities & DEAF) && has_hearing_aid())
setEarDamage(-1, max(ear_deaf-1, 0))
if(get_hearing_protection()) // resting your ears make them heal faster
var/ear_safety = get_hearing_protection()
if(ear_safety >= EAR_PROTECTION_MAJOR) // resting your ears make them heal faster
adjustEarDamage(-0.15, 0)
setEarDamage(-1)
else if(ear_safety > EAR_PROTECTION_NONE)
adjustEarDamage(-0.10, 0)
else if(ear_damage < HEARING_DAMAGE_SLOW_HEAL) //ear damage heals slowly under this threshold. otherwise you'll need earmuffs
adjustEarDamage(-0.05, 0)
+6 -2
View File
@@ -56,6 +56,9 @@
/mob/living/proc/get_hearing_protection()
return FALSE
/mob/living/proc/get_hearing_sensitivity()
return FALSE
/mob/living/proc/aura_check(var/type)
if(!auras)
return TRUE
@@ -122,8 +125,9 @@
addtimer(CALLBACK(src, /mob/proc/clear_fullscreen, "flash", length), length)
return TRUE
/// Called when the mob receives a loud bang
/mob/living/proc/soundbang_act()
/// Called when the mob hears a very loud noise!
/// Intensity can be an EAR_PROTECTION_X define or an arbitrary/computed value between -1 and 2 (or more if you're insane)
/mob/living/proc/noise_act(intensity = EAR_PROTECTION_MODERATE, stun_pwr = 0, damage_pwr = 0, deafen_pwr = 0)
return FALSE
/mob/living/proc/get_attack_victim(obj/item/I, mob/living/user, var/target_zone)