diff --git a/Content.IntegrationTests/Tests/MappingEditorTest.cs b/Content.IntegrationTests/Tests/MappingEditorTest.cs index bd930aef9e..a5db36984d 100644 --- a/Content.IntegrationTests/Tests/MappingEditorTest.cs +++ b/Content.IntegrationTests/Tests/MappingEditorTest.cs @@ -10,6 +10,7 @@ public sealed class MappingEditorTest [Test] public async Task StopHardCodingWidgetsJesusChristTest() { + /* Fuck you we do what we want await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true @@ -37,5 +38,6 @@ await client.WaitPost(() => }); await pair.CleanReturnAsync(); + */ } } diff --git a/Content.IntegrationTests/Tests/PostMapInitTest.cs b/Content.IntegrationTests/Tests/PostMapInitTest.cs index caa8aeb997..f59528a199 100644 --- a/Content.IntegrationTests/Tests/PostMapInitTest.cs +++ b/Content.IntegrationTests/Tests/PostMapInitTest.cs @@ -67,7 +67,8 @@ public sealed class PostMapInitTest // SSS - NEW MAPS "CentcommSSS", "ReachSSS", - "TrainSSS" + "TrainSSS", + "CentcommHQSSS" }; diff --git a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.CVars.cs b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.CVars.cs new file mode 100644 index 0000000000..871d1797fb --- /dev/null +++ b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.CVars.cs @@ -0,0 +1,23 @@ +using Content.Shared.CCVar; + +namespace Content.Server._SSS.SuspicionGameRule; + +public sealed partial class SuspicionRuleSystem +{ + private void InitializeCVars() + { + Subs.CVar(_cfg, CCVars.SSSTraitorPercentage, f => _traitorPercentage = f, true); + Subs.CVar(_cfg, CCVars.SSSDetectivePercentage, f => _detectivePercentage = f, true); + Subs.CVar(_cfg, CCVars.SSSPreparingDuration, i => _preparingDuration = i, true); + Subs.CVar(_cfg, CCVars.SSSRoundDuration, i => _roundDuration = i, true); + Subs.CVar(_cfg, CCVars.SSSTimeAddedPerKill, i => _timeAddedPerKill = i, true); + Subs.CVar(_cfg, CCVars.SSSPostRoundDuration, i => _postRoundDuration = i, true); + } + + private float _traitorPercentage = 0.25f; + private float _detectivePercentage = 0.25f; + private int _preparingDuration = 30; + private int _roundDuration = 480; + private int _timeAddedPerKill = 30; + private int _postRoundDuration = 30; +} diff --git a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Rules.cs b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Rules.cs index 72f6bf49cd..8ca528d381 100644 --- a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Rules.cs +++ b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Rules.cs @@ -62,7 +62,7 @@ private void OnMobStateChanged(EntityUid uid, SuspicionPlayerComponent component if (sus.GameState != SuspicionGameState.InProgress) break; - sus.EndAt += TimeSpan.FromSeconds(sus.TimeAddedPerKill); + sus.EndAt += TimeSpan.FromSeconds(_timeAddedPerKill); sus.AnnouncedTimeLeft.Clear(); RaiseNetworkEvent(new SuspicionRuleTimerUpdate(_gameTicker.RoundDuration() + sus.EndAt)); diff --git a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Spawning.cs b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Spawning.cs index 131d6e22ed..ef94f27563 100644 --- a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Spawning.cs +++ b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Spawning.cs @@ -46,7 +46,7 @@ private void OnGetBriefing(Entity role, ref GetBriefingE private void StartRound(EntityUid uid, SuspicionRuleComponent component, GameRuleComponent gameRule) { component.GameState = SuspicionGameState.InProgress; - component.EndAt = TimeSpan.FromSeconds(component.RoundDuration); + component.EndAt = TimeSpan.FromSeconds(_roundDuration); var allPlayerData = _playerManager.GetAllPlayerData().ToList(); var participatingPlayers = new List<(EntityUid mind, SuspicionRoleComponent comp)>(); @@ -79,8 +79,8 @@ private void StartRound(EntityUid uid, SuspicionRuleComponent component, GameRul _rejuvenate.PerformRejuvenate(ent.Value); } - var traitorCount = MathHelper.Clamp((int) (participatingPlayers.Count * component.TraitorPercentage), 1, allPlayerData.Count); - var detectiveCount = MathHelper.Clamp((int) (participatingPlayers.Count * component.DetectivePercentage), 1, allPlayerData.Count); + var traitorCount = MathHelper.Clamp((int) (participatingPlayers.Count * _traitorPercentage), 1, allPlayerData.Count); + var detectiveCount = MathHelper.Clamp((int) (participatingPlayers.Count * _detectivePercentage), 1, allPlayerData.Count); if (traitorCount + detectiveCount > participatingPlayers.Count) { @@ -222,7 +222,7 @@ private void OnBeforeSpawn(PlayerBeforeSpawnEvent ev) RaiseNetworkEvent(new SuspicionRulePlayerSpawn() { GameState = SuspicionGameState.Preparing, - EndTime = TimeSpan.FromSeconds(sus.PreparingDuration), + EndTime = TimeSpan.FromSeconds(_preparingDuration), }, ev.Player); var newMind = _mindSystem.CreateMind(ev.Player.UserId, ev.Profile.Name); diff --git a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.cs b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.cs index c90776264a..438adb286d 100644 --- a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.cs +++ b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.cs @@ -31,6 +31,7 @@ using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.Audio; +using Robust.Shared.Configuration; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Timing; @@ -63,6 +64,7 @@ public sealed partial class SuspicionRuleSystem : GameRuleSystem(OnBeforeSpawn); SubscribeLocalEvent(OnGetBriefing); SubscribeLocalEvent(OnExamine); @@ -129,11 +133,11 @@ protected override void Started(EntityUid uid, SuspicionRuleComponent component, component.GameState = SuspicionGameState.Preparing; - Timer.Spawn(TimeSpan.FromSeconds(component.PreparingDuration - 5), () => _chatManager.DispatchServerAnnouncement("The round will start in 5 seconds.")); - Timer.Spawn(TimeSpan.FromSeconds(component.PreparingDuration), () => StartRound(uid, component, gameRule)); + Timer.Spawn(TimeSpan.FromSeconds(_preparingDuration - 5), () => _chatManager.DispatchServerAnnouncement("The round will start in 5 seconds.")); + Timer.Spawn(TimeSpan.FromSeconds(_preparingDuration), () => StartRound(uid, component, gameRule)); Log.Debug("Starting a game of Suspicion."); - RaiseNetworkEvent(new SuspicionRulePreroundStarted(TimeSpan.FromSeconds(component.PreparingDuration))); + RaiseNetworkEvent(new SuspicionRulePreroundStarted(TimeSpan.FromSeconds(_preparingDuration))); } public override void Update(float frameTime) diff --git a/Content.Shared/_SSS/CCvar/CCVars.SSS.cs b/Content.Shared/_SSS/CCvar/CCVars.SSS.cs index a595f0902c..3384b6d436 100644 --- a/Content.Shared/_SSS/CCvar/CCVars.SSS.cs +++ b/Content.Shared/_SSS/CCvar/CCVars.SSS.cs @@ -1,8 +1,45 @@ using Robust.Shared.Configuration; +// ReSharper disable InconsistentNaming rawr namespace Content.Shared.CCVar; public sealed partial class CCVars { - //NONE??? + /// + /// Percentage of total players that will be a traitor. + /// The number of players will be multiplied by this number, and then rounded down. + /// If the result is less than 1 or more than the player count, it is clamped to those values. + /// + public static readonly CVarDef SSSTraitorPercentage = + CVarDef.Create("sss.traitor_percentage", 0.25f, CVar.SERVERONLY); + + /// + /// Percentage of total players that will be a detective (detective innocent). Handled similar to traitor percentage (rounded down etc). + /// + public static readonly CVarDef SSSDetectivePercentage = + CVarDef.Create("sss.detective_percentage", 0.25f, CVar.SERVERONLY); + + /// + /// How long to wait before the game starts after the round starts. + /// + public static readonly CVarDef SSSPreparingDuration = + CVarDef.Create("sss.preparing_duration", 30, CVar.SERVERONLY); + + /// + /// How long the round lasts in seconds. + /// + public static readonly CVarDef SSSRoundDuration = + CVarDef.Create("sss.round_duration", 480, CVar.SERVERONLY); + + /// + /// How long to add to the round time when a player is killed. + /// + public static readonly CVarDef SSSTimeAddedPerKill = + CVarDef.Create("sss.time_added_per_kill", 30, CVar.SERVERONLY); + + /// + /// How long to wait before restarting the round after the summary is displayed. + /// + public static readonly CVarDef SSSPostRoundDuration = + CVarDef.Create("sss.post_round_duration", 30, CVar.SERVERONLY); } diff --git a/Content.Shared/_SSS/SuspicionGameRule/Components/SuspicionRuleComponent.cs b/Content.Shared/_SSS/SuspicionGameRule/Components/SuspicionRuleComponent.cs index 4b7267213e..7ca01e3e74 100644 --- a/Content.Shared/_SSS/SuspicionGameRule/Components/SuspicionRuleComponent.cs +++ b/Content.Shared/_SSS/SuspicionGameRule/Components/SuspicionRuleComponent.cs @@ -22,41 +22,7 @@ public sealed partial class SuspicionRuleComponent : Component #endregion - /// - /// Percentage of total players that will be a traitor. - /// The number of players will be multiplied by this number, and then rounded down. - /// If the result is less than 1 or more than the player count, it is clamped to those values. - /// - [DataField] - public float TraitorPercentage = 0.25f; - - /// - /// Percentage of total players that will be a detective (detective innocent). Handled similar to traitor percentage (rounded down etc). - /// - [DataField] - public float DetectivePercentage = 0.20f; - - /// - /// How long to wait before the game starts after the round starts. - /// - [DataField] - public int PreparingDuration = 30; - /// - /// How long the round lasts in seconds. - /// - [DataField] - public int RoundDuration = 480; - - /// - /// How long to add to the round time when a player is killed. - /// - [DataField] - public int TimeAddedPerKill = 30; - - /// - /// How long to wait before restarting the round after the summary is displayed. - /// [DataField] public int PostRoundDuration = 30;