Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
BurningRash committed Jul 5, 2022
2 parents 7308be5 + f9f460a commit 0c0d7b4
Show file tree
Hide file tree
Showing 246 changed files with 16,476 additions and 12,457 deletions.
19 changes: 15 additions & 4 deletions Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,27 @@ void DrawPressureDirection(
DrawPressureDirection(drawHandle, data.LastPressureDirection, tile, Color.LightGray);
}

var tilePos = new Vector2(tile.X, tile.Y);

// -- Excited Groups --
if (data.InExcitedGroup)
if (data.InExcitedGroup != 0)
{
var tilePos = new Vector2(tile.X, tile.Y);
var basisA = tilePos;
var basisB = tilePos + new Vector2(1.0f, 1.0f);
var basisC = tilePos + new Vector2(0.0f, 1.0f);
var basisD = tilePos + new Vector2(1.0f, 0.0f);
drawHandle.DrawLine(basisA, basisB, Color.Cyan);
drawHandle.DrawLine(basisC, basisD, Color.Cyan);
var color = Color.White // Use first three nibbles for an unique color... Good enough?
.WithRed( data.InExcitedGroup & 0x000F)
.WithGreen((data.InExcitedGroup & 0x00F0) >>4)
.WithBlue( (data.InExcitedGroup & 0x0F00) >>8);
drawHandle.DrawLine(basisA, basisB, color);
drawHandle.DrawLine(basisC, basisD, color);
}

// -- Space Tiles --
if (data.IsSpace)
{
drawHandle.DrawCircle(tilePos + Vector2.One/2, 0.125f, Color.Orange);
}
}
}
Expand Down
51 changes: 0 additions & 51 deletions Content.Client/Audio/ClientAdminSoundSystem.cs

This file was deleted.

113 changes: 113 additions & 0 deletions Content.Client/Audio/ClientGlobalSoundSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
using Content.Shared.Audio;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Robust.Shared.Audio;
using Robust.Shared.Configuration;
using Robust.Shared.Player;

namespace Content.Client.Audio;

public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
{
[Dependency] private readonly IConfigurationManager _cfg = default!;

// Admin music
private bool _adminAudioEnabled = true;
private List<IPlayingAudioStream?> _adminAudio = new(1);

// Event sounds (e.g. nuke timer)
private bool _eventAudioEnabled = true;
private Dictionary<StationEventMusicType, IPlayingAudioStream?> _eventAudio = new(1);

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
SubscribeNetworkEvent<AdminSoundEvent>(PlayAdminSound);
_cfg.OnValueChanged(CCVars.AdminSoundsEnabled, ToggleAdminSound, true);

SubscribeNetworkEvent<StationEventMusicEvent>(PlayStationEventMusic);
SubscribeNetworkEvent<StopStationEventMusic>(StopStationEventMusic);
_cfg.OnValueChanged(CCVars.EventMusicEnabled, ToggleStationEventMusic, true);

SubscribeNetworkEvent<GameGlobalSoundEvent>(PlayGameSound);
}

private void OnRoundRestart(RoundRestartCleanupEvent ev)
{
ClearAudio();
}

public override void Shutdown()
{
base.Shutdown();
ClearAudio();
}

private void ClearAudio()
{
foreach (var stream in _adminAudio)
{
stream?.Stop();
}
_adminAudio.Clear();

foreach (var (_, stream) in _eventAudio)
{
stream?.Stop();
}

_eventAudio.Clear();
}

