From 48ce11a904e04139608f8c9b081cac25be935e82 Mon Sep 17 00:00:00 2001 From: data-bomb Date: Sun, 10 Nov 2024 21:33:21 -0800 Subject: [PATCH] Adds Map Display Names to Vote - Instead of displaying the filename in the RTV ballot, now the map's display name is selected - (e.g., rather than "1. RiftBasin_TD" it will now say "1. Brenn's Chasm" - Change the RTV vote prompt text --- Si_Mapcycle/Si_Mapcycle.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Si_Mapcycle/Si_Mapcycle.cs b/Si_Mapcycle/Si_Mapcycle.cs index fd95920..d56d6f2 100644 --- a/Si_Mapcycle/Si_Mapcycle.cs +++ b/Si_Mapcycle/Si_Mapcycle.cs @@ -39,7 +39,7 @@ You should have received a copy of the GNU General Public License using System.Linq; using UnityEngine; -[assembly: MelonInfo(typeof(MapCycleMod), "Mapcycle", "1.6.4", "databomb", "https://github.com/data-bomb/Silica")] +[assembly: MelonInfo(typeof(MapCycleMod), "Mapcycle", "1.6.5", "databomb", "https://github.com/data-bomb/Silica")] [assembly: MelonGame("Bohemia Interactive", "Silica")] [assembly: MelonOptionalDependencies("Admin Mod")] @@ -223,7 +223,7 @@ public static void Command_RockTheVote(Player? callerPlayer, String args) rtvOptions[rtvIndex] = new OptionPair { Command = (rtvIndex + 1).ToString(), - Description = mapName + Description = GetDisplayName(mapName) }; rtvIndex++; @@ -247,7 +247,7 @@ public static void Command_RockTheVote(Player? callerPlayer, String args) rtvOptions[i] = new OptionPair { Command = (i + 1).ToString(), - Description = candidateMapName + Description = GetDisplayName(candidateMapName) }; break; @@ -262,7 +262,7 @@ public static void Command_RockTheVote(Player? callerPlayer, String args) ChatVoteBallot rtvBallot = new ChatVoteBallot { - Question = "Select the next map:", + Question = "Vote for a map:", VoteHandler = RockTheVote_Handler, Options = rtvOptions }; @@ -801,5 +801,16 @@ private static void IndexToMapInCycle(string mapName) } // if matchIndex == currentArrayIndex, no need to do anything } + + private static string GetDisplayName(string mapName) + { + LevelInfo? levelInfo = GetLevelInfo(mapName); + if (levelInfo == null) + { + return mapName; + } + + return levelInfo.DisplayName; + } } } \ No newline at end of file