Revert "Refactor Game Modes" oh god oh fuck go back it was too good to be true (#5855)

This commit is contained in:
Paul Ritter
2021-12-21 19:25:52 +01:00
committed by GitHub
parent 8831d08229
commit 75721c214c
59 changed files with 1715 additions and 1971 deletions

View File

@@ -4,14 +4,12 @@ using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules;
using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.IntegrationTests.Tests.GameRules
{
[TestFixture]
[TestOf(typeof(MaxTimeRestartRuleSystem))]
[TestOf(typeof(RuleMaxTimeRestart))]
public class RuleMaxTimeRestartTest : ContentIntegrationTest
{
[Test]
@@ -21,9 +19,7 @@ namespace Content.IntegrationTests.Tests.GameRules
{
CVarOverrides =
{
["game.lobbyenabled"] = "true",
["game.dummyticker"] = "false",
["game.defaultpreset"] = "", // No preset.
["game.lobbyenabled"] = "true"
}
};
var server = StartServer(options);
@@ -31,15 +27,16 @@ namespace Content.IntegrationTests.Tests.GameRules
await server.WaitIdleAsync();
var sGameTicker = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<GameTicker>();
var maxTimeMaxTimeRestartRuleSystem = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<MaxTimeRestartRuleSystem>();
var sGameTiming = server.ResolveDependency<IGameTiming>();
RuleMaxTimeRestart maxTimeRule = null;
await server.WaitAssertion(() =>
{
Assert.That(sGameTicker.RunLevel, Is.EqualTo(GameRunLevel.PreRoundLobby));
sGameTicker.AddGameRule(IoCManager.Resolve<IPrototypeManager>().Index<GameRulePrototype>(maxTimeMaxTimeRestartRuleSystem.Prototype));
maxTimeMaxTimeRestartRuleSystem.RoundMaxTime = TimeSpan.FromSeconds(3);
maxTimeRule = sGameTicker.AddGameRule<RuleMaxTimeRestart>();
maxTimeRule.RoundMaxTime = TimeSpan.FromSeconds(3);
sGameTicker.StartRound();
});
@@ -49,7 +46,7 @@ namespace Content.IntegrationTests.Tests.GameRules
Assert.That(sGameTicker.RunLevel, Is.EqualTo(GameRunLevel.InRound));
});
var ticks = sGameTiming.TickRate * (int) Math.Ceiling(maxTimeMaxTimeRestartRuleSystem.RoundMaxTime.TotalSeconds * 1.1f);
var ticks = sGameTiming.TickRate * (int) Math.Ceiling(maxTimeRule.RoundMaxTime.TotalSeconds * 1.1f);
await server.WaitRunTicks(ticks);
await server.WaitAssertion(() =>
@@ -57,7 +54,7 @@ namespace Content.IntegrationTests.Tests.GameRules
Assert.That(sGameTicker.RunLevel, Is.EqualTo(GameRunLevel.PostRound));
});
ticks = sGameTiming.TickRate * (int) Math.Ceiling(maxTimeMaxTimeRestartRuleSystem.RoundEndDelay.TotalSeconds * 1.1f);
ticks = sGameTiming.TickRate * (int) Math.Ceiling(maxTimeRule.RoundEndDelay.TotalSeconds * 1.1f);
await server.WaitRunTicks(ticks);
await server.WaitAssertion(() =>