private void PlayAdminSound(AdminSoundEvent soundEvent)
{
if(!_adminAudioEnabled) return;

var stream = SoundSystem.Play(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
_adminAudio.Add(stream);
}

private void PlayStationEventMusic(StationEventMusicEvent soundEvent)
{
// Either the cvar is disabled or it's already playing
if(!_eventAudioEnabled || _eventAudio.ContainsKey(soundEvent.Type)) return;

var stream = SoundSystem.Play(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
_eventAudio.Add(soundEvent.Type, stream);
}

private void PlayGameSound(GameGlobalSoundEvent soundEvent)
{
SoundSystem.Play(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
}

private void StopStationEventMusic(StopStationEventMusic soundEvent)
{
if (!_eventAudio.TryGetValue(soundEvent.Type, out var stream)) return;
stream?.Stop();
_eventAudio.Remove(soundEvent.Type);
}

private void ToggleAdminSound(bool enabled)
{
_adminAudioEnabled = enabled;
if (_adminAudioEnabled) return;
foreach (var stream in _adminAudio)
{
stream?.Stop();
}
_adminAudio.Clear();
}

private void ToggleStationEventMusic(bool enabled)
{
_eventAudioEnabled = enabled;
if (_eventAudioEnabled) return;
foreach (var stream in _eventAudio)
{
stream.Value?.Stop();
}
_eventAudio.Clear();
}
}
1 change: 1 addition & 0 deletions Content.Client/EscapeMenu/UI/Tabs/AudioTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
</BoxContainer>
<Control MinSize="0 8" />
<CheckBox Name="LobbyMusicCheckBox" Text="{Loc 'ui-options-lobby-music'}" />
<CheckBox Name="EventMusicCheckBox" Text="{Loc 'ui-options-event-music'}" />
<CheckBox Name="AdminSoundsCheckBox" Text="{Loc 'ui-options-admin-sounds'}" />
<CheckBox Name="StationAmbienceCheckBox" Text="{Loc 'ui-options-station-ambience'}" />
<CheckBox Name="SpaceAmbienceCheckBox" Text="{Loc 'ui-options-space-ambience'}" />
Expand Down
14 changes: 12 additions & 2 deletions Content.Client/EscapeMenu/UI/Tabs/AudioTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public AudioTab()
IoCManager.InjectDependencies(this);

LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled);
AdminSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.AdminSoundsEnabled);
StationAmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.StationAmbienceEnabled);
SpaceAmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.SpaceAmbienceEnabled);
Expand All @@ -33,6 +34,7 @@ public AudioTab()
AmbienceVolumeSlider.OnValueChanged += OnAmbienceVolumeSliderChanged;
AmbienceSoundsSlider.OnValueChanged += OnAmbienceSoundsSliderChanged;
LobbyMusicCheckBox.OnToggled += OnLobbyMusicCheckToggled;
EventMusicCheckBox.OnToggled += OnEventMusicCheckToggled;
AdminSoundsCheckBox.OnToggled += OnAdminSoundsCheckToggled;
StationAmbienceCheckBox.OnToggled += OnStationAmbienceCheckToggled;
SpaceAmbienceCheckBox.OnToggled += OnSpaceAmbienceCheckToggled;
Expand Down Expand Up @@ -79,11 +81,16 @@ private void OnLobbyMusicCheckToggled(BaseButton.ButtonEventArgs args)
UpdateChanges();
}

private void OnEventMusicCheckToggled(BaseButton.ButtonEventArgs args)
{
UpdateChanges();
}

private void OnAdminSoundsCheckToggled(BaseButton.ButtonEventArgs args)
{
UpdateChanges();
}

private void OnStationAmbienceCheckToggled(BaseButton.ButtonEventArgs args)
{
UpdateChanges();
Expand All @@ -101,6 +108,7 @@ private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
_cfg.SetCVar(CCVars.AmbienceVolume, LV100ToDB(AmbienceVolumeSlider.Value));
_cfg.SetCVar(CCVars.MaxAmbientSources, (int)AmbienceSoundsSlider.Value);
_cfg.SetCVar(CCVars.LobbyMusicEnabled, LobbyMusicCheckBox.Pressed);
_cfg.SetCVar(CCVars.EventMusicEnabled, EventMusicCheckBox.Pressed);
_cfg.SetCVar(CCVars.AdminSoundsEnabled, AdminSoundsCheckBox.Pressed);
_cfg.SetCVar(CCVars.StationAmbienceEnabled, StationAmbienceCheckBox.Pressed);
_cfg.SetCVar(CCVars.SpaceAmbienceEnabled, SpaceAmbienceCheckBox.Pressed);
Expand All @@ -120,6 +128,7 @@ private void Reset()
AmbienceVolumeSlider.Value = DBToLV100(_cfg.GetCVar(CCVars.AmbienceVolume));
AmbienceSoundsSlider.Value = _cfg.GetCVar(CCVars.MaxAmbientSources);
LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled);
AdminSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.AdminSoundsEnabled);
StationAmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.StationAmbienceEnabled);
SpaceAmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.SpaceAmbienceEnabled);
Expand Down Expand Up @@ -149,10 +158,11 @@ private void UpdateChanges()
Math.Abs(AmbienceVolumeSlider.Value - DBToLV100(_cfg.GetCVar(CCVars.AmbienceVolume))) < 0.01f;
var isAmbientSoundsSame = (int)AmbienceSoundsSlider.Value == _cfg.GetCVar(CCVars.MaxAmbientSources);
var isLobbySame = LobbyMusicCheckBox.Pressed == _cfg.GetCVar(CCVars.LobbyMusicEnabled);
var isEventSame = EventMusicCheckBox.Pressed == _cfg.GetCVar(CCVars.EventMusicEnabled);
var isAdminSoundsSame = AdminSoundsCheckBox.Pressed == _cfg.GetCVar(CCVars.AdminSoundsEnabled);
var isStationAmbienceSame = StationAmbienceCheckBox.Pressed == _cfg.GetCVar(CCVars.StationAmbienceEnabled);
var isSpaceAmbienceSame = SpaceAmbienceCheckBox.Pressed == _cfg.GetCVar(CCVars.SpaceAmbienceEnabled);
var isEverythingSame = isMasterVolumeSame && isMidiVolumeSame && isAmbientVolumeSame && isAmbientSoundsSame && isLobbySame && isAdminSoundsSame && isStationAmbienceSame && isSpaceAmbienceSame;
var isEverythingSame = isMasterVolumeSame && isMidiVolumeSame && isAmbientVolumeSame && isAmbientSoundsSame && isLobbySame && isEventSame && isAdminSoundsSame && isStationAmbienceSame && isSpaceAmbienceSame;
ApplyButton.Disabled = isEverythingSame;
ResetButton.Disabled = isEverythingSame;
MasterVolumeLabel.Text =
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Nuke/NukeMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void UpdateState(NukeUiState state)
FirstStatusLabel.Text = firstMsg;
SecondStatusLabel.Text = secondMsg;

