forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'space-wizards:master' into master
- Loading branch information
Showing
383 changed files
with
496,298 additions
and
390,002 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
using Content.Shared.CCVar; | ||
using Robust.Client.Audio; | ||
using Robust.Client.ResourceManagement; | ||
using Robust.Client.UserInterface.Controllers; | ||
using Robust.Shared.Audio.Sources; | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Client.Audio; | ||
|
||
public sealed class AudioUIController : UIController | ||
{ | ||
[Dependency] private readonly IAudioManager _audioManager = default!; | ||
[Dependency] private readonly IConfigurationManager _configManager = default!; | ||
[Dependency] private readonly IResourceCache _cache = default!; | ||
|
||
private float _interfaceGain; | ||
private IAudioSource? _clickSource; | ||
private IAudioSource? _hoverSource; | ||
|
||
private const float ClickGain = 0.25f; | ||
private const float HoverGain = 0.05f; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
/* | ||
* This exists to load UI sounds outside of the game sim. | ||
*/ | ||
|
||
// No unsub coz never shuts down until program exit. | ||
_configManager.OnValueChanged(CCVars.UIClickSound, SetClickSound, true); | ||
_configManager.OnValueChanged(CCVars.UIHoverSound, SetHoverSound, true); | ||
|
||
_configManager.OnValueChanged(CCVars.InterfaceVolume, SetInterfaceVolume, true); | ||
} | ||
|
||
private void SetInterfaceVolume(float obj) | ||
{ | ||
_interfaceGain = obj; | ||
|
||
if (_clickSource != null) | ||
{ | ||
_clickSource.Gain = ClickGain * _interfaceGain; | ||
} | ||
|
||
if (_hoverSource != null) | ||
{ | ||
_hoverSource.Gain = HoverGain * _interfaceGain; | ||
} | ||
} | ||
|
||
private void SetClickSound(string value) | ||
{ | ||
if (!string.IsNullOrEmpty(value)) | ||
{ | ||
var resource = _cache.GetResource<AudioResource>(value); | ||
var source = | ||
_audioManager.CreateAudioSource(resource); | ||
|
||
if (source != null) | ||
{ | ||
source.Gain = ClickGain * _interfaceGain; | ||
source.Global = true; | ||
} | ||
|
||
_clickSource = source; | ||
UIManager.SetClickSound(source); | ||
} | ||
else | ||
{ | ||
UIManager.SetClickSound(null); | ||
} | ||
} | ||
|
||
private void SetHoverSound(string value) | ||
{ | ||
if (!string.IsNullOrEmpty(value)) | ||
{ | ||
var hoverResource = _cache.GetResource<AudioResource>(value); | ||
var hoverSource = | ||
_audioManager.CreateAudioSource(hoverResource); | ||
|
||
if (hoverSource != null) | ||
{ | ||
hoverSource.Gain = HoverGain * _interfaceGain; | ||
hoverSource.Global = true; | ||
} | ||
|
||
_hoverSource = hoverSource; | ||
UIManager.SetHoverSound(hoverSource); | ||
} | ||
else | ||
{ | ||
UIManager.SetHoverSound(null); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
Content.Client/Chemistry/Containers/EntitySystems/SolutionContainerSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using Content.Shared.Chemistry.EntitySystems; | ||
|
||
namespace Content.Client.Chemistry.Containers.EntitySystems; | ||
|
||
public sealed partial class SolutionContainerSystem : SharedSolutionContainerSystem | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.