Skip to content

Commit

Permalink
Adds Map Display Names to Vote
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
data-bomb committed Nov 11, 2024
1 parent a75d7bc commit 48ce11a
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions Si_Mapcycle/Si_Mapcycle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

Expand Down Expand Up @@ -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++;
Expand All @@ -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;
Expand All @@ -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
};
Expand Down Expand Up @@ -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;
}
}
}

0 comments on commit 48ce11a

Please sign in to comment.