Revert "Gamerule Entities" (#15724)

This commit is contained in:
metalgearsloth
2023-04-24 16:21:05 +10:00
committed by GitHub
parent 39cc02b8f9
commit d3552dae00
124 changed files with 4328 additions and 3083 deletions

View File

@@ -3,11 +3,12 @@ using System.Threading.Tasks;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Commands;
using Content.Server.GameTicking.Rules;
using Content.Server.GameTicking.Rules.Components;
using Content.Shared.CCVar;
using NUnit.Framework;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.IntegrationTests.Tests.GameRules
@@ -22,7 +23,6 @@ namespace Content.IntegrationTests.Tests.GameRules
await using var pairTracker = await PoolManager.GetServerClient();
var server = pairTracker.Pair.Server;
var entityManager = server.ResolveDependency<IEntityManager>();
var configManager = server.ResolveDependency<IConfigurationManager>();
await server.WaitPost(() =>
{
@@ -31,17 +31,18 @@ namespace Content.IntegrationTests.Tests.GameRules
command.Execute(null, string.Empty, Array.Empty<string>());
});
var sGameTicker = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<GameTicker>();
var maxTimeMaxTimeRestartRuleSystem = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<MaxTimeRestartRuleSystem>();
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.StartGameRule(IoCManager.Resolve<IPrototypeManager>().Index<GameRulePrototype>(maxTimeMaxTimeRestartRuleSystem.Prototype));
maxTimeMaxTimeRestartRuleSystem.RoundMaxTime = TimeSpan.FromSeconds(3);
sGameTicker.StartRound();
});
@@ -50,7 +51,7 @@ namespace Content.IntegrationTests.Tests.GameRules
Assert.That(sGameTicker.RunLevel, Is.EqualTo(GameRunLevel.InRound));
});
var ticks = sGameTiming.TickRate * (int) Math.Ceiling(maxTime.RoundMaxTime.TotalSeconds * 1.1f);
var ticks = sGameTiming.TickRate * (int) Math.Ceiling(maxTimeMaxTimeRestartRuleSystem.RoundMaxTime.TotalSeconds * 1.1f);
await PoolManager.RunTicksSync(pairTracker.Pair, ticks);
await server.WaitAssertion(() =>
@@ -58,7 +59,7 @@ namespace Content.IntegrationTests.Tests.GameRules
Assert.That(sGameTicker.RunLevel, Is.EqualTo(GameRunLevel.PostRound));
});
ticks = sGameTiming.TickRate * (int) Math.Ceiling(maxTime.RoundEndDelay.TotalSeconds * 1.1f);
ticks = sGameTiming.TickRate * (int) Math.Ceiling(maxTimeMaxTimeRestartRuleSystem.RoundEndDelay.TotalSeconds * 1.1f);
await PoolManager.RunTicksSync(pairTracker.Pair, ticks);
await server.WaitAssertion(() =>