Class MinimapHexPicker

java.lang.Object
megamek.client.ui.dialogs.BotCommands.MinimapHexPicker

public class MinimapHexPicker extends Object
Lets the player pick the hexes for a bot order by clicking them on a map with no full board view, such as the Commander window's minimap. It works like HexTargetPicker does on the board: clicked hexes are marked and numbered on the map, clicking a marked hex again unmarks it, and a small dialog lists them with Done and Cancel. A one-hex order finishes on the first click. Picking is cancelled if the game phase changes.

The picked hexes go out as dash-joined hex numbers, e.g. 1508-1504, the same text the typed prompt sends.

  • Constructor Details

    • MinimapHexPicker

      public MinimapHexPicker(HexPickingMap map, IGame game, String orderDescription, boolean singleHex, int maxHexes, Consumer<String> onTargetsSelected)
      Parameters:
      map - the map to pick hexes on
      game - the game, watched so a phase change cancels the pick
      orderDescription - what the order is, shown in the dialog
      singleHex - true to finish after the first hex
      maxHexes - the most hexes that may be picked, or 0 for no limit
      onTargetsSelected - called with the picked hexes as dash-joined hex numbers, only if any were picked and the player chose Done
  • Method Details

    • start

      public void start()
      Starts picking: listens for clicks on the map and shows the Done / Cancel dialog.