From fe43a317a8dd0e2327eda832ebd9ab543772bd69 Mon Sep 17 00:00:00 2001 From: VigersRay Date: Fri, 7 Jun 2024 11:20:56 +0300 Subject: [PATCH 1/3] =?UTF-8?q?=D0=A1=D0=B5=D0=BA=D1=80=D0=B5=D1=82=20?= =?UTF-8?q?=D0=B2=20=D0=B3=D0=BE=D0=BB=D0=BE=D1=81=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B7=D0=B0=20=D0=BA=D0=B0=D1=80=D1=82=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Managers/VoteManager.DefaultVotes.cs | 29 +++++++++++++++---- .../ru-RU/voting/managers/vote-manager.ftl | 3 ++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs b/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs index c479f749895..be3ea70a059 100644 --- a/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs +++ b/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs @@ -1,3 +1,4 @@ +using System.Collections.Specialized; using System.Linq; using Content.Server.GameTicking; using Content.Server.GameTicking.Presets; @@ -57,7 +58,7 @@ private void CreateRestartVote(ICommonSession? initiator) var ghostVotePercentageRequirement = _cfg.GetCVar(CCVars.VoteRestartGhostPercentage); var ghostCount = 0; - + foreach (var player in _playerManager.Sessions) { _playerManager.UpdateState(player); @@ -212,7 +213,13 @@ private void CreatePresetVote(ICommonSession? initiator) private void CreateMapVote(ICommonSession? initiator) { - var maps = _gameMapManager.CurrentlyEligibleMaps().ToDictionary(map => map, map => map.MapName); + 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) + { + maps.Add(map.MapName, map); + } var alone = _playerManager.PlayerCount == 1 && initiator != null; var options = new VoteOptions @@ -228,7 +235,7 @@ private void CreateMapVote(ICommonSession? initiator) foreach (var (k, v) in maps) { - options.Options.Add((v, k)); + options.Options.Add((k, v)); } WirePresetVoteInitiator(options, initiator); @@ -238,17 +245,27 @@ private void CreateMapVote(ICommonSession? initiator) vote.OnFinished += (_, args) => { GameMapPrototype picked; + string title; if (args.Winner == null) { picked = (GameMapPrototype) _random.Pick(args.Winners); + title = maps.FirstOrDefault(x => x.Value == picked).Key; _chatManager.DispatchServerAnnouncement( - Loc.GetString("ui-vote-map-tie", ("picked", maps[picked]))); + Loc.GetString("ui-vote-map-tie", ("picked", title))); } else { picked = (GameMapPrototype) args.Winner; - _chatManager.DispatchServerAnnouncement( - Loc.GetString("ui-vote-map-win", ("winner", maps[picked]))); + title = maps.FirstOrDefault(x => x.Value == picked).Key; + } + if (title == Loc.GetString("ui-vote-secret-map")) + { + _chatManager.DispatchServerAnnouncement(Loc.GetString("ui-vote-secret-win")); + } + else + { + _chatManager.DispatchServerAnnouncement(Loc.GetString("ui-vote-map-win", + ("winner", title))); } _adminLogger.Add(LogType.Vote, LogImpact.Medium, $"Map vote finished: {picked.MapName}"); diff --git a/Resources/Locale/ru-RU/voting/managers/vote-manager.ftl b/Resources/Locale/ru-RU/voting/managers/vote-manager.ftl index b5ad2bd86e9..0f70f08c60c 100644 --- a/Resources/Locale/ru-RU/voting/managers/vote-manager.ftl +++ b/Resources/Locale/ru-RU/voting/managers/vote-manager.ftl @@ -17,3 +17,6 @@ ui-vote-map-tie = Ничья при голосовании за карту! Вы ui-vote-map-win = { $winner } выиграла голосование о выборе карты! ui-vote-map-notlobby = Голосование о выборе карты действует только в предраундовом лобби! ui-vote-map-notlobby-time = Голосование о выборе карты действует только в предраундовом лобби, когда осталось { $time }! + +ui-vote-secret-map = Секрет +ui-vote-secret-win = Следующая карта будет выбрана случайным образом. From 7465aa0c7c40df3fcacadeb566a104ec36d0e276 Mon Sep 17 00:00:00 2001 From: VigersRay Date: Fri, 7 Jun 2024 11:22:33 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D0=BC=D0=B0=D1=82?= =?UTF-8?q?=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=BE=D0=B5=20=D0=B3=D0=BE=D0=BB?= =?UTF-8?q?=D0=BE=D1=81=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B7=D0=B0?= =?UTF-8?q?=20=D0=BA=D0=B0=D1=80=D1=82=D1=83=20=D0=B2=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=86=D0=B5=20=D1=80=D0=B0=D1=83=D0=BD=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Client/Voting/UI/VoteCallMenu.xaml.cs | 3 +- .../RoundEndVote/RoundEndVoteSystem.cs | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs diff --git a/Content.Client/Voting/UI/VoteCallMenu.xaml.cs b/Content.Client/Voting/UI/VoteCallMenu.xaml.cs index 0eede4c4804..93a4763366a 100644 --- a/Content.Client/Voting/UI/VoteCallMenu.xaml.cs +++ b/Content.Client/Voting/UI/VoteCallMenu.xaml.cs @@ -31,7 +31,8 @@ public static readonly (string name, StandardVoteType type, (string name, string { ("ui-vote-type-restart", StandardVoteType.Restart, null), ("ui-vote-type-gamemode", StandardVoteType.Preset, null), - ("ui-vote-type-map", StandardVoteType.Map, null) + //("ui-vote-type-map", StandardVoteType.Map, null) + // Sunrise-edit: Голосование за карту автоматическое после конца раунда. }; public VoteCallMenu() diff --git a/Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs b/Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs new file mode 100644 index 00000000000..e5be2c77009 --- /dev/null +++ b/Content.Server/_Sunrise/RoundEndVote/RoundEndVoteSystem.cs @@ -0,0 +1,30 @@ +using Content.Server.GameTicking; +using Content.Server.RoundEnd; +using Content.Server.Voting.Managers; +using Content.Shared.Voting; + +namespace Content.Server._Sunrise.RoundEndVote; + +public sealed class RoundEndVoteSystem : EntitySystem +{ + [Dependency] private readonly GameTicker _gameTicker = default!; + [Dependency] private readonly IVoteManager _voteManager = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnRoundEndSystemChange); + } + + private void OnRoundEndSystemChange(RoundEndSystemChangedEvent args) + { + if (_gameTicker.RunLevel != GameRunLevel.PreRoundLobby) + return; + + // Очень жаль + //_voteManager.CreateStandardVote(null, StandardVoteType.Preset); + _voteManager.CreateStandardVote(null, StandardVoteType.Map); + _gameTicker.SetGamePreset("Secret"); + } +} From 63ac5f89afca5ff7d8b1a19f504e37c65d6f6b70 Mon Sep 17 00:00:00 2001 From: VigersRay Date: Fri, 7 Jun 2024 11:24:47 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=D1=87=D0=B5=D0=B9=D0=BD=D0=B6=D0=BB=D0=BE?= =?UTF-8?q?=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Resources/Changelog/ChangelogSunrise.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Resources/Changelog/ChangelogSunrise.yml b/Resources/Changelog/ChangelogSunrise.yml index 7751e48ef57..ddbbd46d82e 100644 --- a/Resources/Changelog/ChangelogSunrise.yml +++ b/Resources/Changelog/ChangelogSunrise.yml @@ -259,12 +259,12 @@ Entries: - author: Odleer changes: - message: "\u0420\u0435\u0434\u0438\u0437\u0430\u0439\u0434 \u0441\u043F\u0440\u0430\ - \u0439\u0442\u043E\u0432 \u0448\u043B\u044E\u0437\u043E\u0432, \u043F\u043B\ - \u0438\u0442\u043A\u0438, \u0441\u0442\u0435\u043D \u0438 \u043C\u043D\u043E\ - \u0433\u043E\u0433\u043E \u0434\u0440\u0443\u0433\u043E\u0433\u043E." + \u0439\u0442\u043E\u0432 \u0448\u043B\u044E\u0437\u043E\u0432, \u043F\u043B\u0438\ + \u0442\u043A\u0438, \u0441\u0442\u0435\u043D \u0438 \u043C\u043D\u043E\u0433\ + \u043E\u0433\u043E \u0434\u0440\u0443\u0433\u043E\u0433\u043E." type: Tweak - - message: "\u0412 \u043F\u0443\u043B\u043B\u0435 \u043A\u0430\u0440\u0442 marathon, - fland, delta, cluster, box." + - message: "\u0412 \u043F\u0443\u043B\u043B\u0435 \u043A\u0430\u0440\u0442 marathon,\ + \ fland, delta, cluster, box." type: Tweak - message: "\u0412\u043E\u0437\u0432\u0440\u0430\u0449\u0435\u043D\u0438\u0435 \u0438\ \u0437\u043C\u0435\u043D\u0451\u043D\u043D\u043E\u0439 \u0441\u0442\u0430\u043D\ @@ -291,3 +291,16 @@ Entries: type: Add id: 25 time: '2024-06-06T15:19:19.017263+00:00' +- author: VigersRay + changes: + - message: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D \u0441\u0435\u043A\u0440\ + \u0435\u0442 \u0432 \u0433\u043E\u043B\u043E\u0441\u043E\u0432\u0430\u043D\u0438\ + \u0435 \u0437\u0430 \u0441\u0442\u0430\u043D\u0446\u0438\u044E." + type: Tweak + - message: "\u0413\u043E\u043B\u043E\u0441\u043E\u0432\u0430\u043D\u0438\u0435 \u0437\ + \u0430 \u0441\u0442\u0430\u043D\u0446\u0438\u044E \u0430\u0432\u0442\u043E\u043C\ + \u0430\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0435 \u0432 \u043A\u043E\u043D\ + \u0446\u0435 \u0440\u0430\u0443\u043D\u0434\u0430." + type: Tweak + id: 26 + time: '2024-06-07T08:24:40.104466+00:00'