diff --git a/.github/workflows/build-docfx.yml b/.github/workflows/build-docfx.yml new file mode 100644 index 0000000000..00f7dd4dbf --- /dev/null +++ b/.github/workflows/build-docfx.yml @@ -0,0 +1,51 @@ +name: Build & Publish Docfx + +on: + push: + branches: [ master ] + paths: + - '**.cs' + - '**.csproj' + - '**.sln' + - '**.git**' + - '**.yml' + # no docs on which one of these is supposed to work, so + # why not just do both + - 'RobustToolbox' + - 'RobustToolbox/**' + +jobs: + docfx: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup submodule + run: | + git submodule update --init --recursive + - name: Pull engine updates + uses: space-wizards/submodule-dependency@v0.1.5 + - name: Update Engine Submodules + run: | + cd RobustToolbox/ + git submodule update --init --recursive + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x + + - name: Install dependencies + run: dotnet restore + + - name: Build Project + run: dotnet build --no-restore /p:WarningsAsErrors=nullable + + - name: Build DocFX + uses: nikeee/docfx-action@v1.0.0 + with: + args: Content.Docfx/docfx.json + + - name: Publish Docfx Documentation on GitHub Pages + uses: maxheld83/ghpages@master + env: + BUILD_DIR: Content.Docfx/_content-site + GH_PAT: ${{ secrets.GH_PAT }} diff --git a/.gitignore b/.gitignore index f7812b6dd2..0686354bc8 100644 --- a/.gitignore +++ b/.gitignore @@ -252,6 +252,7 @@ paket-files/ # JetBrains Rider .idea/ *.sln.iml +.editorconfig # CodeRush .cr/ @@ -295,3 +296,8 @@ desktop.ini # Images generated using the MapRenderer Resources/MapImages + +## Docfx stuff +/Content.Docfx/api/ +/Content.Docfx/*site + diff --git a/Content.Client/Audio/AmbientSoundSystem.cs b/Content.Client/Audio/AmbientSoundSystem.cs index a9db3f54bf..ac684f8822 100644 --- a/Content.Client/Audio/AmbientSoundSystem.cs +++ b/Content.Client/Audio/AmbientSoundSystem.cs @@ -24,6 +24,7 @@ namespace Content.Client.Audio public sealed class AmbientSoundSystem : SharedAmbientSoundSystem { [Dependency] private EntityLookupSystem _lookup = default!; + [Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IRobustRandom _random = default!; @@ -33,25 +34,28 @@ namespace Content.Client.Audio private float _maxAmbientRange; private float _cooldown; private float _accumulator; + private float _ambienceVolume = 0.0f; /// /// How many times we can be playing 1 particular sound at once. /// - private int _maxSingleSound = 8; + private int MaxSingleSound => (int) (_maxAmbientCount / (16.0f / 6.0f)); private Dictionary _playingSounds = new(); private const float RangeBuffer = 3f; + + public override void Initialize() { base.Initialize(); UpdatesOutsidePrediction = true; - var configManager = IoCManager.Resolve(); - configManager.OnValueChanged(CCVars.AmbientCooldown, SetCooldown, true); - configManager.OnValueChanged(CCVars.MaxAmbientSources, SetAmbientCount, true); - configManager.OnValueChanged(CCVars.AmbientRange, SetAmbientRange, true); + _cfg.OnValueChanged(CCVars.AmbientCooldown, SetCooldown, true); + _cfg.OnValueChanged(CCVars.MaxAmbientSources, SetAmbientCount, true); + _cfg.OnValueChanged(CCVars.AmbientRange, SetAmbientRange, true); + _cfg.OnValueChanged(CCVars.AmbienceVolume, SetAmbienceVolume, true); SubscribeLocalEvent(OnShutdown); } @@ -61,6 +65,7 @@ namespace Content.Client.Audio sound.Stream?.Stop(); } + private void SetAmbienceVolume(float value) => _ambienceVolume = value; private void SetCooldown(float value) => _cooldown = value; private void SetAmbientCount(int value) => _maxAmbientCount = value; private void SetAmbientRange(float value) => _maxAmbientRange = value; @@ -69,10 +74,11 @@ namespace Content.Client.Audio { base.Shutdown(); ClearSounds(); - var configManager = IoCManager.Resolve(); - configManager.UnsubValueChanged(CCVars.AmbientCooldown, SetCooldown); - configManager.UnsubValueChanged(CCVars.MaxAmbientSources, SetAmbientCount); - configManager.UnsubValueChanged(CCVars.AmbientRange, SetAmbientRange); + + _cfg.UnsubValueChanged(CCVars.AmbientCooldown, SetCooldown); + _cfg.UnsubValueChanged(CCVars.MaxAmbientSources, SetAmbientCount); + _cfg.UnsubValueChanged(CCVars.AmbientRange, SetAmbientRange); + _cfg.UnsubValueChanged(CCVars.AmbienceVolume, SetAmbienceVolume); } private int PlayingCount(string countSound) @@ -143,7 +149,7 @@ namespace Content.Client.Audio var key = ambientComp.Sound.GetSound(); if (!sourceDict.ContainsKey(key)) - sourceDict[key] = new List(_maxSingleSound); + sourceDict[key] = new List(MaxSingleSound); sourceDict[key].Add(ambientComp); } @@ -151,7 +157,7 @@ namespace Content.Client.Audio foreach (var (key, val) in sourceDict) { sourceDict[key] = val.OrderByDescending(x => - Transform(x.Owner).Coordinates.TryDistance(EntityManager, coordinates, out var dist) ? dist : float.MaxValue).ToList(); + Transform(x.Owner).Coordinates.TryDistance(EntityManager, coordinates, out var dist) ? dist * (x.Volume + 32) : float.MaxValue).ToList(); } return sourceDict; @@ -198,7 +204,7 @@ namespace Content.Client.Audio var sound = comp.Sound.GetSound(); - if (PlayingCount(sound) >= _maxSingleSound) + if (PlayingCount(sound) >= MaxSingleSound) { keys.Remove(key); /*foreach (var toRemove in compsInRange[key]) @@ -212,7 +218,7 @@ namespace Content.Client.Audio var audioParams = AudioHelpers .WithVariation(0.01f) - .WithVolume(comp.Volume) + .WithVolume(comp.Volume + _ambienceVolume) .WithLoop(true) .WithAttenuation(Attenuation.LinearDistance) // Randomise start so 2 sources don't increase their volume. diff --git a/Content.Client/Audio/BackgroundAudioSystem.cs b/Content.Client/Audio/BackgroundAudioSystem.cs index 9e4ce2d1ad..2d946f0367 100644 --- a/Content.Client/Audio/BackgroundAudioSystem.cs +++ b/Content.Client/Audio/BackgroundAudioSystem.cs @@ -29,8 +29,8 @@ namespace Content.Client.Audio private SoundCollectionPrototype _ambientCollection = default!; - private AudioParams _ambientParams = new(-10f, 1, "Master", 0, 0, 0, true, 0f); - private AudioParams _lobbyParams = new(-5f, 1, "Master", 0, 0, 0, true, 0f); + private readonly AudioParams _ambientParams = new(-10f, 1, "Master", 0, 0, 0, true, 0f); + private readonly AudioParams _lobbyParams = new(-5f, 1, "Master", 0, 0, 0, true, 0f); private IPlayingAudioStream? _ambientStream; private IPlayingAudioStream? _lobbyStream; @@ -41,7 +41,7 @@ namespace Content.Client.Audio _ambientCollection = _prototypeManager.Index("AmbienceBase"); - _configManager.OnValueChanged(CCVars.AmbienceBasicEnabled, AmbienceCVarChanged); + _configManager.OnValueChanged(CCVars.AmbienceVolume, AmbienceCVarChanged); _configManager.OnValueChanged(CCVars.LobbyMusicEnabled, LobbyMusicCVarChanged); _stateManager.OnStateChanged += StateManagerOnStateChanged; @@ -75,7 +75,7 @@ namespace Content.Client.Audio { StartLobbyMusic(); } - else if (args.NewState is GameScreen && _configManager.GetCVar(CCVars.AmbienceBasicEnabled)) + else if (args.NewState is GameScreen) { StartAmbience(); } @@ -94,10 +94,7 @@ namespace Content.Client.Audio else { EndLobbyMusic(); - if (_configManager.GetCVar(CCVars.AmbienceBasicEnabled)) - { - StartAmbience(); - } + StartAmbience(); } } @@ -107,13 +104,9 @@ namespace Content.Client.Audio EndLobbyMusic(); } - private void AmbienceCVarChanged(bool ambienceEnabled) + private void AmbienceCVarChanged(float volume) { - if (!ambienceEnabled) - { - EndAmbience(); - } - else if (_stateManager.CurrentState is GameScreen) + if (_stateManager.CurrentState is GameScreen) { StartAmbience(); } @@ -127,7 +120,7 @@ namespace Content.Client.Audio { EndAmbience(); var file = _robustRandom.Pick(_ambientCollection.PickFiles).ToString(); - _ambientStream = SoundSystem.Play(Filter.Local(), file, _ambientParams); + _ambientStream = SoundSystem.Play(Filter.Local(), file, _ambientParams.WithVolume(_ambientParams.Volume + _configManager.GetCVar(CCVars.AmbienceVolume))); } private void EndAmbience() diff --git a/Content.Client/Clothing/ClothingSystem.cs b/Content.Client/Clothing/ClothingSystem.cs index 29f5a7572b..fa5d18df3d 100644 --- a/Content.Client/Clothing/ClothingSystem.cs +++ b/Content.Client/Clothing/ClothingSystem.cs @@ -84,7 +84,8 @@ public sealed class ClothingSystem : EntitySystem var key = layer.MapKeys?.FirstOrDefault(); if (key == null) { - key = i == 0 ? args.Slot : $"{args.Slot}-{i}"; + // using the $"{args.Slot}" layer key as the "bookmark" for layer ordering until layer draw depths get added + key = $"{args.Slot}-{i}"; i++; } @@ -254,6 +255,10 @@ public sealed class ClothingSystem : EntitySystem return; } + // temporary, until layer draw depths get added. Basically: a layer with the key "slot" is being used as a + // bookmark to determine where in the list of layers we should insert the clothing layers. + bool slotLayerExists = sprite.LayerMapTryGet(slot, out var index); + // add the new layers foreach (var (key, layerData) in ev.Layers) { @@ -263,7 +268,16 @@ public sealed class ClothingSystem : EntitySystem continue; } - var index = sprite.LayerMapReserveBlank(key); + if (slotLayerExists) + { + index++; + // note that every insertion requires reshuffling & remapping all the existing layers. + sprite.AddBlankLayer(index); + sprite.LayerMapSet(key, index); + } + else + index = sprite.LayerMapReserveBlank(key); + if (sprite[index] is not Layer layer) return; diff --git a/Content.Client/Entry/IgnoredComponents.cs b/Content.Client/Entry/IgnoredComponents.cs index 9818bf7239..e067f012bd 100644 --- a/Content.Client/Entry/IgnoredComponents.cs +++ b/Content.Client/Entry/IgnoredComponents.cs @@ -198,6 +198,7 @@ namespace Content.Client.Entry "Rehydratable", "Headset", "ComputerBoard", + "GasAnalyzable", "GasCanister", "GasPort", "GasPortable", diff --git a/Content.Client/EscapeMenu/UI/Tabs/AudioTab.xaml b/Content.Client/EscapeMenu/UI/Tabs/AudioTab.xaml index dffb932b78..b6f235ab2b 100644 --- a/Content.Client/EscapeMenu/UI/Tabs/AudioTab.xaml +++ b/Content.Client/EscapeMenu/UI/Tabs/AudioTab.xaml @@ -35,8 +35,33 @@