Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new GM commands and client commands [WIP] #6242

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 44 additions & 4 deletions megamek/i18n/megamek/client/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4675,14 +4675,18 @@ Gamemaster.KillUnit=Kill Unit
Gamemaster.KillUnit.text=Kill Unit {0}
Gamemaster.KillUnit.confirmation=Are you sure you want to kill {0}?
Gamemaster.SpecialCommands=Special Actions

#Gamemaster Chat Commands
Gamemaster.cmd.missingUnit=Specified unit is not on the board.
Gamemaster.cmd.error.integerparse=must be between the min and max values:
Gamemaster.cmd.error.outofbounds=Specified hex is not on the board.
Gamemaster.cmd.help=Usage:
Gamemaster.cmd.params.required=Required.
Gamemaster.cmd.params.optional=Optional.
Gamemaster.cmd.x=The x coordinate of the hex.
Gamemaster.cmd.y=The y coordinate of the hex.
Gamemaster.cmd.playerID=The ID of the player that is going to be held as responsible.

# Rescue cmd
Gamemaster.cmd.rescue.longName=Rescue Unit
Gamemaster.cmd.rescue.unitID=ID of the unit to rescue.
Expand Down Expand Up @@ -4721,7 +4725,7 @@ Gamemaster.cmd.changeweather.blowsand=Blowing Sand
Gamemaster.cmd.changeweather.emi=EMI
Gamemaster.cmd.changeweather.weather=Weather
# Disaster cmd
Gamemaster.cmd.disaster.longName=Disaster
Gamemaster.cmd.disaster.longName=Disaster!
Gamemaster.cmd.disaster.help=Causes a disaster on the board.
Gamemaster.cmd.disaster.type=Type of disaster. Beware, some disasters are very destructive!
Gamemaster.cmd.changeweather.fog.success=The fog has changed.
Expand All @@ -4740,7 +4744,7 @@ Gamemaster.cmd.firestarter.longName=Start a Fire
Gamemaster.cmd.fire.type=Type of fire. They are 1=Normal, 2=Inferno, 3=Inferno Bomb or 4=Inferno IV.
Gamemaster.cmd.fire.help=Starts a fire on the board.
# Firestorm cmd
Gamemaster.cmd.firestorm.longName=Firestorm
Gamemaster.cmd.firestorm.longName=Start a Firestorm
Gamemaster.cmd.firestorm.help=Starts fire in the entire board.
Gamemaster.cmd.fire.failed=Failed to ignite fire.
Gamemaster.cmd.fire.percent=Percentage of the board hexes to ignite.
Expand All @@ -4751,14 +4755,50 @@ Gamemaster.cmd.orbitalbombardment.dmg=Total damage at target hex.
Gamemaster.cmd.orbitalbombardment.radius=Radius of the bombardment.
Gamemaster.cmd.orbitalbombardment.error.outofbounds=Specified hex is not on the board.
Gamemaster.cmd.orbitalbombardment.success=Orbital bombardment incoming!

#Nuclear strike
Gamemaster.cmd.nuke.longName=Nuclear Strike
Gamemaster.cmd.nuke.help=Calls a Nuclear Strike onto the board, to be exploded at the end of the next weapons attack phase.
Gamemaster.cmd.nuke.type=The type of nuke to drop.
Gamemaster.cmd.nuke.error.disabled=Command-line nukes are not enabled in this game.

Gamemaster.cmd.nuke.success=A nuke is incoming! Take cover!

#Nuclear strike custom
Gamemaster.cmd.nukec.longName=Nuclear Strike (Custom)
Gamemaster.cmd.nukec.help=Calls a Nuclear Strike onto the board with a custom bomb, to be exploded at the end of the next weapons attack phase.
Gamemaster.cmd.nukec.dmg=Total damage at target hex.
Gamemaster.cmd.nukec.radius=Radius of the secondary explosion of the nuclear strike.
Gamemaster.cmd.nukec.deg=Degradation of the nuclear strike.
Gamemaster.cmd.nukec.depth=Crater depth of the nuclear strike.

# Firefight
Gamemaster.cmd.firefight.longName=Firefight
Gamemaster.cmd.firefight.longName=Extinguish a Fire
Gamemaster.cmd.firefight.reason=Fire extinguished
Gamemaster.cmd.firefight.help=Extinguishes a fire on the board.

