Skip to content

Commit

Permalink
feat: Allows GM to control any bot in the game
Browse files Browse the repository at this point in the history
  • Loading branch information
Scoppio committed Nov 26, 2024
1 parent 61d2def commit 6522f8a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions megamek/src/megamek/client/ui/swing/MapMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,17 +415,19 @@ private JMenu createSpecialHexDisplayMenu() {
*/
private JMenu createPleaToRoyaltyMenu() {
JMenu menu = new JMenu(Messages.getString("Bot.commands.title"));

var isGM = client.getLocalPlayer().isGameMaster();
for (var player : client.getGame().getPlayersList()) {
if (!player.isEnemyOf(client.getLocalPlayer()) && player.isBot()) {
var isEnemy = player.isEnemyOf(client.getLocalPlayer());
var playerIsBot = player.isBot();
if (playerIsBot && (!isEnemy || isGM)) {
menu.add(createBotCommands(player));
}
}
return menu;
}

private JMenu createBotCommands(Player bot) {
JMenu menu = new JMenu(bot.getName());
JMenu menu = new JMenu(bot.getName() + " (" + Player.TEAM_NAMES[bot.getTeam()] + ")");

JMenu targetHexMenu = new JMenu(Messages.getString("Bot.commands.targetHex"));
JMenu prioritizeTargetUnitMenu = new JMenu(Messages.getString("Bot.commands.priority"));
Expand Down

0 comments on commit 6522f8a

Please sign in to comment.