Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nomad0260 committed Jun 30, 2024
2 parents 21c5fa8 + 10579ca commit 1d5c0b0
Show file tree
Hide file tree
Showing 263 changed files with 52,555 additions and 53,316 deletions.
3 changes: 3 additions & 0 deletions Content.Client/Backmen/Sponsors/SponsorsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ private void OnUpdate(MsgSponsorInfo message)
Prototypes.Add("tier03");
Prototypes.Add("tier04");
Prototypes.Add("tier05");
Prototypes.Add("tier06");
Prototypes.Add("tier07");
Prototypes.Add("tier08");
#endif

if (message.Info == null)
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
using Content.Client.Administration.Managers;
using Content.Client.Administration.Managers;
using Content.Shared.CCVar;
using Robust.Client;
using Robust.Client.UserInterface;
using Robust.Shared.Configuration;


namespace Content.Client.DebugMon;

/// <summary>
/// This handles preventing certain debug monitors from appearing.
/// This handles preventing certain debug monitors from being usable by non-admins.
/// </summary>
public sealed class DebugMonitorSystem : EntitySystem
internal sealed class DebugMonitorManager
{
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IClientAdminManager _admin = default!;
[Dependency] private readonly IUserInterfaceManager _userInterface = default!;
[Dependency] private readonly IBaseClient _baseClient = default!;

public override void FrameUpdate(float frameTime)
public void FrameUpdate()
{
if (!_admin.IsActive() && _cfg.GetCVar(CCVars.DebugCoordinatesAdminOnly))
if (_baseClient.RunLevel == ClientRunLevel.InGame
&& !_admin.IsActive()
&& _cfg.GetCVar(CCVars.DebugCoordinatesAdminOnly))
{
_userInterface.DebugMonitors.SetMonitor(DebugMonitor.Coords, false);
}
}
}
11 changes: 11 additions & 0 deletions Content.Client/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Client.Administration.Managers;
using Content.Client.Changelog;
using Content.Client.Chat.Managers;
using Content.Client.DebugMon;
using Content.Client.Corvax.TTS;
using Content.Client.Options;
using Content.Client.Eui;
Expand Down Expand Up @@ -35,6 +36,7 @@
using Robust.Shared.ContentPack;
using Robust.Shared.Prototypes;
using Robust.Shared.Replays;
using Robust.Shared.Timing;

namespace Content.Client.Entry
{
Expand Down Expand Up @@ -70,6 +72,7 @@ public sealed class EntryPoint : GameClient
[Dependency] private readonly IReplayLoadManager _replayLoad = default!;
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly ContentReplayPlaybackManager _replayMan = default!;
[Dependency] private readonly DebugMonitorManager _debugMonitorManager = default!;


// start-backmen: ioc
Expand Down Expand Up @@ -230,5 +233,13 @@ private void SwitchToDefaultState(bool disconnected = false)
_stateManager.RequestStateChange<MainScreen>();
}
}

public override void Update(ModUpdateLevel level, FrameEventArgs frameEventArgs)
{
if (level == ModUpdateLevel.FramePreEngine)
{
_debugMonitorManager.FrameUpdate();
}
}
}
}
2 changes: 2 additions & 0 deletions Content.Client/Examine/ExamineSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public sealed class ExamineSystem : ExamineSystemShared

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

UpdatesOutsidePrediction = true;

SubscribeLocalEvent<GetVerbsEvent<ExamineVerb>>(AddExamineVerb);
Expand Down
2 changes: 2 additions & 0 deletions Content.Client/IoC/ClientContentIoC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Client.Chat.Managers;
using Content.Client.Clickable;
using Content.Client.Corvax.TTS;
using Content.Client.DebugMon;
using Content.Client.Eui;
using Content.Client.GhostKick;
using Content.Client.Launcher;
Expand Down Expand Up @@ -54,6 +55,7 @@ public static void Register()
collection.Register<DocumentParsingManager>();
collection.Register<ContentReplayPlaybackManager, ContentReplayPlaybackManager>();
collection.Register<ISharedPlaytimeManager, JobRequirementsManager>();
collection.Register<DebugMonitorManager>();
}
}
}
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/AudioTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<BoxContainer Orientation="Vertical" Margin="0 3 0 0">
<ui:OptionSlider Name="SliderVolumeMaster" Title="{Loc 'ui-options-master-volume'}"
Margin="0 0 0 8" />
<!-- Corvax-TTS-Start --><ui:OptionSlider Name="SliderVolumeTts" Title="{Loc 'ui-options-tts-volume'}" /><!-- Corvax-TTS-End -->
<ui:OptionSlider Name="SliderVolumeMidi" Title="{Loc 'ui-options-midi-volume'}" />
<ui:OptionSlider Name="SliderVolumeAmbientMusic" Title="{Loc 'ui-options-ambient-music-volume'}" />
<ui:OptionSlider Name="SliderVolumeAmbience" Title="{Loc 'ui-options-ambience-volume'}" />
Expand Down
7 changes: 7 additions & 0 deletions Content.Client/Options/UI/Tabs/AudioTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ public AudioTab()
scale: ContentAudioSystem.MasterVolumeMultiplier);
masterVolume.ImmediateValueChanged += OnMasterVolumeSliderChanged;

