Skip to content

Commit

Permalink
Merge branch 'master-ru' into 'master-ru'
Browse files Browse the repository at this point in the history
Upstream sync

See merge request Workbench-Team/space-station-14!104
  • Loading branch information
AruMoon committed Aug 3, 2023
2 parents 3361411 + 794cc4e commit b5a1994
Show file tree
Hide file tree
Showing 129 changed files with 6,729 additions and 5,050 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
shell: pwsh
run: |
$env:DOTNET_gcServer=1
dotnet test --no-build --configuration DebugOpt Content.IntegrationTests/Content.IntegrationTests.csproj -- NUnit.ConsoleOut=0
dotnet test --no-build --configuration DebugOpt Content.IntegrationTests/Content.IntegrationTests.csproj -- NUnit.ConsoleOut=0 NUnit.MapWarningTo=Failed
ci-success:
name: Build & Test Debug
needs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
shell: pwsh
run: |
$env:DOTNET_gcServer=1
dotnet test --configuration Tools --no-build Content.IntegrationTests/Content.IntegrationTests.csproj -- NUnit.ConsoleOut=0
dotnet test --configuration Tools --no-build Content.IntegrationTests/Content.IntegrationTests.csproj -- NUnit.ConsoleOut=0 NUnit.MapWarningTo=Failed
ci-success:
name: Build & Test Release
needs:
Expand Down
24 changes: 13 additions & 11 deletions Content.Client/Audio/AmbientSoundSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected override void QueueUpdate(EntityUid uid, AmbientSoundComponent ambienc
/// </summary>
private int MaxSingleSound => (int) (_maxAmbientCount / (16.0f / 6.0f));

private readonly Dictionary<AmbientSoundComponent, (IPlayingAudioStream? Stream, string Sound)> _playingSounds = new();
private readonly Dictionary<AmbientSoundComponent, (IPlayingAudioStream? Stream, SoundSpecifier Sound, string Path)> _playingSounds = new();
private readonly Dictionary<string, int> _playingCount = new();

public bool OverlayEnabled
Expand Down Expand Up @@ -104,9 +104,9 @@ private void OnShutdown(EntityUid uid, AmbientSoundComponent component, Componen
return;

sound.Stream?.Stop();
_playingCount[sound.Sound] -= 1;
if (_playingCount[sound.Sound] == 0)
_playingCount.Remove(sound.Sound);
_playingCount[sound.Path] -= 1;
if (_playingCount[sound.Path] == 0)
_playingCount.Remove(sound.Path);
}

private void SetAmbienceVolume(float value)
Expand Down Expand Up @@ -141,9 +141,9 @@ private int PlayingCount(string countSound)
{
var count = 0;

foreach (var (_, (_, sound)) in _playingSounds)
foreach (var (_, (_, sound, path)) in _playingSounds)
{
if (sound.Equals(countSound))
if (path.Equals(countSound))
count++;
}

Expand Down Expand Up @@ -177,7 +177,7 @@ public override void Update(float frameTime)

private void ClearSounds()
{
foreach (var (stream, _) in _playingSounds.Values)
foreach (var (stream, _, _) in _playingSounds.Values)
{
stream?.Stop();
}
Expand Down Expand Up @@ -245,6 +245,8 @@ private void ProcessNearbyAmbience(TransformComponent playerXform)
var entity = comp.Owner;

if (comp.Enabled &&
// Don't keep playing sounds that have changed since.
sound.Sound == comp.Sound &&
query.TryGetComponent(entity, out var xform) &&
xform.MapID == playerXform.MapID &&
!metaQuery.GetComponent(entity).EntityPaused)
Expand All @@ -259,9 +261,9 @@ private void ProcessNearbyAmbience(TransformComponent playerXform)

sound.Stream?.Stop();
_playingSounds.Remove(comp);
_playingCount[sound.Sound] -= 1;
if (_playingCount[sound.Sound] == 0)
_playingCount.Remove(sound.Sound);
_playingCount[sound.Path] -= 1;
if (_playingCount[sound.Path] == 0)
_playingCount.Remove(sound.Path);
}

if (_playingSounds.Count >= _maxAmbientCount)
Expand Down Expand Up @@ -301,7 +303,7 @@ private void ProcessNearbyAmbience(TransformComponent playerXform)
if (stream == null)
continue;

_playingSounds[comp] = (stream, key);
_playingSounds[comp] = (stream, comp.Sound, key);
playingCount++;

if (_playingSounds.Count >= _maxAmbientCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
namespace Content.Client.Bql;

[UsedImplicitly]
public sealed class BqlResultsEui : BaseEui
public sealed class ToolshedVisualizeEui : BaseEui
{
private readonly BqlResultsWindow _window;
private readonly ToolshedVisualizeWindow _window;

public BqlResultsEui()
public ToolshedVisualizeEui()
{
_window = new BqlResultsWindow(
_window = new ToolshedVisualizeWindow(
IoCManager.Resolve<IClientConsoleHost>(),
IoCManager.Resolve<ILocalizationManager>()
);
Expand All @@ -23,7 +23,7 @@ public BqlResultsEui()

public override void HandleState(EuiStateBase state)
{
if (state is not BqlResultsEuiState castState)
if (state is not ToolshedVisualizeEuiState castState)
return;

_window.Update(castState.Entities);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
namespace Content.Client.Bql;

[GenerateTypedNameReferences]
internal sealed partial class BqlResultsWindow : DefaultWindow
internal sealed partial class ToolshedVisualizeWindow : DefaultWindow
{
private readonly IClientConsoleHost _console;
private readonly ILocalizationManager _loc;

public BqlResultsWindow(IClientConsoleHost console, ILocalizationManager loc)
public ToolshedVisualizeWindow(IClientConsoleHost console, ILocalizationManager loc)
{
_console = console;
_loc = loc;
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Content.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<Compile Update="UserInterface\Systems\Inventory\Windows\StrippingWindow.xaml.cs">
<DependentUpon>StrippingWindow.xaml</DependentUpon>
</Compile>
<Compile Update="Bql\ToolshedVisualizeWindow.xaml.cs">
<DependentUpon>ToolshedVisualizeWindow.xaml</DependentUpon>
</Compile>
</ItemGroup>

<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/PDA/Ringer/RingerBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private bool TryGetRingtone(out Note[] ringtone)
return false;
}

ringtone = new Note[4];
ringtone = new Note[_menu.RingerNoteInputs.Length];

for (int i = 0; i < _menu.RingerNoteInputs.Length; i++)
{
Expand Down
24 changes: 21 additions & 3 deletions Content.Client/PDA/Ringer/RingtoneMenu.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<DefaultWindow xmlns="https://spacestation14.io"
Title="{Loc 'comp-ringer-ui-menu-title'}"
MinSize="256 128"
SetSize="256 128">
MinSize="320 128"
SetSize="320 128">
<BoxContainer Orientation="Vertical"
VerticalExpand="True"
HorizontalExpand="True"
Expand All @@ -12,7 +12,7 @@
VerticalExpand="True"
HorizontalExpand="True"
HorizontalAlignment="Center"
MinSize="120 0">
MinSize="180 0">
<Label Name = "Indent_0Label"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Expand Down Expand Up @@ -49,6 +49,24 @@
MinSize="40 0"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
<Label Name = "Indent_4Label"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="-" />
<LineEdit Name ="RingerNoteFiveInput"
Access="Public"
MinSize="40 0"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
<Label Name = "Indent_5Label"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="-" />
<LineEdit Name ="RingerNoteSixInput"
Access="Public"
MinSize="40 0"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</BoxContainer>
</PanelContainer>
<PanelContainer>
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/PDA/Ringer/RingtoneMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ namespace Content.Client.PDA.Ringer
[GenerateTypedNameReferences]
public sealed partial class RingtoneMenu : DefaultWindow
{
public string[] PreviousNoteInputs = new[] { "A", "A", "A", "A" };
public string[] PreviousNoteInputs = new[] { "A", "A", "A", "A", "A", "A" };
public LineEdit[] RingerNoteInputs = default!;

public RingtoneMenu()
{
RobustXamlLoader.Load(this);

RingerNoteInputs = new[] { RingerNoteOneInput, RingerNoteTwoInput, RingerNoteThreeInput, RingerNoteFourInput };
RingerNoteInputs = new[] { RingerNoteOneInput, RingerNoteTwoInput, RingerNoteThreeInput, RingerNoteFourInput, RingerNoteFiveInput, RingerNoteSixInput };

for (var i = 0; i < RingerNoteInputs.Length; ++i)
{
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Stylesheets/StyleNano.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public StyleNano(IResourceCache resCache) : base(resCache)
var notoSansBold16 = resCache.NotoStack(variation: "Bold", size: 16);
var notoSansBold18 = resCache.NotoStack(variation: "Bold", size: 18);
var notoSansBold20 = resCache.NotoStack(variation: "Bold", size: 20);
var notoSansMono = resCache.GetFont("/EngineFonts/NotoSans/NotoSansMono-Regular.ttf", size: 12);
var windowHeaderTex = resCache.GetTexture("/Textures/Interface/Nano/window_header.png");
var windowHeader = new StyleBoxTexture
{
Expand Down Expand Up @@ -512,6 +513,8 @@ public StyleNano(IResourceCache resCache) : base(resCache)

Stylesheet = new Stylesheet(BaseRules.Concat(new[]
{
Element().Class("monospace")
.Prop("font", notoSansMono),
// Window title.
new StyleRule(
new SelectorElement(typeof(Label), new[] {DefaultWindow.StyleClassWindowTitle}, null, null),
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Client.Items;
using Content.Client.Weapons.Ranged.Components;
using Content.Shared.Camera;
using Content.Shared.CombatMode;
using Content.Shared.Spawners.Components;
using Content.Shared.Weapons.Ranged;
using Content.Shared.Weapons.Ranged.Components;
Expand Down Expand Up @@ -126,7 +127,7 @@ public override void Update(float frameTime)

var entityNull = _player.LocalPlayer?.ControlledEntity;

if (entityNull == null)
if (entityNull == null || !TryComp<CombatModeComponent>(entityNull, out var combat) || !combat.IsInCombatMode)
{
return;
}
Expand Down
8 changes: 8 additions & 0 deletions Content.IntegrationTests/PoolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,10 @@ public PairTracker(TextWriter testOut)
_testOut = testOut;
}

// Convenience properties.
public RobustIntegrationTest.ServerIntegrationInstance Server => Pair.Server;
public RobustIntegrationTest.ClientIntegrationInstance Client => Pair.Client;

private async Task OnDirtyDispose()
{
var usageTime = UsageWatch.Elapsed;
Expand All @@ -957,6 +961,10 @@ private async Task OnDirtyDispose()
PoolManager.NoCheckReturn(Pair);
var disposeTime = dirtyWatch.Elapsed;
await _testOut.WriteLineAsync($"{nameof(DisposeAsync)}: Disposed pair {Pair.PairId} in {disposeTime.TotalMilliseconds} ms");

// Test pairs should only dirty dispose if they are failing. If they are not failing, this probably happened
// because someone forgot to clean-return the pair.
Assert.Warn("Test was dirty-disposed.");
}

private async Task OnCleanDispose()
Expand Down
6 changes: 4 additions & 2 deletions Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Administration.Commands;
using Content.Server.Administration.Systems;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.FixedPoint;
Expand All @@ -11,7 +12,7 @@
namespace Content.IntegrationTests.Tests.Commands
{
[TestFixture]
[TestOf(typeof(RejuvenateCommand))]
[TestOf(typeof(RejuvenateSystem))]
public sealed class RejuvenateTest
{
private const string Prototypes = @"
Expand Down Expand Up @@ -42,6 +43,7 @@ public async Task RejuvenateDeadTest()
var prototypeManager = server.ResolveDependency<IPrototypeManager>();
var mobStateSystem = entManager.EntitySysManager.GetEntitySystem<MobStateSystem>();
var damSystem = entManager.EntitySysManager.GetEntitySystem<DamageableSystem>();
var rejuvenateSystem = entManager.EntitySysManager.GetEntitySystem<RejuvenateSystem>();

await server.WaitAssertion(() =>
{
Expand Down Expand Up @@ -78,7 +80,7 @@ await server.WaitAssertion(() =>
});
// Rejuvenate them
RejuvenateCommand.PerformRejuvenate(human);
rejuvenateSystem.PerformRejuvenate(human);
// Check that it is alive and with no damage
Assert.Multiple(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,14 @@ await Server.WaitPost(() =>
}

[TearDown]
public virtual async Task Cleanup()
public async Task TearDownInternal()
{
await Server.WaitPost(() => MapMan.DeleteMap(MapId));
await PairTracker.CleanReturnAsync();
await TearDown();
}

protected virtual async Task TearDown()
{
}
}
20 changes: 20 additions & 0 deletions Content.IntegrationTests/Tests/Toolshed/AdminTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.Linq;
using Robust.Shared.Toolshed;

namespace Content.IntegrationTests.Tests.Toolshed;

[TestFixture]
public sealed class AdminTest : ToolshedTest
{
[Test]
public async Task AllCommandsHavePermissions()
{
await Server.WaitAssertion(() =>
{
Assert.That(InvokeCommand("cmd:list where { acmd:perms isnull }", out var res));
var list = ((IEnumerable<CommandSpec>) res).ToList();
Assert.That(list, Is.Empty, "All commands must have admin permissions set up.");
});
}
}
Loading

0 comments on commit b5a1994

Please sign in to comment.