Gun sound fixes (#8592)
This commit is contained in:
@@ -73,6 +73,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
|
||||
SetCartridgeSpent(cartridge, true);
|
||||
MuzzleFlash(gun.Owner, cartridge, user);
|
||||
PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user);
|
||||
|
||||
if (cartridge.DeleteOnSpawn)
|
||||
Del(cartridge.Owner);
|
||||
@@ -92,6 +93,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
case AmmoComponent newAmmo:
|
||||
shotProjectiles.Add(newAmmo.Owner);
|
||||
MuzzleFlash(gun.Owner, newAmmo, user);
|
||||
PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user);
|
||||
|
||||
// Do a throw
|
||||
if (!HasComp<ProjectileComponent>(newAmmo.Owner))
|
||||
@@ -139,6 +141,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
{
|
||||
FireEffects(fromCoordinates, hitscan.MaxLength, entityDirection.ToAngle(), hitscan);
|
||||
}
|
||||
PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
@@ -200,7 +203,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
|
||||
protected override void PlaySound(EntityUid gun, string? sound, EntityUid? user = null)
|
||||
{
|
||||
if (sound == null) return;
|
||||
if (string.IsNullOrEmpty(sound)) return;
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(gun, entityManager: EntityManager).RemoveWhereAttachedEntity(e => e == user), sound, gun);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user