Files
552943ee3c oh no all hell broke loose ghost roles are broken (#43735)
* :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>
2026-04-27 02:21:38 +00:00

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());
});
}
}