From 0f63e51fc35e36a75321a9f8b5407ec0b50e02ab Mon Sep 17 00:00:00 2001 From: DM0000 <98051919+DM0000@users.noreply.github.com> Date: Sat, 2 Nov 2024 03:27:46 -0700 Subject: [PATCH 1/2] manual shutdown no option needed --- .../client/ui/swing/GameOptionsDialog.java | 30 ++++++++++--------- .../client/ui/swing/MovementDisplay.java | 20 ++++++------- .../megamek/common/options/GameOptions.java | 2 +- .../common/options/OptionsConstants.java | 2 +- megamek/src/megamek/server/ServerHelper.java | 8 +++-- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/megamek/src/megamek/client/ui/swing/GameOptionsDialog.java b/megamek/src/megamek/client/ui/swing/GameOptionsDialog.java index 449e0cb1424..752ecf4f400 100644 --- a/megamek/src/megamek/client/ui/swing/GameOptionsDialog.java +++ b/megamek/src/megamek/client/ui/swing/GameOptionsDialog.java @@ -483,13 +483,15 @@ private void addOption(JPanel groupPanel, IOption option) { //Set to the maximum velocity if over option.setValue(CapitalMissileBayWeapon.CAPITAL_MISSILE_MAX_VELOCITY); } - } else if (option.getName().equals(OptionsConstants.RPG_BEGIN_SHUTDOWN)) { - if ((options.getOption(OptionsConstants.RPG_MANUAL_SHUTDOWN)).booleanValue()) { - optionComp.setEditable(editable); - } else { - optionComp.setEditable(false); - } - } else if (option.getName().equals(OptionsConstants.ADVANCED_ALTERNATE_MASC_ENHANCED)) { + } + // else if (option.getName().equals(OptionsConstants.RPG_BEGIN_SHUTDOWN)) { + // if ((options.getOption(OptionsConstants.RPG_MANUAL_SHUTDOWN)).booleanValue()) { + // optionComp.setEditable(editable); + // } else { + // optionComp.setEditable(false); + // } + // } + else if (option.getName().equals(OptionsConstants.ADVANCED_ALTERNATE_MASC_ENHANCED)) { if ((options.getOption(OptionsConstants.ADVANCED_ALTERNATE_MASC)).booleanValue()) { optionComp.setEditable(editable); } else { @@ -729,13 +731,13 @@ public void optionClicked(DialogOptionComponent clickedComp, IOption option, boo comp_i.resetToDefault(); } } - if (option.getName().equals(OptionsConstants.RPG_MANUAL_SHUTDOWN)) { - comps = optionComps.get(OptionsConstants.RPG_BEGIN_SHUTDOWN); - for (DialogOptionComponent comp_i : comps) { - comp_i.setEditable(state); - comp_i.setSelected(false); - } - } + // if (option.getName().equals(OptionsConstants.RPG_MANUAL_SHUTDOWN)) { + // comps = optionComps.get(OptionsConstants.RPG_BEGIN_SHUTDOWN); + // for (DialogOptionComponent comp_i : comps) { + // comp_i.setEditable(state); + // comp_i.setSelected(false); + // } + // } if (option.getName().equals(OptionsConstants.ADVANCED_ALTERNATE_MASC)) { comps = optionComps.get(OptionsConstants.ADVANCED_ALTERNATE_MASC_ENHANCED); for (DialogOptionComponent comp_i : comps) { diff --git a/megamek/src/megamek/client/ui/swing/MovementDisplay.java b/megamek/src/megamek/client/ui/swing/MovementDisplay.java index 9b55856e8aa..43946cba612 100644 --- a/megamek/src/megamek/client/ui/swing/MovementDisplay.java +++ b/megamek/src/megamek/client/ui/swing/MovementDisplay.java @@ -282,13 +282,13 @@ public String getHotKeyDesc() { * @return An array of valid commands for the given parameters */ public static MoveCommand[] values(int f, GameOptions opts, boolean forwardIni) { - boolean manualShutdown = false; + boolean manualShutdown = true; boolean selfDestruct = false; boolean advVehicle = false; boolean vtolStrafe = false; if (opts != null) { - manualShutdown = opts.booleanOption(OptionsConstants.RPG_MANUAL_SHUTDOWN); + // manualShutdown = opts.booleanOption(OptionsConstants.RPG_MANUAL_SHUTDOWN); selfDestruct = opts.booleanOption(OptionsConstants.ADVANCED_TACOPS_SELF_DESTRUCT); advVehicle = opts.booleanOption(OptionsConstants.ADVGRNDMOV_VEHICLE_ADVANCED_MANEUVERS); vtolStrafe = opts.booleanOption(OptionsConstants.ADVCOMBAT_VTOL_STRAFING); @@ -2616,10 +2616,10 @@ private void updateShutdownButton() { return; } - if (!clientgui.getClient().getGame().getOptions() - .booleanOption(OptionsConstants.RPG_MANUAL_SHUTDOWN)) { - return; - } + // if (!clientgui.getClient().getGame().getOptions() + // .booleanOption(OptionsConstants.RPG_MANUAL_SHUTDOWN)) { + // return; + // } if (ce instanceof Infantry) { return; @@ -2635,10 +2635,10 @@ private void updateStartupButton() { return; } - if (!clientgui.getClient().getGame().getOptions() - .booleanOption(OptionsConstants.RPG_MANUAL_SHUTDOWN)) { - return; - } + // if (!clientgui.getClient().getGame().getOptions() + // .booleanOption(OptionsConstants.RPG_MANUAL_SHUTDOWN)) { + // return; + // } if (ce instanceof Infantry) { return; diff --git a/megamek/src/megamek/common/options/GameOptions.java b/megamek/src/megamek/common/options/GameOptions.java index 77fae48cbde..b9f520fa4de 100755 --- a/megamek/src/megamek/common/options/GameOptions.java +++ b/megamek/src/megamek/common/options/GameOptions.java @@ -303,7 +303,7 @@ public synchronized void initialize() { addOption(rpg, OptionsConstants.RPG_ARTILLERY_SKILL, false); addOption(rpg, OptionsConstants.RPG_TOUGHNESS, false); addOption(rpg, OptionsConstants.RPG_CONDITIONAL_EJECTION, false); - addOption(rpg, OptionsConstants.RPG_MANUAL_SHUTDOWN, false); + // addOption(rpg, OptionsConstants.RPG_MANUAL_SHUTDOWN, false); addOption(rpg, OptionsConstants.RPG_BEGIN_SHUTDOWN, false); } diff --git a/megamek/src/megamek/common/options/OptionsConstants.java b/megamek/src/megamek/common/options/OptionsConstants.java index 0a46c5d48e7..7af04f0b056 100644 --- a/megamek/src/megamek/common/options/OptionsConstants.java +++ b/megamek/src/megamek/common/options/OptionsConstants.java @@ -526,7 +526,7 @@ public class OptionsConstants { public static final String RPG_ARTILLERY_SKILL = "artillery_skill"; public static final String RPG_TOUGHNESS = "toughness"; public static final String RPG_CONDITIONAL_EJECTION = "conditional_ejection"; - public static final String RPG_MANUAL_SHUTDOWN = "manual_shutdown"; + // public static final String RPG_MANUAL_SHUTDOWN = "manual_shutdown"; public static final String RPG_BEGIN_SHUTDOWN = "begin_shutdown"; private OptionsConstants() { } diff --git a/megamek/src/megamek/server/ServerHelper.java b/megamek/src/megamek/server/ServerHelper.java index 268609224b4..afcb6d3ac5f 100644 --- a/megamek/src/megamek/server/ServerHelper.java +++ b/megamek/src/megamek/server/ServerHelper.java @@ -279,9 +279,11 @@ public static void resolveAeroHeat(Game game, Entity entity, Vector vPha int roll = Compute.d6(2); if (roll >= 8) { entity.setTaserShutdownRounds(0); - if (!(game.getOptions().booleanOption( - OptionsConstants.RPG_MANUAL_SHUTDOWN) - && entity.isManualShutdown())) { + if (!( + // game.getOptions().booleanOption( + // OptionsConstants.RPG_MANUAL_SHUTDOWN) + // && + entity.isManualShutdown())) { entity.setShutDown(false); } entity.setBATaserShutdown(false); From 28b26496b2596b12ce38e5cb5cb57a4b95f7fe21 Mon Sep 17 00:00:00 2001 From: DM0000 <98051919+DM0000@users.noreply.github.com> Date: Sat, 2 Nov 2024 10:15:43 -0700 Subject: [PATCH 2/2] clean up and remove unused code --- .../megamek/common/options/messages.properties | 2 -- .../common/options/messages_es.properties | 2 -- .../common/options/messages_ru.properties | 2 -- .../client/ui/swing/GameOptionsDialog.java | 16 +--------------- .../megamek/client/ui/swing/MovementDisplay.java | 11 ----------- .../src/megamek/common/options/GameOptions.java | 1 - .../megamek/common/options/OptionsConstants.java | 1 - megamek/src/megamek/server/ServerHelper.java | 6 +----- 8 files changed, 2 insertions(+), 39 deletions(-) diff --git a/megamek/i18n/megamek/common/options/messages.properties b/megamek/i18n/megamek/common/options/messages.properties index 78fd3cd33c0..17f1fe80a6e 100644 --- a/megamek/i18n/megamek/common/options/messages.properties +++ b/megamek/i18n/megamek/common/options/messages.properties @@ -549,8 +549,6 @@ GameOptionsInfo.option.toughness.displayableName=(Unofficial) Toughness Bonus GameOptionsInfo.option.toughness.description=Each pilot can have a toughness bonus that reduces the target for consciousness checks. GameOptionsInfo.option.conditional_ejection.displayableName=(Unofficial) Conditional Autoejection GameOptionsInfo.option.conditional_ejection.description=Only fire the ejection system if one of the conditions is met. This way you can eject on engine explosions and head shots, but not on ammo explosions (like when you have CASE). -GameOptionsInfo.option.manual_shutdown.displayableName=(Unofficial) Manual Shutdown/Startup -GameOptionsInfo.option.manual_shutdown.description=Adds a button in the movement phase for manual shutdown/startup. GameOptionsInfo.option.begin_shutdown.displayableName=(Unofficial) Begin Game Shutdown GameOptionsInfo.option.begin_shutdown.description=Adds a deployment option to begin the game in a shutdown state. Requires Manual Shutdown/Startup GameOptionsInfo.option.max_external_heat.displayableName=(Unofficial) Maximum Heat from External Heat Sources diff --git a/megamek/i18n/megamek/common/options/messages_es.properties b/megamek/i18n/megamek/common/options/messages_es.properties index b9bb042daf5..b7396e84b4d 100644 --- a/megamek/i18n/megamek/common/options/messages_es.properties +++ b/megamek/i18n/megamek/common/options/messages_es.properties @@ -516,8 +516,6 @@ GameOptionsInfo.option.toughness.displayableName=(No oficial) Bono dureza GameOptionsInfo.option.toughness.description=Cada piloto puede tener una bonificacion de dureza que reduce el objetivo de las pruebas de conciencia. GameOptionsInfo.option.conditional_ejection.displayableName=(No oficial) Autoeyeccion condicional GameOptionsInfo.option.conditional_ejection.description=Solo dispare el sistema de expulsion si se cumple una de las condiciones. De esta manera, puede ejectar en explosion de motor y disparos a la cabeza, pero no explosiones de municion (como cuando tiene CASE). -GameOptionsInfo.option.manual_shutdown.displayableName=(No oficial) Apagado/inicio manual -GameOptionsInfo.option.manual_shutdown.description=Agrega un boton en la fase de movimiento para apagado/inicio manual. GameOptionsInfo.option.begin_shutdown.displayableName=(No oficial) Comienza el cierre del juego GameOptionsInfo.option.begin_shutdown.description=Agrega una opcion de despliegue para comenzar el juego en un estado de apagado.\nRequiere apagado/inicio manual. GameOptionsInfo.option.max_external_heat.displayableName=(No oficial) Calor maximo de fuentes de calor externas diff --git a/megamek/i18n/megamek/common/options/messages_ru.properties b/megamek/i18n/megamek/common/options/messages_ru.properties index fa1bf9b105b..ea50d37ea18 100644 --- a/megamek/i18n/megamek/common/options/messages_ru.properties +++ b/megamek/i18n/megamek/common/options/messages_ru.properties @@ -468,8 +468,6 @@ GameOptionsInfo.option.toughness.displayableName=(Неофициально) Бо GameOptionsInfo.option.toughness.description=У каждого пилота может быть бонус здоровья, который уменьшает целевое число при бросках на потерю сознания. GameOptionsInfo.option.conditional_ejection.displayableName=(Неофициально) Условное автокатапультирование GameOptionsInfo.option.conditional_ejection.description=Применять систему катапультирования только при определенных условиях. Например, вы можете катапультироваться при взрыве двигателя или попадании в голову, но не при подрыве боезапаса (когда у вас есть CASE). -GameOptionsInfo.option.manual_shutdown.displayableName=(Неофициально) Ручное отключение/включение -GameOptionsInfo.option.manual_shutdown.description=Добавляет кнопку в фазе движения для ручного отключения или включения. GameOptionsInfo.option.begin_shutdown.displayableName=(Неофициально) Отключение с начала игры GameOptionsInfo.option.begin_shutdown.description=Добавляет опция при расстановке, начинать игру отключенным.\nТребует ручного отключения/включения GameOptionsInfo.option.max_external_heat.displayableName=(Неофициально) Максимум тепла от внешних источников diff --git a/megamek/src/megamek/client/ui/swing/GameOptionsDialog.java b/megamek/src/megamek/client/ui/swing/GameOptionsDialog.java index 752ecf4f400..d77c0f96f68 100644 --- a/megamek/src/megamek/client/ui/swing/GameOptionsDialog.java +++ b/megamek/src/megamek/client/ui/swing/GameOptionsDialog.java @@ -483,14 +483,7 @@ private void addOption(JPanel groupPanel, IOption option) { //Set to the maximum velocity if over option.setValue(CapitalMissileBayWeapon.CAPITAL_MISSILE_MAX_VELOCITY); } - } - // else if (option.getName().equals(OptionsConstants.RPG_BEGIN_SHUTDOWN)) { - // if ((options.getOption(OptionsConstants.RPG_MANUAL_SHUTDOWN)).booleanValue()) { - // optionComp.setEditable(editable); - // } else { - // optionComp.setEditable(false); - // } - // } + } else if (option.getName().equals(OptionsConstants.ADVANCED_ALTERNATE_MASC_ENHANCED)) { if ((options.getOption(OptionsConstants.ADVANCED_ALTERNATE_MASC)).booleanValue()) { optionComp.setEditable(editable); @@ -731,13 +724,6 @@ public void optionClicked(DialogOptionComponent clickedComp, IOption option, boo comp_i.resetToDefault(); } } - // if (option.getName().equals(OptionsConstants.RPG_MANUAL_SHUTDOWN)) { - // comps = optionComps.get(OptionsConstants.RPG_BEGIN_SHUTDOWN); - // for (DialogOptionComponent comp_i : comps) { - // comp_i.setEditable(state); - // comp_i.setSelected(false); - // } - // } if (option.getName().equals(OptionsConstants.ADVANCED_ALTERNATE_MASC)) { comps = optionComps.get(OptionsConstants.ADVANCED_ALTERNATE_MASC_ENHANCED); for (DialogOptionComponent comp_i : comps) { diff --git a/megamek/src/megamek/client/ui/swing/MovementDisplay.java b/megamek/src/megamek/client/ui/swing/MovementDisplay.java index 43946cba612..eb92d8bf819 100644 --- a/megamek/src/megamek/client/ui/swing/MovementDisplay.java +++ b/megamek/src/megamek/client/ui/swing/MovementDisplay.java @@ -288,7 +288,6 @@ public static MoveCommand[] values(int f, GameOptions opts, boolean forwardIni) boolean vtolStrafe = false; if (opts != null) { - // manualShutdown = opts.booleanOption(OptionsConstants.RPG_MANUAL_SHUTDOWN); selfDestruct = opts.booleanOption(OptionsConstants.ADVANCED_TACOPS_SELF_DESTRUCT); advVehicle = opts.booleanOption(OptionsConstants.ADVGRNDMOV_VEHICLE_ADVANCED_MANEUVERS); vtolStrafe = opts.booleanOption(OptionsConstants.ADVCOMBAT_VTOL_STRAFING); @@ -2616,11 +2615,6 @@ private void updateShutdownButton() { return; } - // if (!clientgui.getClient().getGame().getOptions() - // .booleanOption(OptionsConstants.RPG_MANUAL_SHUTDOWN)) { - // return; - // } - if (ce instanceof Infantry) { return; } @@ -2635,11 +2629,6 @@ private void updateStartupButton() { return; } - // if (!clientgui.getClient().getGame().getOptions() - // .booleanOption(OptionsConstants.RPG_MANUAL_SHUTDOWN)) { - // return; - // } - if (ce instanceof Infantry) { return; } diff --git a/megamek/src/megamek/common/options/GameOptions.java b/megamek/src/megamek/common/options/GameOptions.java index b9f520fa4de..56875bb6c21 100755 --- a/megamek/src/megamek/common/options/GameOptions.java +++ b/megamek/src/megamek/common/options/GameOptions.java @@ -303,7 +303,6 @@ public synchronized void initialize() { addOption(rpg, OptionsConstants.RPG_ARTILLERY_SKILL, false); addOption(rpg, OptionsConstants.RPG_TOUGHNESS, false); addOption(rpg, OptionsConstants.RPG_CONDITIONAL_EJECTION, false); - // addOption(rpg, OptionsConstants.RPG_MANUAL_SHUTDOWN, false); addOption(rpg, OptionsConstants.RPG_BEGIN_SHUTDOWN, false); } diff --git a/megamek/src/megamek/common/options/OptionsConstants.java b/megamek/src/megamek/common/options/OptionsConstants.java index 7af04f0b056..6850acaf3fb 100644 --- a/megamek/src/megamek/common/options/OptionsConstants.java +++ b/megamek/src/megamek/common/options/OptionsConstants.java @@ -526,7 +526,6 @@ public class OptionsConstants { public static final String RPG_ARTILLERY_SKILL = "artillery_skill"; public static final String RPG_TOUGHNESS = "toughness"; public static final String RPG_CONDITIONAL_EJECTION = "conditional_ejection"; - // public static final String RPG_MANUAL_SHUTDOWN = "manual_shutdown"; public static final String RPG_BEGIN_SHUTDOWN = "begin_shutdown"; private OptionsConstants() { } diff --git a/megamek/src/megamek/server/ServerHelper.java b/megamek/src/megamek/server/ServerHelper.java index afcb6d3ac5f..45d8d59640b 100644 --- a/megamek/src/megamek/server/ServerHelper.java +++ b/megamek/src/megamek/server/ServerHelper.java @@ -279,11 +279,7 @@ public static void resolveAeroHeat(Game game, Entity entity, Vector vPha int roll = Compute.d6(2); if (roll >= 8) { entity.setTaserShutdownRounds(0); - if (!( - // game.getOptions().booleanOption( - // OptionsConstants.RPG_MANUAL_SHUTDOWN) - // && - entity.isManualShutdown())) { + if (!(entity.isManualShutdown())) { entity.setShutDown(false); } entity.setBATaserShutdown(false);