mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-30 20:17:32 +03:00
This cherry-pick's Wizden's Antag Refactor, which is needed for all future antag updates, as well as for me to cherry-pick over Cultists(Who are going to need some editing to fit the antag refactor), Changelings, Heretics, and Wizards. I actually selected the White-Dream-Public version of the Antag Refactor, due to it having commits made tailored to our repository, so it comes prepackaged with all the changes necessary for our repo-specific content. https://github.com/frosty-dev/ss14-wwdp/pull/10 Signed-off-by: Timemaster99 <57200767+Timemaster99@users.noreply.github.com> Co-authored-by: ThereDrD <88589686+ThereDrD0@users.noreply.github.com> Co-authored-by: Jeff <velcroboy333@hotmail.com> Co-authored-by: Timemaster99 <57200767+Timemaster99@users.noreply.github.com> Co-authored-by: Timemaster99 <elijahrobot@gmail.com> Co-authored-by: luckywill339@gmail.com <luckywill339@gmail.com> Co-authored-by: Danger Revolution! <142105406+DangerRevolution@users.noreply.github.com> Co-authored-by: Azzy <azzydev@icloud.com>
62 lines
2.2 KiB
C#
62 lines
2.2 KiB
C#
using Content.Server.GameTicking;
|
|
using Content.Server.GameTicking.Commands;
|
|
using Content.Server.GameTicking.Components;
|
|
using Content.Server.GameTicking.Rules;
|
|
using Content.Server.GameTicking.Rules.Components;
|
|
using Content.Shared.CCVar;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.IntegrationTests.Tests.GameRules
|
|
{
|
|
[TestFixture]
|
|
[TestOf(typeof(MaxTimeRestartRuleSystem))]
|
|
public sealed class RuleMaxTimeRestartTest
|
|
{
|
|
[Test]
|
|
public async Task RestartTest()
|
|
{
|
|
await using var pair = await PoolManager.GetServerClient(new PoolSettings { InLobby = true });
|
|
var server = pair.Server;
|
|
|
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
|
var sGameTicker = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<GameTicker>();
|
|
var sGameTiming = server.ResolveDependency<IGameTiming>();
|
|
|
|
sGameTicker.StartGameRule("MaxTimeRestart", out var ruleEntity);
|
|
Assert.That(entityManager.TryGetComponent<MaxTimeRestartRuleComponent>(ruleEntity, out var maxTime));
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
Assert.That(sGameTicker.RunLevel, Is.EqualTo(GameRunLevel.PreRoundLobby));
|
|
maxTime.RoundMaxTime = TimeSpan.FromSeconds(3);
|
|
sGameTicker.StartRound();
|
|
});
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
Assert.That(sGameTicker.RunLevel, Is.EqualTo(GameRunLevel.InRound));
|
|
});
|
|
|
|
var ticks = sGameTiming.TickRate * (int) Math.Ceiling(maxTime.RoundMaxTime.TotalSeconds * 1.1f);
|
|
await pair.RunTicksSync(ticks);
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
Assert.That(sGameTicker.RunLevel, Is.EqualTo(GameRunLevel.PostRound));
|
|
});
|
|
|
|
ticks = sGameTiming.TickRate * (int) Math.Ceiling(maxTime.RoundEndDelay.TotalSeconds * 1.1f);
|
|
await pair.RunTicksSync(ticks);
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
Assert.That(sGameTicker.RunLevel, Is.EqualTo(GameRunLevel.PreRoundLobby));
|
|
});
|
|
|
|
await pair.CleanReturnAsync();
|
|
}
|
|
}
|
|
}
|