From ee47475c69aea68f9587cd1815fb1d518a132864 Mon Sep 17 00:00:00 2001 From: Vigers Ray Date: Mon, 16 Dec 2024 00:07:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A8=D0=B0=D0=BD=D1=81=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=20=D0=B3=D0=BE=D0=BB=D0=BE?= =?UTF-8?q?=D1=81=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B7=D0=B0=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B6=D0=B8=D0=BC=20-=2050%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs | 6 +++++- Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs b/Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs index 6bbae40d73..9d3e5e4ea7 100644 --- a/Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs +++ b/Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs @@ -5,6 +5,7 @@ using Content.Shared._Sunrise.SunriseCCVars; using Content.Shared.Voting; using Robust.Shared.Timing; using Robust.Shared.Configuration; +using Robust.Shared.Random; namespace Content.Server._Sunrise.RoundEndVote; @@ -14,6 +15,7 @@ public sealed class RoundEndVoteSystem : EntitySystem [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IVoteManager _voteManager = default!; [Dependency] private readonly IConfigurationManager _cfg = default!; + [Dependency] private readonly IRobustRandom _random = default!; private TimeSpan? _voteStartTime; @@ -55,7 +57,9 @@ public sealed class RoundEndVoteSystem : EntitySystem if (_cfg.GetCVar(SunriseCCVars.RunMapVoteAfterRestart)) _voteManager.CreateStandardVote(null, StandardVoteType.Map); - if (_cfg.GetCVar(SunriseCCVars.RunPresetVoteAfterRestart)) + var presetVoteChance = _cfg.GetCVar(SunriseCCVars.ChancePresetVoteAfterRestart); + + if (_cfg.GetCVar(SunriseCCVars.RunPresetVoteAfterRestart) && _random.Prob(presetVoteChance)) _voteManager.CreateStandardVote(null, StandardVoteType.Preset); } } diff --git a/Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs b/Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs index 96fc69268a..0be5743b11 100644 --- a/Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs +++ b/Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs @@ -275,6 +275,8 @@ public sealed class SunriseCCVars public static readonly CVarDef RunPresetVoteAfterRestart = CVarDef.Create("vote.run_preset_vote_after_restart", false); + public static readonly CVarDef ChancePresetVoteAfterRestart = CVarDef.Create("vote.chance_preset_vote_after_restart", 0.5f); + public static readonly CVarDef VotingsDelay = CVarDef.Create("vote.votings_delay", 60); public static readonly CVarDef MapVotingCount = CVarDef.Create("vote.map_voting_count", 3);