# No Fire
Gamemaster.cmd.nofire.longName=No Fires
Gamemaster.cmd.nofire.longName=Extinguish All Fires
Gamemaster.cmd.nofire.help=Extinguishes all fires on the board.

# Change player team
Gamemaster.cmd.changeteam.help=Changes the team of a player.
Gamemaster.cmd.changeteam.longName=Change Player Team
Gamemaster.cmd.changeteam.playerNotFound=No such player.
Gamemaster.cmd.changeteam.success=Player {0} has been moved to team {1}.
Gamemaster.cmd.changeteam.playerID=ID of the player to change team.
Gamemaster.cmd.changeteam.teamID=ID of the team to move the player to.
Gamemaster.cmd.changeteam.playerCantJoinUnassigned=Player must have no more units to join the unassigned team!

# End game
Gamemaster.cmd.endgame.success=This is the end of the game
Gamemaster.cmd.endgame.force=Force the game to finish before the end of the round
Gamemaster.cmd.endgame.help=Ends the game, declaring one player the winner. If the player is part of a team then their team wins.
Gamemaster.cmd.endgame.playerID=ID of the player to win the game, or whose team is to be declared winner.
Gamemaster.cmd.endgame.longName=End Game
Gamemaster.cmd.endgame.playerNotFound=No such player.


# Orbital Bombardment text
OrbitalBombardment.source=Unknown warship in orbit
OrbitalBombardment.hitOnRound=Orbital bombardment incoming, hit on round {0}
Expand Down
28 changes: 20 additions & 8 deletions megamek/src/megamek/client/ui/swing/MapMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import megamek.client.bot.princess.CardinalEdge;
import megamek.client.event.BoardViewEvent;
import megamek.client.ui.Messages;
import megamek.client.ui.swing.gmCommands.GamemasterCommandPanel;
import megamek.client.ui.swing.commands.ClientCommandPanel;
import megamek.client.ui.swing.lobby.LobbyUtility;
import megamek.common.*;
import megamek.common.Building.DemolitionCharge;
Expand Down Expand Up @@ -630,7 +630,7 @@ JMenuItem createTargetHexMenuItem(Player bot) {
/**
* Create various menus related to GameMaster (GM) mode
*
* @return
* @return JMenu
*/
private JMenu createGamemasterMenu() {
JMenu menu = new JMenu(Messages.getString("Gamemaster.Gamemaster"));
Expand Down Expand Up @@ -679,21 +679,33 @@ private JMenu createGamemasterMenu() {
*/
private JMenu createGMSpecialCommandsMenu() {
JMenu menu = new JMenu(Messages.getString("Gamemaster.SpecialCommands"));

var nukesAllowed = client.getGame().getOptions().booleanOption(OptionsConstants.ALLOWED_REALLY_ALLOW_NUKES)
&& client.getGame().getOptions().booleanOption(OptionsConstants.ALLOWED_ALLOW_NUKES);

List.of(
new ChangeOwnershipCommand(null, null),
new ChangeWeatherCommand(null, null),
new DisasterCommand(null, null),
new ChangeTeamCommand(null, null),
new ChangeOwnershipCommand(null, null),
new KillCommand(null, null),
new FirefightCommand(null, null),
new RescueCommand(null, null),
new FirestarterCommand(null, null),
new FirestormCommand(null, null),
new FirefightCommand(null, null),
new NoFiresCommand(null, null),
new OrbitalBombardmentCommand(null, null),
new RemoveSmokeCommand(null, null),
new RescueCommand(null, null)
new OrbitalBombardmentCommand(null, null),
new DisasterCommand(null, null),
new NuclearStrikeCommand(null, null),
new NuclearStrikeCustomCommand(null, null),
new EndGameCommand(null, null)
).forEach(cmd -> {
JMenuItem item = new JMenuItem(cmd.getLongName());
item.addActionListener(evt -> new GamemasterCommandPanel(gui.getFrame(), gui, cmd, coords).setVisible(true));
if (cmd instanceof NukeCommand) {
item.setEnabled(nukesAllowed);
}
item.addActionListener(evt -> new ClientCommandPanel(gui.getFrame(), gui, cmd, coords).setVisible(true));

menu.add(item);
});

Expand Down
Loading
Loading