Skip to content

Commit

Permalink
Шанс на запуск голосования за режим - 50%
Browse files Browse the repository at this point in the history
  • Loading branch information
VigersRay committed Dec 15, 2024
1 parent 7e0a8f4 commit ee47475
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Shared.Voting;
using Robust.Shared.Timing;
using Robust.Shared.Configuration;
using Robust.Shared.Random;

namespace Content.Server._Sunrise.RoundEndVote;

Expand All @@ -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;

Expand Down Expand Up @@ -55,7 +57,9 @@ public void StartRoundEndVotes()
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);
}
}
2 changes: 2 additions & 0 deletions Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ public static readonly CVarDef<bool>

public static readonly CVarDef<bool> RunPresetVoteAfterRestart = CVarDef.Create("vote.run_preset_vote_after_restart", false);

public static readonly CVarDef<float> ChancePresetVoteAfterRestart = CVarDef.Create("vote.chance_preset_vote_after_restart", 0.5f);

public static readonly CVarDef<int> VotingsDelay = CVarDef.Create("vote.votings_delay", 60);

public static readonly CVarDef<int> MapVotingCount = CVarDef.Create("vote.map_voting_count", 3);
Expand Down

0 comments on commit ee47475

Please sign in to comment.