Merge pull request #4644 from VOREStation/upstream-merge-5803

[MIRROR] Guns sounds refactor and improvements
This commit is contained in:
Novacat
2019-03-27 12:35:26 -04:00
committed by GitHub
57 changed files with 109 additions and 150 deletions

View File

@@ -56,7 +56,7 @@
var/fire_delay = 6 //delay after shooting before the gun can be used again
var/burst_delay = 2 //delay between shots, if firing in bursts
var/move_delay = 1
var/fire_sound = 'sound/weapons/Gunshot.ogg'
var/fire_sound = null // This is handled by projectile.dm's fire_sound var now, but you can override the projectile's fire_sound with this one if you want to.
var/fire_sound_text = "gunshot"
var/fire_anim = null
var/recoil = 0 //screen shake
@@ -474,10 +474,7 @@
last_shot = world.time
if(silenced)
playsound(src, fire_sound, 10, 1)
else
playsound(src, fire_sound, 50, 1)
play_fire_sound()
if(muzzle_flash)
set_light(muzzle_flash)
@@ -673,7 +670,13 @@
return launched
/obj/item/weapon/gun/proc/play_fire_sound(var/mob/user, var/obj/item/projectile/P)
var/shot_sound = (istype(P) && P.fire_sound)? P.fire_sound : fire_sound
var/shot_sound = fire_sound
if(!shot_sound && istype(P) && P.fire_sound) // If the gun didn't have a fire_sound, but the projectile exists, and has a sound...
shot_sound = P.fire_sound
if(!shot_sound) // If there's still no sound...
return
if(silenced)
playsound(user, shot_sound, 10, 1)
else
@@ -696,11 +699,7 @@
var/obj/item/projectile/in_chamber = consume_next_projectile()
if (istype(in_chamber))
user.visible_message("<span class = 'warning'>[user] pulls the trigger.</span>")
var/shot_sound = in_chamber.fire_sound? in_chamber.fire_sound : fire_sound
if(silenced)
playsound(user, shot_sound, 10, 1)
else
playsound(user, shot_sound, 50, 1)
play_fire_sound()
if(istype(in_chamber, /obj/item/projectile/beam/lastertag))
user.show_message("<span class = 'warning'>You feel rather silly, trying to commit suicide with a toy.</span>")
mouthshoot = 0