Skip to content

Commit b257eb8

Browse files
metalgearslothsleepyyapril
authored andcommitted
Fix shuttle audio clipping (#27527)
Changed engine to use grid local-center and very high maxdistance / refdistance values so it's seamless.
1 parent 90b73f4 commit b257eb8

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs

+11
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,17 @@ private void UpdateFTLStarting(Entity<FTLComponent, ShuttleComponent> entity)
406406
clippedAudio.Value.Component.Flags |= AudioFlags.NoOcclusion;
407407
}
408408

409+
// Leave audio at the old spot
410+
// Just so we don't clip
411+
if (fromMapUid != null && TryComp(comp.StartupStream, out AudioComponent? startupAudio))
412+
{
413+
var clippedAudio = _audio.PlayStatic(_startupSound, Filter.Broadcast(),
414+
new EntityCoordinates(fromMapUid.Value, _maps.GetGridPosition(entity.Owner)), true, startupAudio.Params);
415+
416+
_audio.SetPlaybackPosition(clippedAudio, entity.Comp1.StartupTime);
417+
clippedAudio.Value.Component.Flags |= AudioFlags.NoOcclusion;
418+
}
419+
409420
// Offset the start by buffer range just to avoid overlap.
410421
var ftlStart = new EntityCoordinates(ftlMap, new Vector2(_index + width / 2f, 0f) - shuttleCenter);
411422

Content.Server/Shuttles/Systems/ShuttleSystem.cs

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
4343
[Dependency] private readonly MetaDataSystem _metadata = default!;
4444
[Dependency] private readonly PvsOverrideSystem _pvs = default!;
4545
[Dependency] private readonly SharedAudioSystem _audio = default!;
46+
[Dependency] private readonly SharedMapSystem _maps = default!;
4647
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
4748
[Dependency] private readonly SharedTransformSystem _transform = default!;
4849
[Dependency] private readonly ShuttleConsoleSystem _console = default!;

Content.Shared/Shuttles/Components/FTLComponent.cs

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ public sealed partial class FTLComponent : Component
5656
Params = AudioParams.Default.WithVolume(-3f).WithLoop(true)
5757
};
5858

59+
[DataField]
60+
public EntityUid? StartupStream;
61+
5962
[DataField]
6063
public EntityUid? TravelStream;
6164
}

0 commit comments

Comments
 (0)