// Corvax-TTS-Start
Control.AddOptionPercentSlider(
CCCVars.TTSVolume,
SliderVolumeTts,
scale: ContentAudioSystem.TtsMultiplier);
// Corvax-TTS-End

Control.AddOptionPercentSlider(
CVars.MidiVolume,
SliderVolumeMidi,
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Storage/Systems/StorageSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using System.Numerics;
using Content.Client.Animations;
using Content.Shared.Hands;
Expand Down Expand Up @@ -69,7 +69,7 @@ public void OpenStorageWindow(Entity<StorageComponent> entity)

public void CloseStorageWindow(Entity<StorageComponent?> entity)
{
if (!Resolve(entity, ref entity.Comp))
if (!Resolve(entity, ref entity.Comp, false))
return;

if (!_openStorages.Contains((entity, entity.Comp)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,12 @@ public AlertControl(AlertPrototype alert, short? severity)
TooltipSupplier = SupplyTooltip;
Alert = alert;
_severity = severity;

_spriteViewEntity = _entityManager.Spawn(Alert.AlertViewEntity);
if (_entityManager.TryGetComponent<SpriteComponent>(_spriteViewEntity, out var sprite))
{
var icon = Alert.GetIcon(_severity);
if (sprite.LayerMapTryGet(AlertVisualLayers.Base, out var layer))
sprite.LayerSetSprite(layer, icon);
}

_icon = new SpriteView
{
Scale = new Vector2(2, 2)
};
_icon.SetEntity(_spriteViewEntity);

SetupIcon();

Children.Add(_icon);
_cooldownGraphic = new CooldownGraphic
Expand Down Expand Up @@ -113,6 +105,36 @@ protected override void FrameUpdate(FrameEventArgs args)
_cooldownGraphic.FromTime(Cooldown.Value.Start, Cooldown.Value.End);
}

private void SetupIcon()
{
if (!_entityManager.Deleted(_spriteViewEntity))
_entityManager.QueueDeleteEntity(_spriteViewEntity);

_spriteViewEntity = _entityManager.Spawn(Alert.AlertViewEntity);
if (_entityManager.TryGetComponent<SpriteComponent>(_spriteViewEntity, out var sprite))
{
var icon = Alert.GetIcon(_severity);
if (sprite.LayerMapTryGet(AlertVisualLayers.Base, out var layer))
sprite.LayerSetSprite(layer, icon);
}

_icon.SetEntity(_spriteViewEntity);
}

protected override void EnteredTree()
{
base.EnteredTree();
SetupIcon();
}

protected override void ExitedTree()
{
base.ExitedTree();

if (!_entityManager.Deleted(_spriteViewEntity))
_entityManager.QueueDeleteEntity(_spriteViewEntity);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
Expand Down
88 changes: 88 additions & 0 deletions Content.IntegrationTests/Tests/Commands/ForceMapTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using Content.Server.Maps;
using Content.Shared.CCVar;
using Robust.Shared.Configuration;
using Robust.Shared.Console;

namespace Content.IntegrationTests.Tests.Commands;

[TestFixture]
public sealed class ForceMapTest
{
private const string DefaultMapName = "Empty";
private const string BadMapName = "asdf_asd-fa__sdfAsd_f"; // Hopefully no one ever names a map this...
private const string TestMapEligibleName = "ForceMapTestEligible";
private const string TestMapIneligibleName = "ForceMapTestIneligible";

[TestPrototypes]
private static readonly string TestMaps = @$"
- type: gameMap
id: {TestMapIneligibleName}
mapName: {TestMapIneligibleName}
mapPath: /Maps/Test/empty.yml
minPlayers: 20
maxPlayers: 80
stations:
Empty:
stationProto: StandardNanotrasenStation
components:
- type: StationNameSetup
mapNameTemplate: ""Empty""
- type: gameMap
id: {TestMapEligibleName}
mapName: {TestMapEligibleName}
mapPath: /Maps/Test/empty.yml
minPlayers: 0
stations:
Empty:
stationProto: StandardNanotrasenStation
components:
- type: StationNameSetup
mapNameTemplate: ""Empty""
";

[Test]
public async Task TestForceMapCommand()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;

var entMan = server.EntMan;
var configManager = server.ResolveDependency<IConfigurationManager>();
var consoleHost = server.ResolveDependency<IConsoleHost>();
var gameMapMan = server.ResolveDependency<IGameMapManager>();

await server.WaitAssertion(() =>
{
// Make sure we're set to the default map
Assert.That(gameMapMan.GetSelectedMap()?.ID, Is.EqualTo(DefaultMapName),
$"Test didn't start on expected map ({DefaultMapName})!");

// Try changing to a map that doesn't exist
consoleHost.ExecuteCommand($"forcemap {BadMapName}");
Assert.That(gameMapMan.GetSelectedMap()?.ID, Is.EqualTo(DefaultMapName),
$"Forcemap succeeded with a map that does not exist ({BadMapName})!");

// Try changing to a valid map
consoleHost.ExecuteCommand($"forcemap {TestMapEligibleName}");
Assert.That(gameMapMan.GetSelectedMap()?.ID, Is.EqualTo(TestMapEligibleName),
$"Forcemap failed with a valid map ({TestMapEligibleName})");

// Try changing to a map that exists but is ineligible
consoleHost.ExecuteCommand($"forcemap {TestMapIneligibleName}");
Assert.That(gameMapMan.GetSelectedMap()?.ID, Is.EqualTo(TestMapIneligibleName),
$"Forcemap failed with valid but ineligible map ({TestMapIneligibleName})!");

// Try clearing the force-selected map
consoleHost.ExecuteCommand("forcemap \"\"");
Assert.That(gameMapMan.GetSelectedMap(), Is.Null,
$"Running 'forcemap \"\"' did not clear the forced map!");

});

// Cleanup
configManager.SetCVar(CCVars.GameMap, DefaultMapName);

await pair.CleanReturnAsync();
}
}
89 changes: 89 additions & 0 deletions Content.IntegrationTests/Tests/Internals/AutoInternalsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Systems;
using Content.Server.Station.Systems;
using Content.Shared.Preferences;
using Content.Shared.Roles.Jobs;

namespace Content.IntegrationTests.Tests.Internals;

[TestFixture]
[TestOf(typeof(InternalsSystem))]
public sealed class AutoInternalsTests
{
[Test]
public async Task TestInternalsAutoActivateInSpaceForStationSpawn()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;

var testMap = await pair.CreateTestMap();

var stationSpawning = server.System<StationSpawningSystem>();
var atmos = server.System<AtmosphereSystem>();
var internals = server.System<InternalsSystem>();

await server.WaitAssertion(() =>
{
var profile = new HumanoidCharacterProfile();
var dummy = stationSpawning.SpawnPlayerMob(testMap.GridCoords, new JobComponent()
{
Prototype = "TestInternalsDummy"
}, profile, station: null);

Assert.That(atmos.HasAtmosphere(testMap.Grid), Is.False, "Test map has atmosphere - test needs adjustment!");
Assert.That(internals.AreInternalsWorking(dummy), "Internals did not automatically connect!");

server.EntMan.DeleteEntity(dummy);
});

await pair.CleanReturnAsync();
}

[Test]
public async Task TestInternalsAutoActivateInSpaceForEntitySpawn()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;

var testMap = await pair.CreateTestMap();

var atmos = server.System<AtmosphereSystem>();
var internals = server.System<InternalsSystem>();

await server.WaitAssertion(() =>
{
var dummy = server.EntMan.Spawn("TestInternalsDummyEntity", testMap.MapCoords);

Assert.That(atmos.HasAtmosphere(testMap.Grid), Is.False, "Test map has atmosphere - test needs adjustment!");
Assert.That(internals.AreInternalsWorking(dummy), "Internals did not automatically connect!");

server.EntMan.DeleteEntity(dummy);
});

await pair.CleanReturnAsync();
}

[TestPrototypes]
private const string Prototypes = @"
- type: playTimeTracker
id: PlayTimeInternalsDummy
- type: startingGear
id: InternalsDummyGear
equipment:
mask: ClothingMaskBreath
suitstorage: OxygenTankFilled
- type: job
id: TestInternalsDummy
playTimeTracker: PlayTimeInternalsDummy
startingGear: InternalsDummyGear
- type: entity
id: TestInternalsDummyEntity
parent: MobHuman
components:
- type: Loadout
prototypes: [InternalsDummyGear]
";
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public sealed partial class GasVentPumpComponent : Component
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("underPressureLockoutThreshold")]
public float UnderPressureLockoutThreshold = 60; // this must be tuned in conjunction with atmos.mmos_spacing_speed
public float UnderPressureLockoutThreshold = 80; // this must be tuned in conjunction with atmos.mmos_spacing_speed

/// <summary>
/// Pressure locked vents still leak a little (leading to eventual pressurization of sealed sections)
Expand Down
Loading

0 comments on commit 1d5c0b0

Please sign in to comment.