diff --git a/Content.IntegrationTests/Tests/GameRules/SecretStartsTest.cs b/Content.IntegrationTests/Tests/GameRules/SecretStartsTest.cs
new file mode 100644
index 0000000000..9a5ff23fad
--- /dev/null
+++ b/Content.IntegrationTests/Tests/GameRules/SecretStartsTest.cs
@@ -0,0 +1,53 @@
+using System;
+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 SecretStartsTest
+{
+ ///
+ /// Tests that when secret is started, all of the game rules it successfully adds are also started.
+ ///
+ [Test]
+ public async Task TestSecretStarts()
+ {
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings()
+ {
+ NoClient = true,
+ Dirty = true,
+ });
+
+ var server = pairTracker.Pair.Server;
+ await server.WaitIdleAsync();
+ var protoMan = server.ResolveDependency();
+ var gameTicker = server.ResolveDependency().GetEntitySystem();
+
+ await server.WaitAssertion(() =>
+ {
+ gameTicker.StartGameRule(protoMan.Index("Secret"));
+ });
+
+ // Wait three ticks for any random update loops that might happen
+ await server.WaitRunTicks(3);
+
+ await server.WaitAssertion(() =>
+ {
+ foreach (var rule in gameTicker.AddedGameRules)
+ {
+ Assert.That(gameTicker.StartedGameRules.Contains(rule));
+ }
+
+ // End all rules
+ gameTicker.ClearGameRules();
+ });
+
+ await pairTracker.CleanReturnAsync();
+ }
+}
diff --git a/Content.IntegrationTests/Tests/GameRules/StartEndGameRulesTest.cs b/Content.IntegrationTests/Tests/GameRules/StartEndGameRulesTest.cs
index f1a61a9e45..90164e4dbe 100644
--- a/Content.IntegrationTests/Tests/GameRules/StartEndGameRulesTest.cs
+++ b/Content.IntegrationTests/Tests/GameRules/StartEndGameRulesTest.cs
@@ -41,6 +41,7 @@ public sealed class StartEndGameRulesTest
}
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
diff --git a/Content.Server/GameTicking/Rules/SecretRuleSystem.cs b/Content.Server/GameTicking/Rules/SecretRuleSystem.cs
index d8e2a3830f..783897aac2 100644
--- a/Content.Server/GameTicking/Rules/SecretRuleSystem.cs
+++ b/Content.Server/GameTicking/Rules/SecretRuleSystem.cs
@@ -37,7 +37,7 @@ public sealed class SecretRuleSystem : GameRuleSystem
foreach (var rule in _prototypeManager.Index(preset).Rules)
{
- _ticker.AddGameRule(_prototypeManager.Index(rule));
+ _ticker.StartGameRule(_prototypeManager.Index(rule));
}
}
}