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

ReplacePlayerDialog can now edit existing bot configs #4605

Merged
merged 7 commits into from
Jul 21, 2023

Conversation

pakfront
Copy link
Collaborator

@pakfront pakfront commented Jul 8, 2023

Add ability to edit existing Princess bots via the Replace Player... menu item.

  • Lists all ghosts and bots
  • Allows editing of Local Princess configs on existing bots, rather than having to kick them and then re-add them.
  • Button to restore bot settings from loaded MM save file. Ghost replacement does this by default.
  • Allows kicking of local and remote bots via UI, rather than having to use the command line. (no support for passworded servers)
  • (fix) protects initial bot configs saved in file from being overwritten by dialog. Copies settings before passing to dialog.
    replaceplayer

@pakfront pakfront self-assigned this Jul 8, 2023
@pakfront pakfront added (RFE) Enhancement Requests for Enhancement, new features or implementations GUI User Interface In Development (Draft) An additional way to mark something as a draft. Make it stand out more. labels Jul 8, 2023
@pakfront pakfront changed the title DRAFT Replace Player Dialog can edit existing bots DRAFT ReplacePlayerDialog can now edit existing bot configs Jul 8, 2023

Objects.requireNonNull(game);

Optional<Player> possible = game.getPlayersVector().stream()

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation

Invoking [AbstractGame.getPlayersVector](1) should be avoided because it has been deprecated.

Objects.requireNonNull(game);

Optional<Player> possible = game.getPlayersVector().stream()

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation

Invoking [AbstractGame.getPlayersVector](1) should be avoided because it has been deprecated.
@pakfront pakfront changed the title DRAFT ReplacePlayerDialog can now edit existing bot configs ReplacePlayerDialog can now edit existing bot configs Jul 8, 2023
@pakfront pakfront marked this pull request as ready for review July 8, 2023 22:19
@pakfront pakfront requested a review from SJuliez July 8, 2023 22:20
Copy link
Contributor

@Windchild292 Windchild292 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code largely looks good, just some cleanups first

megamek/src/megamek/common/util/AddBotUtil.java Outdated Show resolved Hide resolved
megamek/src/megamek/common/util/AddBotUtil.java Outdated Show resolved Hide resolved
megamek/src/megamek/common/util/AddBotUtil.java Outdated Show resolved Hide resolved
megamek/src/megamek/common/util/AddBotUtil.java Outdated Show resolved Hide resolved
@Thom293
Copy link
Contributor

Thom293 commented Jul 9, 2023

Looks cool. Should the menu item be renamed "Edit Player" to reflect the expanded functionality?

@pakfront
Copy link
Collaborator Author

Looks cool. Should the menu item be renamed "Edit Player" to reflect the expanded functionality?

Or maybe more appropriately, "Edit Bots..." What say you all?

@HammerGS
Copy link
Member

Edit Bots makes sense to me

@pakfront
Copy link
Collaborator Author

Or maybe more appropriately, "Edit Bots..." What say you all?

Should I go through and refactor property names, class names and method names to match? Or is that too disruptive?

@Thom293
Copy link
Contributor

Thom293 commented Jul 10, 2023

H

Or maybe more appropriately, "Edit Bots..." What say you all?

Should I go through and refactor property names, class names and method names to match? Or is that too disruptive?

Oof. I was just making the suggestion for clarity. That sounds like way too much work.

@pakfront
Copy link
Collaborator Author

That sounds like way too much work.

Just changing the label is easy, just checking with the group if they think it is worth having the code match.

@HammerGS
Copy link
Member

Or maybe more appropriately, "Edit Bots..." What say you all?

Should I go through and refactor property names, class names and method names to match? Or is that too disruptive?

I think anything that improves code readability and doesn't create a ton of work is always a win.

@pakfront
Copy link
Collaborator Author

Or maybe more appropriately, "Edit Bots..." What say you all?

Should I go through and refactor property names, class names and method names to match? Or is that too disruptive?

I think anything that improves code readability and doesn't create a ton of work is always a win.

OK, refactoring to rename ReplacePlayersDialog to EditBotsDialog and rename related symbols in code done.

}

protected void refreshPlayers() {
ghostAndBotPlayers = game.getPlayersVector().stream()

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation

Invoking [AbstractGame.getPlayersVector](1) should be avoided because it has been deprecated.
@pakfront pakfront removed the In Development (Draft) An additional way to mark something as a draft. Make it stand out more. label Jul 21, 2023
@SJuliez SJuliez merged commit 6eab905 into MegaMek:master Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI User Interface (RFE) Enhancement Requests for Enhancement, new features or implementations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants