From 8f7137e2cd577e97f446e799f60fae7bba518ea6 Mon Sep 17 00:00:00 2001 From: Rinary <72972221+Rinary1@users.noreply.github.com> Date: Wed, 30 Oct 2024 09:47:59 +0200 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=20=D0=B4=D0=BE=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=BA=D0=B0=20=D0=B3=D0=BE=D0=BB=D0=BE=D1=81?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B9=20(#555)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * init * откат генокрадов * from Delay to Update --- .../Managers/VoteManager.DefaultVotes.cs | 5 +-- .../RoundEndVote/RoundEndVoteSystem.cs | 31 +++++++++++++++++-- Resources/Prototypes/game_presets.yml | 10 +++++- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs b/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs index d1ebfa6634..5ce0aa1c2a 100644 --- a/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs +++ b/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs @@ -272,8 +272,9 @@ namespace Content.Server.Voting.Managers { var maps = new Dictionary(); var eligibleMaps = _gameMapManager.CurrentlyEligibleMaps().ToList(); - maps.Add(Loc.GetString("ui-vote-secret-map"), _random.Pick(eligibleMaps)); - foreach (var map in eligibleMaps) + var selectedMaps = eligibleMaps.OrderBy(_ => _random.Next()).Take(3).ToList(); + maps.Add(Loc.GetString("ui-vote-secret-map"), _random.Pick(selectedMaps)); + foreach (var map in selectedMaps) { maps.Add(map.MapName, map); } diff --git a/Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs b/Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs index 963aeb6031..5fd3ff91ad 100644 --- a/Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs +++ b/Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs @@ -1,8 +1,11 @@ +using System.Threading.Tasks; using Content.Server.GameTicking; using Content.Server.RoundEnd; using Content.Server.Voting.Managers; using Content.Shared._Sunrise.SunriseCCVars; using Content.Shared.Voting; +using Content.Shared.GameTicking; +using Robust.Shared.Timing; using Robust.Shared.Configuration; namespace Content.Server._Sunrise.RoundEndVote; @@ -10,8 +13,12 @@ namespace Content.Server._Sunrise.RoundEndVote; public sealed class RoundEndVoteSystem : EntitySystem { [Dependency] private readonly GameTicker _gameTicker = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly SharedGameTicker _sharedgameTicker = default!; [Dependency] private readonly IVoteManager _voteManager = default!; [Dependency] private readonly IConfigurationManager _cfg = default!; + + private TimeSpan? _voteStartTime = null; public override void Initialize() { @@ -19,8 +26,28 @@ public sealed class RoundEndVoteSystem : EntitySystem SubscribeLocalEvent(OnRoundEndSystemChange); } - - private void OnRoundEndSystemChange(RoundEndSystemChangedEvent args) + + public void OnRoundEndSystemChange(RoundEndSystemChangedEvent args) + { + _voteStartTime = _gameTiming.CurTime + _gameTicker.LobbyDuration - TimeSpan.FromSeconds(75); + Log.Warning($"Vote will start at {_voteStartTime}"); + } + + public override void Update(float frameTime) + { + base.Update(frameTime); + + if (_gameTicker.RunLevel != GameRunLevel.PreRoundLobby || _voteStartTime == null) + return; + + if (_gameTiming.CurTime >= _voteStartTime) + { + StartRoundEndVotes(); + _voteStartTime = null; + } + } + + public void StartRoundEndVotes() { if (_gameTicker.RunLevel != GameRunLevel.PreRoundLobby) return; diff --git a/Resources/Prototypes/game_presets.yml b/Resources/Prototypes/game_presets.yml index de631561c5..d9fd4f661c 100644 --- a/Resources/Prototypes/game_presets.yml +++ b/Resources/Prototypes/game_presets.yml @@ -37,6 +37,7 @@ description: all-at-once-description showInVote: false hide: false # Sunrise-Edit + minPlayers: 50 # Sunrise-Edit: 50 players for NUKEOPS rules: - Nukeops - Traitor @@ -58,6 +59,7 @@ description: aller-at-once-description showInVote: false #Please god dont do this hide: false # Sunrise-Edit + minPlayers: 50 # Sunrise-Edit: 50 players for NUKEOPS rules: - Nukeops - Traitor @@ -157,6 +159,7 @@ description: traitor-description showInVote: true # Sunrise-Edit hide: true # Sunrise-Edit + minPlayers: 5 # Sunrise-Edit: 50 players for TRAITORS rules: - Traitor - SubGamemodesRule @@ -186,6 +189,7 @@ description: nukeops-description showInVote: true # Sunrise-Edit hide: true # Sunrise-Edit + minPlayers: 50 # Sunrise-Edit: 50 players for NUKEOPS rules: - Nukeops - SubGamemodesRule @@ -204,6 +208,7 @@ description: rev-description showInVote: true # Sunrise-Edit hide: true # Sunrise-Edit + minPlayers: 15 # Sunrise-Edit: 50 players for REVOLUTIONARY rules: - Revolutionary - SubGamemodesRule @@ -224,6 +229,7 @@ description: zombie-description showInVote: true # Sunrise-Edit hide: true # Sunrise-Edit + minPlayers: 20 # Sunrise-Edit: 50 players for ZOMBIES rules: - Zombie - BasicStationEventScheduler @@ -241,6 +247,7 @@ description: zombieteors-description showInVote: true # Sunrise-Edit hide: true # Sunrise-Edit + minPlayers: 20 # Sunrise-Edit: 50 players for ZOMBIES rules: - Zombie - BasicStationEventScheduler @@ -256,7 +263,8 @@ - changeling name: changeling-gamemode-title description: changeling-gamemode-description - showInVote: false + showInVote: true + minPlayers: 50 # Sunrise-Edit: 50 players for CHANGELINGS rules: - Changeling - SubGamemodesRule