Skip to content

Commit

Permalink
[MIRROR] gun & projectile fire sounds can be lists, pitch varying is …
Browse files Browse the repository at this point in the history
…optional (#2248)

Co-authored-by: Spookerton <[email protected]>
  • Loading branch information
SierraHelper and Spookerton authored Jun 8, 2024
1 parent 6ffa28c commit 8ed76d1
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
/// Sound this gun makes when firing. Overridden by projectiles with their own sounds.
var/fire_sound = 'sound/weapons/gunshot/gunshot.ogg'
var/fire_sound_text = "gunshot"
var/fire_sound_vary = TRUE
var/fire_anim = null
/// The amount your screen shakes when firing. Shouldn't be greater than 2 unless zoomed.
var/screen_shake = 0
Expand Down Expand Up @@ -538,12 +539,18 @@

return launched

/obj/item/gun/proc/play_fire_sound(mob/user, obj/item/projectile/P)
var/shot_sound = (istype(P) && P.fire_sound)? P.fire_sound : fire_sound
if(silenced)
playsound(user, shot_sound, 10, 1)
else
playsound(user, shot_sound, 50, 1)

/obj/item/gun/proc/play_fire_sound(mob/user, obj/item/projectile/projectile)
var/sound = fire_sound
if (istype(projectile) && projectile.fire_sound)
sound = projectile.fire_sound
if (islist(sound))
sound = pick(sound)
var/volume = 50
if (silenced)
volume = 10
playsound(src, sound, volume, fire_sound_vary)


//Suicide handling.
/obj/item/gun/proc/handle_suicide(mob/living/user)
Expand Down

0 comments on commit 8ed76d1

Please sign in to comment.