More robust bullet impact sounds (#8325)

This commit is contained in:
metalgearsloth
2022-05-22 18:23:37 +10:00
committed by GitHub
parent 4a86f38251
commit 0084ca721b
27 changed files with 322 additions and 185 deletions

View File

@@ -1,3 +1,4 @@
using Content.Server.Weapon.Ranged;
using Content.Shared.Damage;
using Content.Shared.Physics;
using Content.Shared.Sound;
@@ -38,8 +39,12 @@ namespace Content.Server.Projectiles.Components
private string? _muzzleFlash;
[DataField("impactFlash")]
private string? _impactFlash;
[DataField("soundHitWall")]
private SoundSpecifier _soundHitWall = new SoundPathSpecifier("/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg");
[DataField("soundHit")]
public SoundSpecifier? SoundHit;
[DataField("soundForce")]
public bool ForceSound = false;
public void FireEffects(EntityUid user, float distance, Angle angle, EntityUid? hitEntity = null)
{
@@ -80,14 +85,6 @@ namespace Content.Server.Projectiles.Components
}
}
if (hitEntity != null && _soundHitWall != null)
{
// TODO: No wall component so ?
var offset = localAngle.ToVec().Normalized / 2;
var coordinates = localCoordinates.Offset(offset);
SoundSystem.Play(Filter.Pvs(coordinates), _soundHitWall.GetSound(), coordinates);
}
Owner.SpawnTimer((int) _deathTime.TotalMilliseconds, () =>
{
if (!_entMan.Deleted(Owner))