Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
metalgearsloth committed Nov 29, 2023
1 parent adc9570 commit 959ba72
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
22 changes: 12 additions & 10 deletions Robust.Client/Audio/AudioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,22 @@ public sealed partial class AudioSystem : SharedAudioSystem
private EntityUid? _listenerGrid;
private UpdateAudioJob _updateAudioJob;

private EntityQuery<MapGridComponent> _gridQuery;
private EntityQuery<PhysicsComponent> _physicsQuery;
private EntityQuery<TransformComponent> _xformQuery;

private float _maxRayLength;

public override float ZOffset
{
get => _zOffset;
protected set
{
_zOffset = value;
_audio.SetZOffset(value);
}
}

private float _zOffset;

/// <inheritdoc />
public override void Initialize()
{
Expand All @@ -72,9 +82,7 @@ public override void Initialize()
// Need to run after Eye updates so we have an accurate listener position.
UpdatesAfter.Add(typeof(EyeSystem));

_gridQuery = GetEntityQuery<MapGridComponent>();
_physicsQuery = GetEntityQuery<PhysicsComponent>();
_xformQuery = GetEntityQuery<TransformComponent>();

SubscribeLocalEvent<AudioComponent, ComponentStartup>(OnAudioStartup);
SubscribeLocalEvent<AudioComponent, ComponentShutdown>(OnAudioShutdown);
Expand Down Expand Up @@ -113,12 +121,6 @@ public void SetMasterVolume(float value)
_audio.SetMasterVolume(value);
}

protected override void SetZOffset(float value)
{
base.SetZOffset(value);
_audio.SetZOffset(value);
}

public override void Shutdown()
{
CfgManager.UnsubValueChanged(CVars.AudioAttenuation, OnAudioAttenuation);
Expand Down
6 changes: 3 additions & 3 deletions Robust.Shared/Audio/Systems/SharedAudioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public abstract partial class SharedAudioSystem : EntitySystem
/// </summary>
public int OcclusionCollisionMask { get; set; }

public float ZOffset;
public virtual float ZOffset { get; protected set; }

public override void Initialize()
{
base.Initialize();
InitializeEffect();
SetZOffset(CfgManager.GetCVar(CVars.AudioZOffset));
ZOffset = CfgManager.GetCVar(CVars.AudioZOffset);
CfgManager.OnValueChanged(CVars.AudioZOffset, SetZOffset);
SubscribeLocalEvent<AudioComponent, ComponentGetStateAttemptEvent>(OnAudioGetStateAttempt);
SubscribeLocalEvent<AudioComponent, EntityUnpausedEvent>(OnAudioUnpaused);
Expand All @@ -59,7 +59,7 @@ public override void Shutdown()
CfgManager.UnsubValueChanged(CVars.AudioZOffset, SetZOffset);
}

protected virtual void SetZOffset(float value)
protected void SetZOffset(float value)
{
var query = AllEntityQuery<AudioComponent>();
var oldZOffset = ZOffset;
Expand Down

0 comments on commit 959ba72

Please sign in to comment.