Nerf emitsoundoncollide (#16602)
This commit is contained in:
@@ -6,6 +6,7 @@ using Content.Shared.Popups;
|
||||
using Content.Shared.Sound.Components;
|
||||
using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics.Components;
|
||||
@@ -133,7 +134,15 @@ public abstract class SharedEmitSoundSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
const float MaxVolumeVelocity = 10f;
|
||||
const float MinVolume = -10f;
|
||||
const float MaxVolume = 2f;
|
||||
|
||||
var fraction = MathF.Min(1f, (physics.LinearVelocity.Length - component.MinimumVelocity) / MaxVolumeVelocity);
|
||||
var volume = MinVolume + (MaxVolume - MinVolume) * fraction;
|
||||
component.NextSound = _timing.CurTime + EmitSoundOnCollideComponent.CollideCooldown;
|
||||
TryEmitSound(uid, component, predict: false);
|
||||
|
||||
if (_netMan.IsServer)
|
||||
_audioSystem.PlayPvs(component.Sound, uid, AudioParams.Default.WithVolume(volume));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user