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

@@ -2,11 +2,14 @@
using System.Linq;
using System.Threading.Tasks;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules;
using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
namespace Content.IntegrationTests.Tests.GameRules;
[TestFixture]
public sealed class StartEndGameRulesTest
{
@@ -23,18 +26,22 @@ public sealed class StartEndGameRulesTest
});
var server = pairTracker.Pair.Server;
await server.WaitIdleAsync();
var protoMan = server.ResolveDependency<IPrototypeManager>();
var gameTicker = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<GameTicker>();
await server.WaitAssertion(() =>
{
var rules = gameTicker.GetAllGameRulePrototypes().ToList();
var rules = protoMan.EnumeratePrototypes<GameRulePrototype>().ToList();
rules.Sort((x, y) => string.Compare(x.ID, y.ID, StringComparison.Ordinal));
// Start all rules
foreach (var rule in rules)
{
gameTicker.StartGameRule(rule.ID);
gameTicker.StartGameRule(rule);
}
Assert.That(gameTicker.AddedGameRules, Has.Count.EqualTo(rules.Count));
Assert.That(gameTicker.AddedGameRules, Has.Count.EqualTo(gameTicker.StartedGameRules.Count));
});
// Wait three ticks for any random update loops that might happen
@@ -44,7 +51,7 @@ public sealed class StartEndGameRulesTest
{
// End all rules
gameTicker.ClearGameRules();
Assert.That(!gameTicker.GetAddedGameRules().Any());
Assert.That(!gameTicker.AddedGameRules.Any());
});
await pairTracker.CleanReturnAsync();