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

Added Execution and Jettison Options for Prisoners #4395

Merged
merged 4 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions MekHQ/resources/mekhq/resources/GUI.properties
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ gained.format=%s gained %s!
confirmRetireQ.format=Do you really want to change the status of %s to a non-active status?
numPrisoners.text=%d prisoners
confirmFree.format=Do you really want to set %s free?
confirmExecute.format=Do you really want to execute %s?
confirmJettison.format=Do you really want to push %s out an airlock?
freeQ.text=Free?
executeQ.text=Execute?
jettisonQ.text=Jettison?
ransomQ.format=Ransom %d prisoners for %s?
ransom.text=Ransom
ransomReport.format=%d prisoners have been ransomed for %s.
Expand All @@ -92,6 +96,8 @@ changeSecondaryDesignation.text=Change Secondary Designation
changeStatus.text=Change Status
imprison.text=Imprison
free.text=Free
execute.text=Execute
jettison.text=Jettison
recruit.text=Recruit
abtakha.text=Adopt (Abtakha)
changePrimaryRole.text=Change Primary Role
Expand Down
38 changes: 34 additions & 4 deletions MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ public class PersonnelTableMouseAdapter extends JPopupMenuAdapter {

private static final String CMD_IMPRISON = "IMPRISON";
private static final String CMD_FREE = "FREE";
private static final String CMD_EXECUTE = "EXECUTE";
private static final String CMD_JETTISON = "JETTISON";
private static final String CMD_RECRUIT = "RECRUIT";
private static final String CMD_ABTAKHA = "ABTAKHA";
private static final String CMD_RANSOM = "RANSOM";
Expand Down Expand Up @@ -633,8 +635,6 @@ public void actionPerformed(ActionEvent action) {
break;
}
case CMD_FREE: {
// TODO: Warn in particular for "freeing" in deep space, leading to Geneva Conventions violation (#1400 adding Crime to MekHQ)
// TODO: Record the people into some NPC pool, if still alive
String title = (people.length == 1) ? people[0].getFullTitle()
: String.format(resources.getString("numPrisoners.text"), people.length);
if (0 == JOptionPane.showConfirmDialog(null,
Expand All @@ -647,6 +647,32 @@ public void actionPerformed(ActionEvent action) {
}
break;
}
case CMD_EXECUTE: {
String title = (people.length == 1) ? people[0].getFullTitle()
: String.format(resources.getString("numPrisoners.text"), people.length);
if (0 == JOptionPane.showConfirmDialog(null,
String.format(resources.getString("confirmExecute.format"), title),
resources.getString("executeQ.text"),
JOptionPane.YES_NO_OPTION)) {
for (Person person : people) {
gui.getCampaign().removePerson(person);
}
}
break;
}
case CMD_JETTISON: {
String title = (people.length == 1) ? people[0].getFullTitle()
: String.format(resources.getString("numPrisoners.text"), people.length);
if (0 == JOptionPane.showConfirmDialog(null,
String.format(resources.getString("confirmJettison.format"), title),
resources.getString("jettisonQ.text"),
JOptionPane.YES_NO_OPTION)) {
for (Person person : people) {
gui.getCampaign().removePerson(person);
}
}
break;
}
case CMD_RECRUIT: {
for (Person person : people) {
if (person.getPrisonerStatus().isPrisonerDefector()) {
Expand Down Expand Up @@ -1281,8 +1307,12 @@ protected Optional<JPopupMenu> createPopupMenu() {
if (StaticChecks.areAnyFree(selected)) {
popup.add(newMenuItem(resources.getString("imprison.text"), CMD_IMPRISON));
} else {
// If none are free, then we can put the Free option
popup.add(newMenuItem(resources.getString("free.text"), CMD_FREE));
if (gui.getCampaign().getLocation().isOnPlanet()) {
popup.add(newMenuItem(resources.getString("free.text"), CMD_FREE));
popup.add(newMenuItem(resources.getString("execute.text"), CMD_EXECUTE));
} else {
popup.add(newMenuItem(resources.getString("jettison.text"), CMD_JETTISON));
}
}

if (gui.getCampaign().getCampaignOptions().isUseAtBPrisonerRansom() && StaticChecks.areAllPrisoners(selected)) {
Expand Down