mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-09-15 14:52:26 +02:00
* :3 * mild improvement * let ghosts become antags * MORE!!! --------- Co-authored-by: nomdéraisonnablementlong <you@example.com> Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
56 lines
1.7 KiB
C#
56 lines
1.7 KiB
C#
using System.Linq;
|
|
using Content.IntegrationTests.Fixtures;
|
|
using Content.Server.GameTicking;
|
|
using Content.Shared.CCVar;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Content.IntegrationTests.Tests.GameRules;
|
|
|
|
[TestFixture]
|
|
public sealed class StartEndGameRulesTest : GameTest
|
|
{
|
|
public override PoolSettings PoolSettings => new PoolSettings
|
|
{
|
|
Dirty = true,
|
|
DummyTicker = false,
|
|
Map = PoolManager.TestStation
|
|
};
|
|
|
|
/// <summary>
|
|
/// Tests that all game rules can be added/started/ended at the same time without exceptions.
|
|
/// </summary>
|
|
[Test]
|
|
public async Task TestAllConcurrent()
|
|
{
|
|
var pair = Pair;
|
|
var server = pair.Server;
|
|
await server.WaitIdleAsync();
|
|
var gameTicker = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<GameTicker>();
|
|
var cfg = server.ResolveDependency<IConfigurationManager>();
|
|
Assert.That(cfg.GetCVar(CCVars.GridFill), Is.False);
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
var rules = gameTicker.GetAllGameRulePrototypes().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);
|
|
}
|
|
});
|
|
|
|
// Wait three ticks for any random update loops that might happen
|
|
await server.WaitRunTicks(3);
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
// End all rules
|
|
gameTicker.ClearGameRules();
|
|
Assert.That(!gameTicker.GetAddedGameRules().Any());
|
|
});
|
|
}
|
|
}
|