forked from Rxup/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/nomad0260/space-station-14-
- Loading branch information
Showing
263 changed files
with
52,555 additions
and
53,316 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
Empty file.
17 changes: 11 additions & 6 deletions
17
...ent.Client/DebugMon/DebugMonitorSystem.cs → ...nt.Client/DebugMon/DebugMonitorManager.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 |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |
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
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
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,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
89
Content.IntegrationTests/Tests/Internals/AutoInternalsTests.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,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] | ||
"; | ||
} |
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.