* fix antag selection being evil * fix test * untroll the other tests * remove role timer troll * Allow tests to modify antag preferences * Fix antag selection * Misc test fixes * Add AntagPreferenceTest * Fix lazy mistakes * Test cleanup * Try stop players in lobbies from being assigned mid-round antags * ranting * I am going insane --------- Co-authored-by: deltanedas <@deltanedas:kde.org> Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
59 lines
1.7 KiB
C#
59 lines
1.7 KiB
C#
using Content.Server.GameTicking;
|
|
using Content.Shared.GameTicking;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Reflection;
|
|
|
|
namespace Content.IntegrationTests.Tests
|
|
{
|
|
[TestFixture]
|
|
[TestOf(typeof(RoundRestartCleanupEvent))]
|
|
public sealed class ResettingEntitySystemTests
|
|
{
|
|
public sealed class TestRoundRestartCleanupEvent : EntitySystem
|
|
{
|
|
public bool HasBeenReset { get; set; }
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
|
}
|
|
|
|
public void Reset(RoundRestartCleanupEvent ev)
|
|
{
|
|
HasBeenReset = true;
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public async Task ResettingEntitySystemResetTest()
|
|
{
|
|
await using var pair = await PoolManager.GetServerClient(new PoolSettings
|
|
{
|
|
DummyTicker = false,
|
|
Connected = true,
|
|
Dirty = true
|
|
});
|
|
var server = pair.Server;
|
|
|
|
var entitySystemManager = server.ResolveDependency<IEntitySystemManager>();
|
|
var gameTicker = entitySystemManager.GetEntitySystem<GameTicker>();
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
Assert.That(gameTicker.RunLevel, Is.EqualTo(GameRunLevel.InRound));
|
|
|
|
var system = entitySystemManager.GetEntitySystem<TestRoundRestartCleanupEvent>();
|
|
|
|
system.HasBeenReset = false;
|
|
|
|
gameTicker.RestartRound();
|
|
|
|
Assert.That(system.HasBeenReset);
|
|
});
|
|
await pair.CleanReturnAsync();
|
|
}
|
|
}
|
|
}
|