EjectButton.Disabled = !state.DiskInserted;
EjectButton.Disabled = !state.DiskInserted || state.Status == NukeStatus.ARMED;
AnchorButton.Disabled = !state.DiskInserted;
AnchorButton.Pressed = state.IsAnchored;
ArmButton.Disabled = !state.AllowArm;
Expand Down
2 changes: 2 additions & 0 deletions Content.IntegrationTests/PoolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Content.Client.IoC;
using Content.Client.Parallax.Managers;
using Content.IntegrationTests.Tests;
using Content.IntegrationTests.Tests.Destructible;
using Content.IntegrationTests.Tests.DeviceNetwork;
using Content.IntegrationTests.Tests.Interaction.Click;
using Content.IntegrationTests.Tests.Networking;
Expand Down Expand Up @@ -106,6 +107,7 @@ await instance.WaitPost(() =>
IoCManager.Resolve<IEntitySystemManager>()
.LoadExtraSystemType<InteractionSystemTests.TestInteractionSystem>();
IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<DeviceNetworkTestSystem>();
IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<TestDestructibleListenerSystem>();
IoCManager.Resolve<ILogManager>().GetSawmill("loc").Level = LogLevel.Error;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ await server.WaitPost(() =>
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageTypeEntityId, coordinates);
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity);
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
sTestThresholdListenerSystem.ThresholdsReached.Clear();
sDamageableSystem = sEntitySystemManager.GetEntitySystem<DamageableSystem>();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ await server.WaitPost(() =>

sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDestructionEntityId, coordinates);
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
sTestThresholdListenerSystem.ThresholdsReached.Clear();
});

await server.WaitAssertion(() =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
using System.Collections.Generic;
using Content.Server.Destructible;
using Content.Shared.GameTicking;
using Content.Shared.Module;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Reflection;

namespace Content.IntegrationTests.Tests.Destructible
{
/// <summary>
/// This is just a system for testing destructible thresholds. Whenever any threshold is reached, this will add that
/// threshold to a list for checking during testing.
/// </summary>
[Reflect(false)]
public sealed class TestDestructibleListenerSystem : EntitySystem
{
[Dependency] private readonly IModuleManager _modManager;

public readonly List<DamageThresholdReached> ThresholdsReached = new();

public override void Initialize()
{
base.Initialize();

if (_modManager.IsClientModule)
return;

SubscribeLocalEvent<DestructibleComponent, DamageThresholdReached>(AddThresholdsToList);
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
}
Expand Down
7 changes: 3 additions & 4 deletions Content.IntegrationTests/Tests/DummyIconTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using NUnit.Framework;
using Robust.Client.GameObjects;
using Robust.Client.ResourceManagement;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;

namespace Content.IntegrationTests.Tests
Expand All @@ -17,11 +18,10 @@ public async Task Test()
await using var pairTracker = await PoolManager.GetServerClient();
var client = pairTracker.Pair.Client;

var prototypeManager = client.ResolveDependency<IPrototypeManager>();
var resourceCache = client.ResolveDependency<IResourceCache>();
await client.WaitRunTicks(5);
await client.WaitAssertion(() =>
{
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
var resourceCache = IoCManager.Resolve<IResourceCache>();
foreach (var proto in prototypeManager.EnumeratePrototypes<EntityPrototype>())
{
if (proto.NoSpawn || proto.Abstract || !proto.Components.ContainsKey("Sprite")) continue;
Expand All @@ -33,7 +33,6 @@ await client.WaitAssertion(() =>
proto.ID);
}
});
await client.WaitRunTicks(5);
await pairTracker.CleanReturnAsync();
}
}
Expand Down
8 changes: 8 additions & 0 deletions Content.Server/Access/Components/IdExaminableComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Server.Access.Systems;

namespace Content.Server.Access.Components;

[RegisterComponent, Access(typeof(IdExaminableSystem))]
public sealed class IdExaminableComponent : Component
{
}
Loading

0 comments on commit 0c0d7b4

Please sign in to comment.