Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eye zoom should affect audio Z offset, make public audio ZOffset #5352

Open
TokenStyle opened this issue Aug 11, 2024 · 1 comment
Open

Eye zoom should affect audio Z offset, make public audio ZOffset #5352

TokenStyle opened this issue Aug 11, 2024 · 1 comment

Comments

@TokenStyle
Copy link

This issue space-wizards/space-station-14#21946
To make it possible, the Robust.Client AudioSystem should have ZOffset public set.

namespace Robust.Client.Audio;
public sealed partial class AudioSystem : SharedAudioSystem
...
public override float ZOffset
{
    get => _zOffset;
    set
    {
        _zOffset = value;
        _audio.SetZOffset(value);

        var query = AllEntityQuery<AudioComponent>();

        while (query.MoveNext(out var audio))
        {
            // Pythagoras back to normal then adjust.
            var maxDistance = GetAudioDistance(audio.Params.MaxDistance);
            var refDistance = GetAudioDistance(audio.Params.ReferenceDistance);

            audio.MaxDistance = maxDistance;
            audio.ReferenceDistance = refDistance;
        }
    }
}

Or another alternative, by making partial class AudioSystem.Public with SetZOffset public method

namespace Robust.Client.Audio;
public sealed partial class AudioSystem
...
public void SetZOffset(float offset)
{
    ZOffset = offset;
}
@TokenStyle
Copy link
Author

If someone would like, can implement this logic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant