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

Make AudioSystem ZOffset public #5388

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Robust.Client/Audio/AudioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public sealed partial class AudioSystem : SharedAudioSystem
public override float ZOffset
{
get => _zOffset;
protected set
set
{
_zOffset = value;
_audio.SetZOffset(value);
Expand Down
2 changes: 1 addition & 1 deletion Robust.Shared/Audio/Systems/SharedAudioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public abstract partial class SharedAudioSystem : EntitySystem
/// </summary>
public int OcclusionCollisionMask { get; set; }

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

Comment on lines 49 to 51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this is needed? SetZOffset is already public and content setting this isn't handled properly at all ie.

  1. cvar changes can bulldoze it.
  2. Overwriting it would mean the max-length adjustments could get bulldozed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because AudioSystem overrides ZOffset that comes from its parent, SharedAudioSystem and when overriding, you can't change the modifiers since you will get CS0507, and this is will not compile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... I understood what you meant now. IAudioListener already has a SetZOffset method that is public... I'm sorry for being dumb and will try it...

public override void Initialize()
{
Expand Down
Loading