Unrevert audio (#21330)

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
metalgearsloth
2023-11-27 22:12:34 +11:00
committed by GitHub
parent d3486d3b25
commit 269c93245d
288 changed files with 848 additions and 427 deletions

View File

@@ -51,5 +51,5 @@ public sealed partial class FTLComponent : Component
Params = AudioParams.Default.WithVolume(-3f).WithLoop(true)
};
public IPlayingAudioStream? TravelStream;
public EntityUid? TravelStream;
}

View File

@@ -20,6 +20,9 @@ using Content.Shared.Tag;
using Content.Shared.Tiles;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Server.Player;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;

View File

@@ -230,8 +230,7 @@ public sealed partial class ShuttleSystem
component = AddComp<FTLComponent>(uid);
component.State = FTLState.Starting;
// TODO: Need BroadcastGrid to not be bad.
SoundSystem.Play(_startupSound.GetSound(), Filter.Empty().AddInRange(Transform(uid).MapPosition, GetSoundRange(uid)), _startupSound.Params);
_audio.PlayPvs(_startupSound, uid);
// Make sure the map is setup before we leave to avoid pop-in (e.g. parallax).
SetupHyperspace();
return true;
@@ -287,11 +286,8 @@ public sealed partial class ShuttleSystem
var ev = new FTLStartedEvent(uid, target, fromMapUid, fromMatrix, fromRotation);
RaiseLocalEvent(uid, ref ev, true);
if (comp.TravelSound != null)
{
comp.TravelStream = SoundSystem.Play(comp.TravelSound.GetSound(),
Filter.Pvs(uid, 4f, entityManager: EntityManager), comp.TravelSound.Params);
}
comp.TravelStream = _audio.PlayPvs(comp.TravelSound, uid)?.Entity;
break;
// Arriving, play effects
case FTLState.Travelling:
@@ -377,13 +373,8 @@ public sealed partial class ShuttleSystem
_thruster.DisableLinearThrusters(shuttle);
}
if (comp.TravelStream != null)
{
comp.TravelStream?.Stop();
comp.TravelStream = null;
}
_audio.PlayGlobal(_arrivalSound, Filter.Empty().AddInRange(Transform(uid).MapPosition, GetSoundRange(uid)), true);
comp.TravelStream = _audio.Stop(comp.TravelStream);
_audio.PlayPvs(_arrivalSound, uid);
if (TryComp<FTLDestinationComponent>(uid, out var dest))
{

View File

@@ -54,6 +54,6 @@ public sealed partial class ShuttleSystem
var volume = MathF.Min(10f, 1f * MathF.Pow(jungleDiff, 0.5f) - 5f);
var audioParams = AudioParams.Default.WithVariation(SharedContentAudioSystem.DefaultVariation).WithVolume(volume);
_audio.Play(_shuttleImpactSound, Filter.Pvs(coordinates, rangeMultiplier: 4f, entityMan: EntityManager), coordinates, true, audioParams);
_audio.PlayPvs(_shuttleImpactSound, coordinates, audioParams);
}
}

View File

@@ -9,6 +9,8 @@ using Content.Shared.Shuttles.Systems;
using Content.Shared.Throwing;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;