From: LankLTE <135308300+LankLTE@users.noreply.github.com> Date: Fri, 5 Jan 2024 23:30:00 +0000 (-0800) Subject: add secret weight prototype cvar (#23564) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=4c179d69e7f9195c0e4a417c6aac931dbd23e8e9;p=space-station-14.git add secret weight prototype cvar (#23564) Add cvar --- diff --git a/Content.Server/GameTicking/Rules/SecretRuleSystem.cs b/Content.Server/GameTicking/Rules/SecretRuleSystem.cs index 835fddc9f5..afd6455f92 100644 --- a/Content.Server/GameTicking/Rules/SecretRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/SecretRuleSystem.cs @@ -2,8 +2,10 @@ using Content.Server.GameTicking.Presets; using Content.Server.GameTicking.Rules.Components; using Content.Shared.Random; using Content.Shared.Random.Helpers; +using Content.Shared.CCVar; using Robust.Shared.Prototypes; using Robust.Shared.Random; +using Robust.Shared.Configuration; namespace Content.Server.GameTicking.Rules; @@ -11,6 +13,7 @@ public sealed class SecretRuleSystem : GameRuleSystem { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly IConfigurationManager _configurationManager = default!; protected override void Started(EntityUid uid, SecretRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) { @@ -32,7 +35,8 @@ public sealed class SecretRuleSystem : GameRuleSystem { // TODO: This doesn't consider what can't start due to minimum player count, // but currently there's no way to know anyway as they use cvars. - var preset = _prototypeManager.Index("Secret").Pick(_random); + var presetString = _configurationManager.GetCVar(CCVars.SecretWeightPrototype); + var preset = _prototypeManager.Index(presetString).Pick(_random); Logger.InfoS("gamepreset", $"Selected {preset} for secret."); var rules = _prototypeManager.Index(preset).Rules; diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index ca8ed54f32..a65bf1a420 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -351,6 +351,12 @@ namespace Content.Shared.CCVar public static readonly CVarDef RoundRestartTime = CVarDef.Create("game.round_restart_time", 120f, CVar.SERVERONLY); + /// + /// The prototype to use for secret weights. + /// + public static readonly CVarDef SecretWeightPrototype = + CVarDef.Create("game.secret_weight_prototype", "Secret", CVar.SERVERONLY); + /* * Discord */