Add test pooling (#4961)
* Add test pooling * WIP test pooling changes * Fix Destructible tests * Don't pool unpooled or dummy ticker instances * Change ServerPathfindingDebugSystem to replace existing entries * Fix SaveLoadSaveTest comment * Don't pool StartTest * Comment out global setup * Fix puddle tests * Move SolarPanelComponent initialize to PowerSolarSystem OnMapInit * Update RobustToolbox * Finish fixing tests, make test threads background threads * Bring back pooling * Fix nullable * Update RobustToolbox * Set cvars on server return * Un-pool tests with custom cvars * Update RobustToolbox * Update RobustToolbox * Change where the main tile coordinates are * Remove DisposalUnitTest grid check * Fix test pooling being a fickle bitch * Fix EntitySystemExtensionsTest * Update RobustToolbox * Update RobustToolbox * Make nullable pool settings true * Update RobustToolbox * Wait other way around * We are unitystation now * Update RobustToolbox * Create global setup * Pool some more tests * Fix not properly disconnecting clients before restarting the round * Give more info on ran tests * Standardize default test cvars * Update RobustToolbox * Update RobustToolbox * Pool clients * Fix test order issue * Fix cvars in character creation test not being set properly * Update RobustToolbox * Update RobustToolbox * Rider shut * Update RobustToolbox * Format tests ran better * Update RobustToolbox * Reset RobustToolbox * Reset RobustToolbox harder * Fix one instance of test order causing destructible tests to fail
This commit is contained in:
committed by
GitHub
parent
4b5168e1fe
commit
1508efff54
@@ -1,31 +1,56 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Content.Client.Entry;
|
||||||
using Content.Client.IoC;
|
using Content.Client.IoC;
|
||||||
using Content.Client.Parallax.Managers;
|
using Content.Client.Parallax.Managers;
|
||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.IoC;
|
using Content.Server.IoC;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Moq;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Client;
|
using Robust.Client;
|
||||||
using Robust.Server;
|
using Robust.Server;
|
||||||
using Robust.Server.Maps;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared;
|
|
||||||
using Robust.Shared.ContentPack;
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.UnitTesting;
|
using Robust.UnitTesting;
|
||||||
using EntryPoint = Content.Client.Entry.EntryPoint;
|
|
||||||
|
|
||||||
namespace Content.IntegrationTests
|
namespace Content.IntegrationTests
|
||||||
{
|
{
|
||||||
[Parallelizable(ParallelScope.All)]
|
[Parallelizable(ParallelScope.All)]
|
||||||
public abstract class ContentIntegrationTest : RobustIntegrationTest
|
public abstract class ContentIntegrationTest : RobustIntegrationTest
|
||||||
{
|
{
|
||||||
|
private static readonly (string cvar, string value, bool)[] ServerTestCvars = {
|
||||||
|
// Avoid funny race conditions with the database.
|
||||||
|
(CCVars.DatabaseSynchronous.Name, "true", false),
|
||||||
|
|
||||||
|
// Disable holidays as some of them might mess with the map at round start.
|
||||||
|
(CCVars.HolidaysEnabled.Name, "false", false),
|
||||||
|
|
||||||
|
// Avoid loading a large map by default for integration tests if none has been specified.
|
||||||
|
(CCVars.GameMap.Name, "Maps/Test/empty.yml", true)
|
||||||
|
};
|
||||||
|
|
||||||
|
private static void SetServerTestCvars(IntegrationOptions options)
|
||||||
|
{
|
||||||
|
foreach (var (cvar, value, tryAdd) in ServerTestCvars)
|
||||||
|
{
|
||||||
|
if (tryAdd)
|
||||||
|
{
|
||||||
|
options.CVarOverrides.TryAdd(cvar, value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
options.CVarOverrides[cvar] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected sealed override ClientIntegrationInstance StartClient(ClientIntegrationOptions options = null)
|
protected sealed override ClientIntegrationInstance StartClient(ClientIntegrationOptions options = null)
|
||||||
{
|
{
|
||||||
options ??= new ClientContentIntegrationOption()
|
options ??= new ClientContentIntegrationOption()
|
||||||
@@ -33,6 +58,8 @@ namespace Content.IntegrationTests
|
|||||||
FailureLogLevel = LogLevel.Warning
|
FailureLogLevel = LogLevel.Warning
|
||||||
};
|
};
|
||||||
|
|
||||||
|
options.Pool = ShouldPool(options, false);
|
||||||
|
|
||||||
// Load content resources, but not config and user data.
|
// Load content resources, but not config and user data.
|
||||||
options.Options = new GameControllerOptions()
|
options.Options = new GameControllerOptions()
|
||||||
{
|
{
|
||||||
@@ -71,11 +98,14 @@ namespace Content.IntegrationTests
|
|||||||
|
|
||||||
protected override ServerIntegrationInstance StartServer(ServerIntegrationOptions options = null)
|
protected override ServerIntegrationInstance StartServer(ServerIntegrationOptions options = null)
|
||||||
{
|
{
|
||||||
options ??= new ServerContentIntegrationOption()
|
options ??= new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
FailureLogLevel = LogLevel.Warning
|
FailureLogLevel = LogLevel.Warning,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SetServerTestCvars(options);
|
||||||
|
options.Pool = ShouldPool(options, true);
|
||||||
|
|
||||||
// Load content resources, but not config and user data.
|
// Load content resources, but not config and user data.
|
||||||
options.Options = new ServerOptions()
|
options.Options = new ServerOptions()
|
||||||
{
|
{
|
||||||
@@ -108,16 +138,6 @@ namespace Content.IntegrationTests
|
|||||||
IoCManager.Resolve<ILogManager>().GetSawmill("loc").Level = LogLevel.Error;
|
IoCManager.Resolve<ILogManager>().GetSawmill("loc").Level = LogLevel.Error;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Avoid funny race conditions with the database.
|
|
||||||
options.CVarOverrides[CCVars.DatabaseSynchronous.Name] = "true";
|
|
||||||
|
|
||||||
// Disable holidays as some of them might mess with the map at round start.
|
|
||||||
options.CVarOverrides[CCVars.HolidaysEnabled.Name] = "false";
|
|
||||||
|
|
||||||
// Avoid loading a large map by default for integration tests if none has been specified.
|
|
||||||
if(!options.CVarOverrides.ContainsKey(CCVars.GameMap.Name))
|
|
||||||
options.CVarOverrides[CCVars.GameMap.Name] = "Maps/Test/empty.yml";
|
|
||||||
|
|
||||||
return base.StartServer(options);
|
return base.StartServer(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +170,6 @@ namespace Content.IntegrationTests
|
|||||||
return (client, server);
|
return (client, server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected async Task<(ClientIntegrationInstance client, ServerIntegrationInstance server)>
|
protected async Task<(ClientIntegrationInstance client, ServerIntegrationInstance server)>
|
||||||
StartConnectedServerDummyTickerClientPair(ClientIntegrationOptions clientOptions = null,
|
StartConnectedServerDummyTickerClientPair(ClientIntegrationOptions clientOptions = null,
|
||||||
ServerIntegrationOptions serverOptions = null)
|
ServerIntegrationOptions serverOptions = null)
|
||||||
@@ -163,30 +182,129 @@ namespace Content.IntegrationTests
|
|||||||
return (client, server);
|
return (client, server);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<IMapGrid> InitializeMap(ServerIntegrationInstance server, string mapPath)
|
private bool ShouldPool(IntegrationOptions options, bool server)
|
||||||
{
|
{
|
||||||
await server.WaitIdleAsync();
|
if (options.Pool == false)
|
||||||
|
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
|
||||||
var pauseManager = server.ResolveDependency<IPauseManager>();
|
|
||||||
var mapLoader = server.ResolveDependency<IMapLoader>();
|
|
||||||
|
|
||||||
IMapGrid grid = null;
|
|
||||||
|
|
||||||
server.Post(() =>
|
|
||||||
{
|
{
|
||||||
var mapId = mapManager.CreateMap();
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
pauseManager.AddUninitializedMap(mapId);
|
if (server)
|
||||||
|
{
|
||||||
|
if (options.CVarOverrides.Count != 3)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
grid = mapLoader.LoadBlueprint(mapId, mapPath);
|
foreach (var (cvar, value, _) in ServerTestCvars)
|
||||||
|
{
|
||||||
|
if (!options.CVarOverrides.TryGetValue(cvar, out var actualValue) ||
|
||||||
|
actualValue != value)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pauseManager.DoMapInitialize(mapId);
|
if (options.CVarOverrides.TryGetValue(CCVars.GameDummyTicker.Name, out var dummy) &&
|
||||||
|
dummy == "true")
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.CVarOverrides.TryGetValue(CCVars.GameLobbyEnabled.Name, out var lobby) &&
|
||||||
|
lobby == "true")
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options is ClientContentIntegrationOption {ContentBeforeIoC: { }}
|
||||||
|
or ServerContentIntegrationOption {ContentBeforeIoC: { }})
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return options.InitIoC == null &&
|
||||||
|
options.BeforeStart == null &&
|
||||||
|
options.ContentAssemblies == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnClientReturn(ClientIntegrationInstance client)
|
||||||
|
{
|
||||||
|
await base.OnClientReturn(client);
|
||||||
|
|
||||||
|
await client.WaitIdleAsync();
|
||||||
|
|
||||||
|
var net = client.ResolveDependency<IClientNetManager>();
|
||||||
|
var prototypes = client.ResolveDependency<IPrototypeManager>();
|
||||||
|
|
||||||
|
await client.WaitPost(() =>
|
||||||
|
{
|
||||||
|
net.ClientDisconnect("Test pooling disconnect");
|
||||||
|
|
||||||
|
if (client.PreviousOptions?.ExtraPrototypes is { } oldExtra)
|
||||||
|
{
|
||||||
|
prototypes.RemoveString(oldExtra);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (client.Options?.ExtraPrototypes is { } extra)
|
||||||
|
{
|
||||||
|
prototypes.LoadString(extra, true);
|
||||||
|
prototypes.Resync();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await WaitUntil(client, () => !net.IsConnected);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnServerReturn(ServerIntegrationInstance server)
|
||||||
|
{
|
||||||
|
await base.OnServerReturn(server);
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
return grid;
|
if (server.Options != null)
|
||||||
|
{
|
||||||
|
SetServerTestCvars(server.Options);
|
||||||
|
}
|
||||||
|
|
||||||
|
var systems = server.ResolveDependency<IEntitySystemManager>();
|
||||||
|
var prototypes = server.ResolveDependency<IPrototypeManager>();
|
||||||
|
var net = server.ResolveDependency<IServerNetManager>();
|
||||||
|
var players = server.ResolveDependency<IPlayerManager>();
|
||||||
|
|
||||||
|
var gameTicker = systems.GetEntitySystem<GameTicker>();
|
||||||
|
|
||||||
|
await server.WaitPost(() =>
|
||||||
|
{
|
||||||
|
foreach (var channel in net.Channels)
|
||||||
|
{
|
||||||
|
net.DisconnectChannel(channel, "Test pooling disconnect");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await WaitUntil(server, () => players.PlayerCount == 0);
|
||||||
|
|
||||||
|
await server.WaitPost(() =>
|
||||||
|
{
|
||||||
|
gameTicker.RestartRound();
|
||||||
|
|
||||||
|
if (server.PreviousOptions?.ExtraPrototypes is { } oldExtra)
|
||||||
|
{
|
||||||
|
prototypes.RemoveString(oldExtra);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (server.Options?.ExtraPrototypes is { } extra)
|
||||||
|
{
|
||||||
|
prototypes.LoadString(extra, true);
|
||||||
|
prototypes.Resync();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!gameTicker.DummyTicker)
|
||||||
|
{
|
||||||
|
await WaitUntil(server, () => gameTicker.RunLevel == GameRunLevel.InRound);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task WaitUntil(IntegrationInstance instance, Func<bool> func, int maxTicks = 600,
|
protected async Task WaitUntil(IntegrationInstance instance, Func<bool> func, int maxTicks = 600,
|
||||||
@@ -211,6 +329,12 @@ namespace Content.IntegrationTests
|
|||||||
ticksAwaited += ticksToRun;
|
ticksAwaited += ticksToRun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!passed)
|
||||||
|
{
|
||||||
|
Assert.Fail($"Condition did not pass after {maxTicks} ticks.\n" +
|
||||||
|
$"Tests ran ({instance.TestsRan.Count}):\n" +
|
||||||
|
$"{string.Join('\n', instance.TestsRan)}");
|
||||||
|
}
|
||||||
Assert.That(passed);
|
Assert.That(passed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,6 +363,30 @@ namespace Content.IntegrationTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected MapId GetMainMapId(IMapManager manager)
|
||||||
|
{
|
||||||
|
// TODO a heuristic that is not this bad
|
||||||
|
return manager.GetAllMapIds().Last();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IMapGrid GetMainGrid(IMapManager manager)
|
||||||
|
{
|
||||||
|
// TODO a heuristic that is not this bad
|
||||||
|
return manager.GetAllGrids().First();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected TileRef GetMainTile(IMapGrid grid)
|
||||||
|
{
|
||||||
|
// TODO a heuristic that is not this bad
|
||||||
|
return grid.GetAllTiles().First();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected EntityCoordinates GetMainEntityCoordinates(IMapManager manager)
|
||||||
|
{
|
||||||
|
var gridId = GetMainGrid(manager).GridEntityId;
|
||||||
|
return new EntityCoordinates(gridId, -0.5f, -0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
protected sealed class ClientContentIntegrationOption : ClientIntegrationOptions
|
protected sealed class ClientContentIntegrationOption : ClientIntegrationOptions
|
||||||
{
|
{
|
||||||
public ClientContentIntegrationOption()
|
public ClientContentIntegrationOption()
|
||||||
|
|||||||
15
Content.IntegrationTests/ContentIntegrationTestSetup.cs
Normal file
15
Content.IntegrationTests/ContentIntegrationTestSetup.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
[SetUpFixture]
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
|
public class ContentIntegrationTestSetup
|
||||||
|
{
|
||||||
|
[OneTimeTearDown]
|
||||||
|
public void TearDown()
|
||||||
|
{
|
||||||
|
var robustSetup = new RobustIntegrationTestSetup();
|
||||||
|
|
||||||
|
robustSetup.Shutdown();
|
||||||
|
robustSetup.PrintTestPoolingInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,6 @@ using Content.Server.AI.Utility.AiLogic;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Reflection;
|
using Robust.Shared.Reflection;
|
||||||
using YamlDotNet.RepresentationModel;
|
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.AI
|
namespace Content.IntegrationTests.Tests.AI
|
||||||
{
|
{
|
||||||
@@ -18,8 +17,7 @@ namespace Content.IntegrationTests.Tests.AI
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestBehaviorSets()
|
public async Task TestBehaviorSets()
|
||||||
{
|
{
|
||||||
var options = new ServerIntegrationOptions();
|
var server = StartServer();
|
||||||
var server = StartServerDummyTicker(options);
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Content.Tests.Server.GameObjects.Components.Access
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestTags()
|
public async Task TestTags()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var system = EntitySystem.Get<AccessReaderSystem>();
|
var system = EntitySystem.Get<AccessReaderSystem>();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TotalGasesTest()
|
public async Task TotalGasesTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestMerge()
|
public async Task TestMerge()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
|||||||
[TestCase(Atmospherics.BreathPercentage)]
|
[TestCase(Atmospherics.BreathPercentage)]
|
||||||
public async Task RemoveRatio(float ratio)
|
public async Task RemoveRatio(float ratio)
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
public async Task RemoveLegsFallTest()
|
public async Task RemoveLegsFallTest()
|
||||||
{
|
{
|
||||||
var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes};
|
var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
AppearanceComponent appearance = null;
|
AppearanceComponent appearance = null;
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
public async Task AirConsistencyTest()
|
public async Task AirConsistencyTest()
|
||||||
{
|
{
|
||||||
var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes};
|
var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
@@ -139,7 +139,7 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
public async Task NoSuffocationTest()
|
public async Task NoSuffocationTest()
|
||||||
{
|
{
|
||||||
var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes};
|
var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
public async Task EventsTest()
|
public async Task EventsTest()
|
||||||
{
|
{
|
||||||
var options = new ServerContentIntegrationOption {ExtraPrototypes = Prototypes};
|
var options = new ServerContentIntegrationOption {ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ using Content.Shared.Body.Components;
|
|||||||
using Content.Shared.Body.Part;
|
using Content.Shared.Body.Part;
|
||||||
using Content.Shared.Buckle.Components;
|
using Content.Shared.Buckle.Components;
|
||||||
using Content.Shared.Coordinates;
|
using Content.Shared.Coordinates;
|
||||||
using Content.Shared.Interaction.Events;
|
|
||||||
using Content.Shared.Movement;
|
|
||||||
using Content.Shared.Standing;
|
using Content.Shared.Standing;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
@@ -73,8 +71,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||||
var standingState = EntitySystem.Get<StandingStateSystem>();
|
var standingState = EntitySystem.Get<StandingStateSystem>();
|
||||||
|
|
||||||
var gridId = new GridId(1);
|
var grid = GetMainGrid(mapManager);
|
||||||
var grid = mapManager.GetGrid(gridId);
|
|
||||||
var coordinates = grid.GridEntityId.ToCoordinates();
|
var coordinates = grid.GridEntityId.ToCoordinates();
|
||||||
|
|
||||||
human = entityManager.SpawnEntity(BuckleDummyId, coordinates);
|
human = entityManager.SpawnEntity(BuckleDummyId, coordinates);
|
||||||
@@ -235,8 +232,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
var gridId = new GridId(1);
|
var grid = GetMainGrid(mapManager);
|
||||||
var grid = mapManager.GetGrid(gridId);
|
|
||||||
var coordinates = grid.GridEntityId.ToCoordinates();
|
var coordinates = grid.GridEntityId.ToCoordinates();
|
||||||
|
|
||||||
human = entityManager.SpawnEntity(BuckleDummyId, coordinates);
|
human = entityManager.SpawnEntity(BuckleDummyId, coordinates);
|
||||||
@@ -321,8 +317,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
var gridId = new GridId(1);
|
var grid = GetMainGrid(mapManager);
|
||||||
var grid = mapManager.GetGrid(gridId);
|
|
||||||
var coordinates = grid.GridEntityId.ToCoordinates();
|
var coordinates = grid.GridEntityId.ToCoordinates();
|
||||||
|
|
||||||
human = entityManager.SpawnEntity(BuckleDummyId, coordinates);
|
human = entityManager.SpawnEntity(BuckleDummyId, coordinates);
|
||||||
|
|||||||
@@ -19,13 +19,14 @@ namespace Content.IntegrationTests.Tests.Chemistry
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TryAllTest()
|
public async Task TryAllTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
|
||||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||||
var prototypeManager = server.ResolveDependency<IPrototypeManager>();
|
var prototypeManager = server.ResolveDependency<IPrototypeManager>();
|
||||||
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
|
var coordinates = GetMainEntityCoordinates(mapManager);
|
||||||
|
|
||||||
foreach (var reactionPrototype in prototypeManager.EnumeratePrototypes<ReactionPrototype>())
|
foreach (var reactionPrototype in prototypeManager.EnumeratePrototypes<ReactionPrototype>())
|
||||||
{
|
{
|
||||||
@@ -37,9 +38,7 @@ namespace Content.IntegrationTests.Tests.Chemistry
|
|||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
mapManager.CreateNewMapEntity(MapId.Nullspace);
|
beaker = entityManager.SpawnEntity("BluespaceBeaker", coordinates);
|
||||||
|
|
||||||
beaker = entityManager.SpawnEntity("BluespaceBeaker", MapCoordinates.Nullspace);
|
|
||||||
Assert.That(EntitySystem.Get<SolutionContainerSystem>()
|
Assert.That(EntitySystem.Get<SolutionContainerSystem>()
|
||||||
.TryGetSolution(beaker.Uid, "beaker", out component));
|
.TryGetSolution(beaker.Uid, "beaker", out component));
|
||||||
foreach (var (id, reactant) in reactionPrototype.Reactants)
|
foreach (var (id, reactant) in reactionPrototype.Reactants)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Content.IntegrationTests.Tests.Commands
|
|||||||
public async Task RejuvenateDeadTest()
|
public async Task RejuvenateDeadTest()
|
||||||
{
|
{
|
||||||
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Content.IntegrationTests.Tests.Construction
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task ConstructionGraphSpawnPrototypeValid()
|
public async Task ConstructionGraphSpawnPrototypeValid()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ namespace Content.IntegrationTests.Tests.Construction
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task ConstructionGraphNodeEntityPrototypeValid()
|
public async Task ConstructionGraphNodeEntityPrototypeValid()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ namespace Content.IntegrationTests.Tests.Construction
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task ConstructionGraphEdgeValid()
|
public async Task ConstructionGraphEdgeValid()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Shared.Construction.Prototypes;
|
using Content.Shared.Construction.Prototypes;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@@ -12,7 +11,7 @@ namespace Content.IntegrationTests.Tests.Construction
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestStartIsValid()
|
public async Task TestStartIsValid()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ namespace Content.IntegrationTests.Tests.Construction
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestTargetIsValid()
|
public async Task TestTargetIsValid()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@ namespace Content.IntegrationTests.Tests.Construction
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestStartReachesTarget()
|
public async Task TestStartReachesTarget()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using Content.Shared.Damage.Prototypes;
|
|||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
||||||
@@ -20,7 +19,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task AndTest()
|
public async Task AndTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
ExtraPrototypes = Prototypes
|
ExtraPrototypes = Prototypes
|
||||||
});
|
});
|
||||||
@@ -39,13 +38,15 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
|
|
||||||
await server.WaitPost(() =>
|
await server.WaitPost(() =>
|
||||||
{
|
{
|
||||||
var mapId = new MapId(1);
|
var gridId = GetMainGrid(sMapManager).GridEntityId;
|
||||||
var coordinates = new MapCoordinates(0, 0, mapId);
|
var coordinates = new EntityCoordinates(gridId, 0, 0);
|
||||||
sMapManager.CreateMap(mapId);
|
|
||||||
|
|
||||||
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageGroupEntityId, coordinates);
|
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageGroupEntityId, coordinates);
|
||||||
sDamageableComponent = sDestructibleEntity.GetComponent<DamageableComponent>();
|
sDamageableComponent = sDestructibleEntity.GetComponent<DamageableComponent>();
|
||||||
|
|
||||||
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
|
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
|
||||||
|
sTestThresholdListenerSystem.ThresholdsReached.Clear();
|
||||||
|
|
||||||
sDamageableSystem = sEntitySystemManager.GetEntitySystem<DamageableSystem>();
|
sDamageableSystem = sEntitySystemManager.GetEntitySystem<DamageableSystem>();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
ExtraPrototypes = Prototypes
|
ExtraPrototypes = Prototypes
|
||||||
});
|
});
|
||||||
@@ -37,9 +37,8 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
|
|
||||||
await server.WaitPost(() =>
|
await server.WaitPost(() =>
|
||||||
{
|
{
|
||||||
var mapId = new MapId(1);
|
var gridId = GetMainGrid(sMapManager).GridEntityId;
|
||||||
var coordinates = new MapCoordinates(0, 0, mapId);
|
var coordinates = new EntityCoordinates(gridId, 0, 0);
|
||||||
sMapManager.CreateMap(mapId);
|
|
||||||
|
|
||||||
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageTypeEntityId, coordinates);
|
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageTypeEntityId, coordinates);
|
||||||
sDamageableComponent = sDestructibleEntity.GetComponent<DamageableComponent>();
|
sDamageableComponent = sDestructibleEntity.GetComponent<DamageableComponent>();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
ExtraPrototypes = Prototypes
|
ExtraPrototypes = Prototypes
|
||||||
});
|
});
|
||||||
@@ -36,9 +36,8 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
|
|
||||||
await server.WaitPost(() =>
|
await server.WaitPost(() =>
|
||||||
{
|
{
|
||||||
var mapId = new MapId(1);
|
var gridId = GetMainGrid(sMapManager).GridEntityId;
|
||||||
var coordinates = new MapCoordinates(0, 0, mapId);
|
var coordinates = new EntityCoordinates(gridId, 0, 0);
|
||||||
sMapManager.CreateMap(mapId);
|
|
||||||
|
|
||||||
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDestructionEntityId, coordinates);
|
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDestructionEntityId, coordinates);
|
||||||
sDamageableComponent = sDestructibleEntity.GetComponent<DamageableComponent>();
|
sDamageableComponent = sDestructibleEntity.GetComponent<DamageableComponent>();
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ using Content.Shared.Damage.Prototypes;
|
|||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
||||||
@@ -24,7 +23,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
ExtraPrototypes = Prototypes
|
ExtraPrototypes = Prototypes
|
||||||
});
|
});
|
||||||
@@ -44,14 +43,16 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
|
|
||||||
await server.WaitPost(() =>
|
await server.WaitPost(() =>
|
||||||
{
|
{
|
||||||
var mapId = new MapId(1);
|
var gridId = GetMainGrid(sMapManager).GridEntityId;
|
||||||
var coordinates = new MapCoordinates(0, 0, mapId);
|
var coordinates = new EntityCoordinates(gridId, 0, 0);
|
||||||
sMapManager.CreateMap(mapId);
|
|
||||||
|
|
||||||
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleEntityId, coordinates);
|
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleEntityId, coordinates);
|
||||||
sDamageableComponent = sDestructibleEntity.GetComponent<DamageableComponent>();
|
sDamageableComponent = sDestructibleEntity.GetComponent<DamageableComponent>();
|
||||||
sDestructibleComponent = sDestructibleEntity.GetComponent<DestructibleComponent>();
|
sDestructibleComponent = sDestructibleEntity.GetComponent<DestructibleComponent>();
|
||||||
|
|
||||||
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
|
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
|
||||||
|
sTestThresholdListenerSystem.ThresholdsReached.Clear();
|
||||||
|
|
||||||
sDamageableSystem = sEntitySystemManager.GetEntitySystem<DamageableSystem>();
|
sDamageableSystem = sEntitySystemManager.GetEntitySystem<DamageableSystem>();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Destructible;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Content.Server.Destructible;
|
||||||
|
using Content.Shared.GameTicking;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.Destructible
|
namespace Content.IntegrationTests.Tests.Destructible
|
||||||
{
|
{
|
||||||
@@ -10,10 +11,13 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class TestDestructibleListenerSystem : EntitySystem
|
public class TestDestructibleListenerSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
public readonly List<DamageThresholdReached> ThresholdsReached = new();
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<DestructibleComponent, DamageThresholdReached>(AddThresholdsToList);
|
SubscribeLocalEvent<DestructibleComponent, DamageThresholdReached>(AddThresholdsToList);
|
||||||
|
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddThresholdsToList(EntityUid _, DestructibleComponent comp, DamageThresholdReached args)
|
public void AddThresholdsToList(EntityUid _, DestructibleComponent comp, DamageThresholdReached args)
|
||||||
@@ -21,6 +25,9 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
ThresholdsReached.Add(args);
|
ThresholdsReached.Add(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DamageThresholdReached> ThresholdsReached = new();
|
private void OnRoundRestart(RoundRestartCleanupEvent ev)
|
||||||
|
{
|
||||||
|
ThresholdsReached.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
using Content.Server.DeviceNetwork;
|
using Content.Server.DeviceNetwork;
|
||||||
using Content.Server.DeviceNetwork.Components;
|
using Content.Server.DeviceNetwork.Components;
|
||||||
using Content.Server.DeviceNetwork.Systems;
|
using Content.Server.DeviceNetwork.Systems;
|
||||||
@@ -5,7 +6,6 @@ using NUnit.Framework;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.DeviceNetwork
|
namespace Content.IntegrationTests.Tests.DeviceNetwork
|
||||||
{
|
{
|
||||||
@@ -54,7 +54,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,11 @@ using Content.Server.Disposal.Tube.Components;
|
|||||||
using Content.Server.Disposal.Unit.Components;
|
using Content.Server.Disposal.Unit.Components;
|
||||||
using Content.Server.Disposal.Unit.EntitySystems;
|
using Content.Server.Disposal.Unit.EntitySystems;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Shared.Coordinates;
|
|
||||||
using Content.Shared.Disposal;
|
using Content.Shared.Disposal;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Reflection;
|
using Robust.Shared.Reflection;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.Disposal
|
namespace Content.IntegrationTests.Tests.Disposal
|
||||||
{
|
{
|
||||||
@@ -122,7 +120,7 @@ namespace Content.IntegrationTests.Tests.Disposal
|
|||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var options = new ServerIntegrationOptions { ExtraPrototypes = Prototypes };
|
var options = new ServerIntegrationOptions { ExtraPrototypes = Prototypes };
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
IEntity human = default!;
|
IEntity human = default!;
|
||||||
@@ -130,48 +128,19 @@ namespace Content.IntegrationTests.Tests.Disposal
|
|||||||
IEntity disposalUnit = default!;
|
IEntity disposalUnit = default!;
|
||||||
IEntity disposalTrunk = default!;
|
IEntity disposalTrunk = default!;
|
||||||
DisposalUnitComponent unit = default!;
|
DisposalUnitComponent unit = default!;
|
||||||
EntityCoordinates coordinates = default!;
|
|
||||||
|
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||||
var pauseManager = server.ResolveDependency<IPauseManager>();
|
|
||||||
var tileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
|
|
||||||
|
|
||||||
// Build up test environment
|
|
||||||
server.Post(() =>
|
|
||||||
{
|
|
||||||
// Create a one tile grid to anchor our disposal unit to.
|
|
||||||
var mapId = mapManager.CreateMap();
|
|
||||||
|
|
||||||
pauseManager.AddUninitializedMap(mapId);
|
|
||||||
|
|
||||||
var gridId = new GridId(1);
|
|
||||||
|
|
||||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
|
||||||
{
|
|
||||||
grid = mapManager.CreateGrid(mapId, gridId);
|
|
||||||
}
|
|
||||||
|
|
||||||
var tileDefinition = tileDefinitionManager["underplating"];
|
|
||||||
var tile = new Tile(tileDefinition.TileId);
|
|
||||||
coordinates = grid.ToCoordinates();
|
|
||||||
|
|
||||||
grid.SetTile(coordinates, tile);
|
|
||||||
|
|
||||||
pauseManager.DoMapInitialize(mapId);
|
|
||||||
});
|
|
||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
// Spawn the entities
|
// Spawn the entities
|
||||||
|
var coordinates = GetMainEntityCoordinates(mapManager);
|
||||||
human = entityManager.SpawnEntity("HumanDummy", coordinates);
|
human = entityManager.SpawnEntity("HumanDummy", coordinates);
|
||||||
wrench = entityManager.SpawnEntity("WrenchDummy", coordinates);
|
wrench = entityManager.SpawnEntity("WrenchDummy", coordinates);
|
||||||
disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", coordinates);
|
disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", coordinates);
|
||||||
disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", disposalUnit.Transform.MapPosition);
|
disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", disposalUnit.Transform.MapPosition);
|
||||||
|
|
||||||
// Check that we have a grid, so that we can anchor our unit
|
|
||||||
Assert.That(mapManager.TryFindGridAt(disposalUnit.Transform.MapPosition, out var _));
|
|
||||||
|
|
||||||
// Test for components existing
|
// Test for components existing
|
||||||
Assert.True(disposalUnit.TryGetComponent(out unit!));
|
Assert.True(disposalUnit.TryGetComponent(out unit!));
|
||||||
Assert.True(disposalTrunk.HasComponent<DisposalEntryComponent>());
|
Assert.True(disposalTrunk.HasComponent<DisposalEntryComponent>());
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.DoAfter;
|
using Content.Server.DoAfter;
|
||||||
using Content.Server.GameObjects.Components;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -27,7 +26,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
|
|||||||
{
|
{
|
||||||
Task<DoAfterStatus> task = null;
|
Task<DoAfterStatus> task = null;
|
||||||
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
// That it finishes successfully
|
// That it finishes successfully
|
||||||
server.Post(() =>
|
server.Post(() =>
|
||||||
@@ -51,7 +50,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
|
|||||||
{
|
{
|
||||||
Task<DoAfterStatus> task = null;
|
Task<DoAfterStatus> task = null;
|
||||||
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
server.Post(() =>
|
server.Post(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
|||||||
public async Task OpenCloseDestroyTest()
|
public async Task OpenCloseDestroyTest()
|
||||||
{
|
{
|
||||||
var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes};
|
var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Power.Components;
|
|
||||||
using Content.Server.PowerCell.Components;
|
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Coordinates;
|
using Content.Shared.Coordinates;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@@ -27,7 +25,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
CVarOverrides = {{CCVars.AIMaxUpdates.Name, int.MaxValue.ToString()}}
|
CVarOverrides = {{CCVars.AIMaxUpdates.Name, int.MaxValue.ToString()}}
|
||||||
};
|
};
|
||||||
|
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
@@ -118,7 +116,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
- type: entity
|
- type: entity
|
||||||
id: AllComponentsOneToOneDeleteTestEntity";
|
id: AllComponentsOneToOneDeleteTestEntity";
|
||||||
|
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
ExtraPrototypes = testEntity,
|
ExtraPrototypes = testEntity,
|
||||||
FailureLogLevel = LogLevel.Error
|
FailureLogLevel = LogLevel.Error
|
||||||
@@ -221,10 +219,11 @@ namespace Content.IntegrationTests.Tests
|
|||||||
- type: entity
|
- type: entity
|
||||||
id: AllComponentsOneEntityDeleteTestEntity";
|
id: AllComponentsOneEntityDeleteTestEntity";
|
||||||
|
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
ExtraPrototypes = testEntity,
|
ExtraPrototypes = testEntity,
|
||||||
FailureLogLevel = LogLevel.Error
|
FailureLogLevel = LogLevel.Error,
|
||||||
|
Pool = false
|
||||||
});
|
});
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Fluids.Components;
|
using Content.Server.Fluids.Components;
|
||||||
using Content.Shared.Chemistry.Components;
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Shared.Chemistry.Reagent;
|
|
||||||
using Content.Shared.Coordinates;
|
using Content.Shared.Coordinates;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@@ -19,46 +18,20 @@ namespace Content.IntegrationTests.Tests.Fluids
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TilePuddleTest()
|
public async Task TilePuddleTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
var pauseManager = server.ResolveDependency<IPauseManager>();
|
|
||||||
var tileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
|
|
||||||
|
|
||||||
EntityCoordinates coordinates = default;
|
|
||||||
|
|
||||||
// Build up test environment
|
|
||||||
server.Post(() =>
|
|
||||||
{
|
|
||||||
// Create a one tile grid to spill onto
|
|
||||||
var mapId = mapManager.CreateMap();
|
|
||||||
|
|
||||||
pauseManager.AddUninitializedMap(mapId);
|
|
||||||
|
|
||||||
var gridId = new GridId(1);
|
|
||||||
|
|
||||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
|
||||||
{
|
|
||||||
grid = mapManager.CreateGrid(mapId, gridId);
|
|
||||||
}
|
|
||||||
|
|
||||||
var tileDefinition = tileDefinitionManager["underplating"];
|
|
||||||
var tile = new Tile(tileDefinition.TileId);
|
|
||||||
coordinates = grid.ToCoordinates();
|
|
||||||
|
|
||||||
grid.SetTile(coordinates, tile);
|
|
||||||
|
|
||||||
pauseManager.DoMapInitialize(mapId);
|
|
||||||
});
|
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
|
||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
var solution = new Solution("water", FixedPoint2.New(20));
|
var solution = new Solution("water", FixedPoint2.New(20));
|
||||||
|
var grid = GetMainGrid(mapManager);
|
||||||
|
var (x, y) = GetMainTile(grid).GridIndices;
|
||||||
|
var coordinates = new EntityCoordinates(grid.GridEntityId, x, y);
|
||||||
var puddle = solution.SpillAt(coordinates, "PuddleSmear");
|
var puddle = solution.SpillAt(coordinates, "PuddleSmear");
|
||||||
|
|
||||||
Assert.NotNull(puddle);
|
Assert.NotNull(puddle);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -68,25 +41,22 @@ namespace Content.IntegrationTests.Tests.Fluids
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task SpaceNoPuddleTest()
|
public async Task SpaceNoPuddleTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
var pauseManager = server.ResolveDependency<IPauseManager>();
|
|
||||||
IMapGrid grid = null;
|
IMapGrid grid = null;
|
||||||
|
|
||||||
// Build up test environment
|
// Remove all tiles
|
||||||
server.Post(() =>
|
server.Post(() =>
|
||||||
{
|
{
|
||||||
var mapId = mapManager.CreateMap();
|
grid = GetMainGrid(mapManager);
|
||||||
|
|
||||||
pauseManager.AddUninitializedMap(mapId);
|
foreach (var tile in grid.GetAllTiles())
|
||||||
|
|
||||||
var gridId = new GridId(1);
|
|
||||||
|
|
||||||
if (!mapManager.TryGetGrid(gridId, out grid))
|
|
||||||
{
|
{
|
||||||
grid = mapManager.CreateGrid(mapId, gridId);
|
grid.SetTile(tile.GridIndices, Tile.Empty);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
|||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
IEntity human;
|
IEntity human;
|
||||||
IEntity otherHuman;
|
IEntity otherHuman;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Client.Actions;
|
using Content.Client.Actions;
|
||||||
using Content.Client.Actions.UI;
|
using Content.Client.Actions.UI;
|
||||||
using Content.Client.UserInterface;
|
|
||||||
using Content.Server.Actions;
|
using Content.Server.Actions;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
using Content.Server.Items;
|
using Content.Server.Items;
|
||||||
@@ -13,11 +12,11 @@ using Content.Shared.Actions.Prototypes;
|
|||||||
using Content.Shared.Cooldown;
|
using Content.Shared.Cooldown;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using IPlayerManager = Robust.Server.Player.IPlayerManager;
|
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||||
{
|
{
|
||||||
@@ -244,7 +243,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
|
|
||||||
// spawn and give them an item that has actions
|
// spawn and give them an item that has actions
|
||||||
serverFlashlight = serverEntManager.SpawnEntity("TestFlashlight",
|
serverFlashlight = serverEntManager.SpawnEntity("TestFlashlight",
|
||||||
new EntityCoordinates(new EntityUid(1), (0, 0)));
|
new EntityCoordinates(serverPlayerEnt.Uid, (0, 0)));
|
||||||
Assert.That(serverFlashlight.TryGetComponent<ItemActionsComponent>(out var itemActions));
|
Assert.That(serverFlashlight.TryGetComponent<ItemActionsComponent>(out var itemActions));
|
||||||
// we expect this only to have a toggle light action initially
|
// we expect this only to have a toggle light action initially
|
||||||
var actionConfigs = itemActions.ActionConfigs.ToList();
|
var actionConfigs = itemActions.ActionConfigs.ToList();
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Climbing.Components;
|
using Content.Server.Climbing.Components;
|
||||||
using Content.Shared.Physics;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -36,7 +35,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
|||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
IEntity human;
|
IEntity human;
|
||||||
IEntity table;
|
IEntity table;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using Content.Server.Gravity.EntitySystems;
|
|||||||
using Content.Shared.Acts;
|
using Content.Shared.Acts;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.Coordinates;
|
using Content.Shared.Coordinates;
|
||||||
using Content.Shared.Gravity;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -49,14 +48,7 @@ namespace Content.IntegrationTests.Tests.Gravity
|
|||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var mapId = new MapId(1);
|
var grid = GetMainGrid(mapManager);
|
||||||
var gridId = new GridId(1);
|
|
||||||
|
|
||||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
|
||||||
{
|
|
||||||
grid = mapManager.CreateGrid(mapId, gridId);
|
|
||||||
}
|
|
||||||
|
|
||||||
var coordinates = grid.ToCoordinates();
|
var coordinates = grid.ToCoordinates();
|
||||||
human = entityManager.SpawnEntity("HumanDummy", coordinates);
|
human = entityManager.SpawnEntity("HumanDummy", coordinates);
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
IEntity generator = null;
|
IEntity generator = null;
|
||||||
|
|
||||||
@@ -43,9 +43,9 @@ namespace Content.IntegrationTests.Tests
|
|||||||
{
|
{
|
||||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||||
|
|
||||||
mapMan.CreateMap(new MapId(1));
|
var mapId = GetMainMapId(mapMan);
|
||||||
grid1 = mapMan.CreateGrid(new MapId(1));
|
grid1 = mapMan.CreateGrid(mapId);
|
||||||
grid2 = mapMan.CreateGrid(new MapId(1));
|
grid2 = mapMan.CreateGrid(mapId);
|
||||||
|
|
||||||
var entityMan = IoCManager.Resolve<IEntityManager>();
|
var entityMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
IEntity human = null;
|
IEntity human = null;
|
||||||
IEntity uniform = null;
|
IEntity uniform = null;
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using Content.Server.Hands.Components;
|
||||||
|
using Content.Server.Interaction;
|
||||||
|
using Content.Server.Items;
|
||||||
|
using Content.Shared.Hands.Components;
|
||||||
|
using Content.Shared.Interaction;
|
||||||
|
using Content.Shared.Weapons.Melee;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -5,13 +12,6 @@ using Robust.Shared.IoC;
|
|||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Reflection;
|
using Robust.Shared.Reflection;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Content.Server.Hands.Components;
|
|
||||||
using Content.Server.Interaction;
|
|
||||||
using Content.Server.Items;
|
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Shared.Weapons.Melee;
|
|
||||||
using Content.Shared.Hands.Components;
|
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.Interaction.Click
|
namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||||
{
|
{
|
||||||
@@ -38,7 +38,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task InteractionTest()
|
public async Task InteractionTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
ContentBeforeIoC = () =>
|
ContentBeforeIoC = () =>
|
||||||
{
|
{
|
||||||
@@ -107,7 +107,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task InteractionObstructionTest()
|
public async Task InteractionObstructionTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
ContentBeforeIoC = () =>
|
ContentBeforeIoC = () =>
|
||||||
{
|
{
|
||||||
@@ -179,7 +179,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task InteractionInRangeTest()
|
public async Task InteractionInRangeTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
ContentBeforeIoC = () =>
|
ContentBeforeIoC = () =>
|
||||||
{
|
{
|
||||||
@@ -249,7 +249,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task InteractionOutOfRangeTest()
|
public async Task InteractionOutOfRangeTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
ContentBeforeIoC = () =>
|
ContentBeforeIoC = () =>
|
||||||
{
|
{
|
||||||
@@ -318,7 +318,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task InsideContainerInteractionBlockTest()
|
public async Task InsideContainerInteractionBlockTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
ContentBeforeIoC = () =>
|
ContentBeforeIoC = () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task EntityEntityTest()
|
public async Task EntityEntityTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ using Content.Server.Inventory;
|
|||||||
using Content.Server.Inventory.Components;
|
using Content.Server.Inventory.Components;
|
||||||
using Content.Server.Items;
|
using Content.Server.Items;
|
||||||
using Content.Server.Stunnable;
|
using Content.Server.Stunnable;
|
||||||
using Content.Server.Stunnable.Components;
|
|
||||||
using Content.Shared.Stunnable;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -50,7 +48,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
public async Task SpawnItemInSlotTest()
|
public async Task SpawnItemInSlotTest()
|
||||||
{
|
{
|
||||||
var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes};
|
var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
IEntity human = null;
|
IEntity human = null;
|
||||||
InventoryComponent inventory = null;
|
InventoryComponent inventory = null;
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Shared.Chemistry;
|
|
||||||
using Content.Shared.Chemistry.Reagent;
|
using Content.Shared.Chemistry.Reagent;
|
||||||
using Content.Shared.Kitchen;
|
using Content.Shared.Kitchen;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.Kitchen
|
namespace Content.IntegrationTests.Tests.Kitchen
|
||||||
@@ -14,7 +12,7 @@ namespace Content.IntegrationTests.Tests.Kitchen
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestRecipesValid()
|
public async Task TestRecipesValid()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Client;
|
|
||||||
using Content.Client.Lobby;
|
using Content.Client.Lobby;
|
||||||
using Content.Client.Preferences;
|
using Content.Client.Preferences;
|
||||||
using Content.Client.State;
|
|
||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.Preferences;
|
|
||||||
using Content.Server.Preferences.Managers;
|
using Content.Server.Preferences.Managers;
|
||||||
using Content.Shared;
|
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Preferences;
|
using Content.Shared.Preferences;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@@ -25,7 +21,16 @@ namespace Content.IntegrationTests.Tests.Lobby
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task CreateDeleteCreateTest()
|
public async Task CreateDeleteCreateTest()
|
||||||
{
|
{
|
||||||
var (client, server) = await StartConnectedServerClientPair();
|
var serverOptions = new ServerContentIntegrationOption
|
||||||
|
{
|
||||||
|
CVarOverrides =
|
||||||
|
{
|
||||||
|
[CCVars.GameDummyTicker.Name] = "false",
|
||||||
|
[CCVars.GameLobbyEnabled.Name] = "true"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var (client, server) = await StartConnectedServerClientPair(serverOptions: serverOptions);
|
||||||
|
|
||||||
var clientNetManager = client.ResolveDependency<IClientNetManager>();
|
var clientNetManager = client.ResolveDependency<IClientNetManager>();
|
||||||
var clientStateManager = client.ResolveDependency<IStateManager>();
|
var clientStateManager = client.ResolveDependency<IStateManager>();
|
||||||
@@ -50,7 +55,7 @@ namespace Content.IntegrationTests.Tests.Lobby
|
|||||||
// Need to run them in sync to receive the messages.
|
// Need to run them in sync to receive the messages.
|
||||||
await RunTicksSync(client, server, 1);
|
await RunTicksSync(client, server, 1);
|
||||||
|
|
||||||
await WaitUntil(client, () => clientStateManager.CurrentState is LobbyState, maxTicks: 60);
|
await WaitUntil(client, () => clientStateManager.CurrentState is LobbyState, 600);
|
||||||
|
|
||||||
Assert.NotNull(clientNetManager.ServerChannel);
|
Assert.NotNull(clientNetManager.ServerChannel);
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
|||||||
public async Task TestConnect()
|
public async Task TestConnect()
|
||||||
{
|
{
|
||||||
var client = StartClient();
|
var client = StartClient();
|
||||||
var server = StartServer();
|
var server = StartServer(new ServerContentIntegrationOption {Pool = false});
|
||||||
|
|
||||||
await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync());
|
await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync());
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Content.IntegrationTests.Tests.Pathfinding
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
@@ -24,17 +24,15 @@ namespace Content.IntegrationTests.Tests.Pathfinding
|
|||||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
var mapId = mapMan.CreateMap(new MapId(1));
|
var grid = GetMainGrid(mapMan);
|
||||||
var gridId = new GridId(2);
|
var chunkTile = grid.GetTileRef(new Vector2i(0, 0));
|
||||||
mapMan.CreateGrid(mapId, gridId);
|
|
||||||
var chunkTile = mapMan.GetGrid(gridId).GetTileRef(new Vector2i(0, 0));
|
|
||||||
var chunk = pathfindingSystem.GetChunk(chunkTile);
|
var chunk = pathfindingSystem.GetChunk(chunkTile);
|
||||||
Assert.That(chunk.Nodes.Length == PathfindingChunk.ChunkSize * PathfindingChunk.ChunkSize);
|
Assert.That(chunk.Nodes.Length == PathfindingChunk.ChunkSize * PathfindingChunk.ChunkSize);
|
||||||
|
|
||||||
// Neighbors
|
// Neighbors
|
||||||
var chunkNeighbors = chunk.GetNeighbors().ToList();
|
var chunkNeighbors = chunk.GetNeighbors().ToList();
|
||||||
Assert.That(chunkNeighbors.Count == 0);
|
Assert.That(chunkNeighbors.Count == 0);
|
||||||
var neighborChunkTile = mapMan.GetGrid(gridId).GetTileRef(new Vector2i(PathfindingChunk.ChunkSize, PathfindingChunk.ChunkSize));
|
var neighborChunkTile = grid.GetTileRef(new Vector2i(PathfindingChunk.ChunkSize, PathfindingChunk.ChunkSize));
|
||||||
var neighborChunk = pathfindingSystem.GetChunk(neighborChunkTile);
|
var neighborChunk = pathfindingSystem.GetChunk(neighborChunkTile);
|
||||||
chunkNeighbors = chunk.GetNeighbors().ToList();
|
chunkNeighbors = chunk.GetNeighbors().ToList();
|
||||||
Assert.That(chunkNeighbors.Count == 1);
|
Assert.That(chunkNeighbors.Count == 1);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task NoSavedPostMapInitTest()
|
public async Task NoSavedPostMapInitTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
public async Task Setup()
|
public async Task Setup()
|
||||||
{
|
{
|
||||||
var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes};
|
var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes};
|
||||||
_server = StartServerDummyTicker(options);
|
_server = StartServer(options);
|
||||||
|
|
||||||
await _server.WaitIdleAsync();
|
await _server.WaitIdleAsync();
|
||||||
_mapManager = _server.ResolveDependency<IMapManager>();
|
_mapManager = _server.ResolveDependency<IMapManager>();
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using NUnit.Framework;
|
|||||||
using Robust.Server.Maps;
|
using Robust.Server.Maps;
|
||||||
using Robust.Shared.ContentPack;
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -34,7 +33,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var dir = new ResourcePath(mapPath).Directory;
|
var dir = new ResourcePath(mapPath).Directory;
|
||||||
resManager.UserData.CreateDir(dir);
|
resManager.UserData.CreateDir(dir);
|
||||||
|
|
||||||
var mapId = mapManager.CreateMap(new MapId(5));
|
var nextMapId = mapManager.NextMapId();
|
||||||
|
var mapId = mapManager.CreateMap(nextMapId);
|
||||||
|
|
||||||
{
|
{
|
||||||
var mapGrid = mapManager.CreateGrid(mapId);
|
var mapGrid = mapManager.CreateGrid(mapId);
|
||||||
@@ -51,7 +51,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
mapLoader.SaveMap(mapId, mapPath);
|
mapLoader.SaveMap(mapId, mapPath);
|
||||||
|
|
||||||
mapManager.DeleteMap(new MapId(5));
|
mapManager.DeleteMap(nextMapId);
|
||||||
});
|
});
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task SaveLoadSave()
|
public async Task SaveLoadSave()
|
||||||
{
|
{
|
||||||
var server = StartServer();
|
var server = StartServer(new ServerContentIntegrationOption {Pool = false});
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
var mapLoader = server.ResolveDependency<IMapLoader>();
|
var mapLoader = server.ResolveDependency<IMapLoader>();
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
@@ -86,7 +86,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
IMapGrid grid = default;
|
IMapGrid grid = default;
|
||||||
|
|
||||||
// Load stationstation.yml as uninitialized map, and save it to ensure it's up to date.
|
// Load saltern.yml as uninitialized map, and save it to ensure it's up to date.
|
||||||
server.Post(() =>
|
server.Post(() =>
|
||||||
{
|
{
|
||||||
var mapId = mapManager.CreateMap();
|
var mapId = mapManager.CreateMap();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Shared.Chemistry;
|
|
||||||
using Content.Shared.Chemistry.Dispenser;
|
using Content.Shared.Chemistry.Dispenser;
|
||||||
using Content.Shared.Chemistry.Reagent;
|
using Content.Shared.Chemistry.Reagent;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@@ -14,7 +13,7 @@ namespace Content.IntegrationTests.Tests.Solutions
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestReagentDispenserInventory()
|
public async Task TestReagentDispenserInventory()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestServerStart()
|
public async Task TestServerStart()
|
||||||
{
|
{
|
||||||
var server = StartServer();
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
|
{
|
||||||
|
Pool = false
|
||||||
|
});
|
||||||
server.RunTicks(5);
|
server.RunTicks(5);
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
Assert.That(server.IsAlive);
|
Assert.That(server.IsAlive);
|
||||||
@@ -30,7 +33,10 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestClientStart()
|
public async Task TestClientStart()
|
||||||
{
|
{
|
||||||
var client = StartClient();
|
var client = StartClient(new ClientContentIntegrationOption
|
||||||
|
{
|
||||||
|
Pool = false
|
||||||
|
});
|
||||||
await client.WaitIdleAsync();
|
await client.WaitIdleAsync();
|
||||||
Assert.That(client.IsAlive);
|
Assert.That(client.IsAlive);
|
||||||
client.RunTicks(5);
|
client.RunTicks(5);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Content.IntegrationTests.Tests.StationEvents
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ using System.Threading.Tasks;
|
|||||||
using Content.Server.Storage.Components;
|
using Content.Server.Storage.Components;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Utility;
|
|
||||||
using YamlDotNet.RepresentationModel;
|
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests
|
namespace Content.IntegrationTests.Tests
|
||||||
{
|
{
|
||||||
@@ -14,7 +12,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestStorageFillPrototypes()
|
public async Task TestStorageFillPrototypes()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Content.IntegrationTests.Tests.Tag
|
|||||||
public async Task TagComponentTest()
|
public async Task TagComponentTest()
|
||||||
{
|
{
|
||||||
var options = new ServerContentIntegrationOption {ExtraPrototypes = Prototypes};
|
var options = new ServerContentIntegrationOption {ExtraPrototypes = Prototypes};
|
||||||
var server = StartServerDummyTicker(options);
|
var server = StartServer(options);
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ using Content.Shared.Spawning;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Broadphase;
|
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.Utility
|
namespace Content.IntegrationTests.Tests.Utility
|
||||||
{
|
{
|
||||||
@@ -45,18 +43,17 @@ namespace Content.IntegrationTests.Tests.Utility
|
|||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var mapId = new MapId(1);
|
var grid = GetMainGrid(sMapManager);
|
||||||
var grid = sMapManager.GetGrid(new GridId(1));
|
|
||||||
grid.SetTile(new Vector2i(0, 0), new Tile(1));
|
|
||||||
var gridEnt = sEntityManager.GetEntity(grid.GridEntityId);
|
var gridEnt = sEntityManager.GetEntity(grid.GridEntityId);
|
||||||
var gridPos = gridEnt.Transform.WorldPosition;
|
var gridPos = gridEnt.Transform.WorldPosition;
|
||||||
var entityCoordinates = new EntityCoordinates(grid.GridEntityId, 0, 0);
|
var entityCoordinates = GetMainEntityCoordinates(sMapManager);
|
||||||
|
|
||||||
// Nothing blocking it, only entity is the grid
|
// Nothing blocking it, only entity is the grid
|
||||||
Assert.NotNull(sEntityManager.SpawnIfUnobstructed(null, entityCoordinates, CollisionGroup.Impassable));
|
Assert.NotNull(sEntityManager.SpawnIfUnobstructed(null, entityCoordinates, CollisionGroup.Impassable));
|
||||||
Assert.True(sEntityManager.TrySpawnIfUnobstructed(null, entityCoordinates, CollisionGroup.Impassable, out var entity));
|
Assert.True(sEntityManager.TrySpawnIfUnobstructed(null, entityCoordinates, CollisionGroup.Impassable, out var entity));
|
||||||
Assert.NotNull(entity);
|
Assert.NotNull(entity);
|
||||||
|
|
||||||
|
var mapId = GetMainMapId(sMapManager);
|
||||||
var mapCoordinates = new MapCoordinates(gridPos.X, gridPos.Y, mapId);
|
var mapCoordinates = new MapCoordinates(gridPos.X, gridPos.Y, mapId);
|
||||||
|
|
||||||
// Nothing blocking it, only entity is the grid
|
// Nothing blocking it, only entity is the grid
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Threading.Tasks;
|
|||||||
using Content.Shared.Containers.ItemSlots;
|
using Content.Shared.Containers.ItemSlots;
|
||||||
using Content.Shared.Whitelist;
|
using Content.Shared.Whitelist;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NUnit.Framework.Internal;
|
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
@@ -70,7 +69,7 @@ namespace Content.IntegrationTests.Tests.Utility
|
|||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var mapId = new MapId(1);
|
var mapId = GetMainMapId(mapManager);
|
||||||
var mapCoordinates = new MapCoordinates(0, 0, mapId);
|
var mapCoordinates = new MapCoordinates(0, 0, mapId);
|
||||||
|
|
||||||
var validComponent = entityManager.SpawnEntity("ValidComponentDummy", mapCoordinates);
|
var validComponent = entityManager.SpawnEntity("ValidComponentDummy", mapCoordinates);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServer();
|
||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,14 +45,14 @@ namespace Content.Server.AI.Pathfinding
|
|||||||
var tileOneWorld = tileOneGrid.ToMapPos(EntityManager);
|
var tileOneWorld = tileOneGrid.ToMapPos(EntityManager);
|
||||||
var tileTwoGrid = mapManager.GetGrid(to.GridIndex).GridTileToLocal(to.GridIndices);
|
var tileTwoGrid = mapManager.GetGrid(to.GridIndex).GridTileToLocal(to.GridIndices);
|
||||||
var tileTwoWorld = tileTwoGrid.ToMapPos(EntityManager);
|
var tileTwoWorld = tileTwoGrid.ToMapPos(EntityManager);
|
||||||
cameFrom.Add(tileOneWorld, tileTwoWorld);
|
cameFrom[tileOneWorld] = tileTwoWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
var gScores = new Dictionary<Vector2, float>();
|
var gScores = new Dictionary<Vector2, float>();
|
||||||
foreach (var (tile, score) in routeDebug.GScores)
|
foreach (var (tile, score) in routeDebug.GScores)
|
||||||
{
|
{
|
||||||
var tileGrid = mapManager.GetGrid(tile.GridIndex).GridTileToLocal(tile.GridIndices);
|
var tileGrid = mapManager.GetGrid(tile.GridIndex).GridTileToLocal(tile.GridIndices);
|
||||||
gScores.Add(tileGrid.ToMapPos(EntityManager), score);
|
gScores[tileGrid.ToMapPos(EntityManager)] = score;
|
||||||
}
|
}
|
||||||
|
|
||||||
var systemMessage = new SharedAiDebug.AStarRouteMessage(
|
var systemMessage = new SharedAiDebug.AStarRouteMessage(
|
||||||
|
|||||||
@@ -70,15 +70,6 @@ namespace Content.Server.Solar.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Initialize()
|
|
||||||
{
|
|
||||||
base.Initialize();
|
|
||||||
|
|
||||||
Owner.EnsureComponentWarn<PowerSupplierComponent>();
|
|
||||||
|
|
||||||
UpdateSupply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnBreak(BreakageEventArgs args)
|
public void OnBreak(BreakageEventArgs args)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent<SpriteComponent>(out var sprite))
|
if (!Owner.TryGetComponent<SpriteComponent>(out var sprite))
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.Solar.Components;
|
using Content.Server.Solar.Components;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
@@ -7,7 +8,6 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Broadphase;
|
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
@@ -71,11 +71,18 @@ namespace Content.Server.Solar.EntitySystems
|
|||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
SubscribeLocalEvent<SolarPanelComponent, MapInitEvent>(OnMapInit);
|
||||||
|
|
||||||
// Initialize the sun to something random
|
// Initialize the sun to something random
|
||||||
TowardsSun = MathHelper.TwoPi * _robustRandom.NextDouble();
|
TowardsSun = MathHelper.TwoPi * _robustRandom.NextDouble();
|
||||||
SunAngularVelocity = Angle.FromDegrees(0.1 + ((_robustRandom.NextDouble() - 0.5) * 0.05));
|
SunAngularVelocity = Angle.FromDegrees(0.1 + ((_robustRandom.NextDouble() - 0.5) * 0.05));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnMapInit(EntityUid uid, SolarPanelComponent component, MapInitEvent args)
|
||||||
|
{
|
||||||
|
UpdateSupply(uid, component);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
TowardsSun += SunAngularVelocity * frameTime;
|
TowardsSun += SunAngularVelocity * frameTime;
|
||||||
@@ -145,5 +152,18 @@ namespace Content.Server.Solar.EntitySystems
|
|||||||
// Total coverage calculated; apply it to the panel.
|
// Total coverage calculated; apply it to the panel.
|
||||||
panel.Coverage = coverage;
|
panel.Coverage = coverage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateSupply(
|
||||||
|
EntityUid uid,
|
||||||
|
SolarPanelComponent? solar = null,
|
||||||
|
PowerSupplierComponent? supplier = null)
|
||||||
|
{
|
||||||
|
if (!Resolve(uid, ref solar, ref supplier))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
supplier.MaxSupply = (int) (solar.MaxSupply * solar.Coverage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user