diff --git a/megamek/i18n/megamek/common/options/messages.properties b/megamek/i18n/megamek/common/options/messages.properties index 764bf2adc72..bf006849810 100644 --- a/megamek/i18n/megamek/common/options/messages.properties +++ b/megamek/i18n/megamek/common/options/messages.properties @@ -442,7 +442,7 @@ GameOptionsInfo.option.stratops_bearings_only_velocity.description=Improves the GameOptionsInfo.option.stratops_waypoint_launch.displayableName=StratOps Capital Missile Waypoint Launch GameOptionsInfo.option.stratops_waypoint_launch.description=Alternate mode for capital missiles per SO pg 102. Greatly increases firing arc for capital missiles but with a +1 TH penalty GameOptionsInfo.option.stratops_advanced_sensors.displayableName=StratOps Advanced Sensors -GameOptionsInfo.option.stratops_advanced_sensors.description=Advanced sensor rules per SO pg 117. Works correctly only if Double Blind and TacOps sensors rules are also turned on +GameOptionsInfo.option.stratops_advanced_sensors.description=Advanced sensor suite rules for aerospace combat in space. per SO 4th ed, pg 105. Works correctly only if Double Blind and TacOps sensors rules are also turned on GameOptionsInfo.option.variable_damage_thresh.displayableName=StratOps variable damage thresholds GameOptionsInfo.option.variable_damage_thresh.description=Damage threshold for critical hits depends depends on current armor levels rather than initial armor levels GameOptionsInfo.option.at2_nukes.displayableName=Allow nuclear weapons diff --git a/megamek/src/megamek/client/ui/swing/boardview/BoardView.java b/megamek/src/megamek/client/ui/swing/boardview/BoardView.java index bb29038d1c7..0fd90e28524 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/BoardView.java +++ b/megamek/src/megamek/client/ui/swing/boardview/BoardView.java @@ -6433,9 +6433,10 @@ public void setSensorRange(Entity entity, Coords c) { int maxSensorRange = 0; int minAirSensorRange = 0; int maxAirSensorRange = 0; + GameOptions gameOptions = game.getOptions(); - if (game.getOptions().booleanOption(OptionsConstants.ADVANCED_TACOPS_SENSORS) - || game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_STRATOPS_ADVANCED_SENSORS)) { + if (gameOptions.booleanOption(OptionsConstants.ADVANCED_TACOPS_SENSORS) + || (gameOptions.booleanOption(OptionsConstants.ADVAERORULES_STRATOPS_ADVANCED_SENSORS)) && entity.isSpaceborne()) { Compute.SensorRangeHelper srh = Compute.getSensorRanges(entity.getGame(), entity); if (srh != null) { diff --git a/megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java b/megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java index 75266defd8b..0835acca5f6 100644 --- a/megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java +++ b/megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java @@ -20,6 +20,7 @@ import megamek.common.*; import megamek.common.alphaStrike.AlphaStrikeElement; import megamek.common.annotations.Nullable; +import megamek.common.options.GameOptions; import megamek.common.options.OptionsConstants; import megamek.common.preference.PreferenceManager; import megamek.common.templates.TROView; @@ -1038,6 +1039,7 @@ private static String getDamageLevelDesc(Entity entity) { private static StringBuilder inGameValues(Entity entity, Player localPlayer, boolean inGameValue, boolean showBV, boolean showSensors, boolean showSeenBy) { Game game = entity.getGame(); + GameOptions gameOptions = game.getOptions(); boolean isGunEmplacement = entity instanceof GunEmplacement; String result = ""; @@ -1049,7 +1051,7 @@ private static StringBuilder inGameValues(Entity entity, Player localPlayer, boo // BV Info // Hidden for invisible units when in double blind and hide enemy bv is selected // Also not shown in the lobby as BV is shown there outside the tooltip - boolean showEnemyBV = !(game.getOptions().booleanOption(OptionsConstants.ADVANCED_SUPPRESS_DB_BV) && game.getOptions().booleanOption(OptionsConstants.ADVANCED_DOUBLE_BLIND)); + boolean showEnemyBV = !(gameOptions.booleanOption(OptionsConstants.ADVANCED_SUPPRESS_DB_BV) && gameOptions.booleanOption(OptionsConstants.ADVANCED_DOUBLE_BLIND)); boolean isVisible = EntityVisibilityUtils.trackThisEntitiesVisibilityInfo(localPlayer, entity); if (isVisible || showEnemyBV) { @@ -1224,9 +1226,9 @@ private static StringBuilder inGameValues(Entity entity, Player localPlayer, boo if (showSeenBy) { // If Double Blind, add information about who sees this Entity - if (game.getOptions().booleanOption(OptionsConstants.ADVANCED_DOUBLE_BLIND)) { + if (gameOptions.booleanOption(OptionsConstants.ADVANCED_DOUBLE_BLIND)) { StringBuffer tempList = new StringBuffer(); - boolean teamVision = game.getOptions().booleanOption(OptionsConstants.ADVANCED_TEAM_VISION); + boolean teamVision = gameOptions.booleanOption(OptionsConstants.ADVANCED_TEAM_VISION); int seenByResolution = GUIP.getUnitToolTipSeenByResolution(); String tmpStr = ""; @@ -1269,7 +1271,8 @@ private static StringBuilder inGameValues(Entity entity, Player localPlayer, boo if (showSensors) { // If sensors, display what sensors this unit is using - if (game.getOptions().booleanOption(OptionsConstants.ADVANCED_TACOPS_SENSORS) || game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_STRATOPS_ADVANCED_SENSORS)) { + if (gameOptions.booleanOption(OptionsConstants.ADVANCED_TACOPS_SENSORS) + || (gameOptions.booleanOption(OptionsConstants.ADVAERORULES_STRATOPS_ADVANCED_SENSORS)) && entity.isSpaceborne()) { String visualRange = Compute.getMaxVisualRange(entity, false) + ""; if (game.getPlanetaryConditions().isIlluminationEffective()) { visualRange += " (" + Compute.getMaxVisualRange(entity, true) + ")"; diff --git a/megamek/src/megamek/client/ui/swing/unitDisplay/ExtraPanel.java b/megamek/src/megamek/client/ui/swing/unitDisplay/ExtraPanel.java index 5e89e5f4de2..d0aab2003ab 100644 --- a/megamek/src/megamek/client/ui/swing/unitDisplay/ExtraPanel.java +++ b/megamek/src/megamek/client/ui/swing/unitDisplay/ExtraPanel.java @@ -12,6 +12,7 @@ import megamek.client.ui.swing.tooltip.UnitToolTip; import megamek.common.*; import megamek.common.enums.GamePhase; +import megamek.common.options.GameOptions; import megamek.common.options.OptionsConstants; import megamek.common.preference.IPreferenceChangeListener; import megamek.common.preference.PreferenceChangeEvent; @@ -333,13 +334,15 @@ public void displayMech(Entity en) { chSensors.setEnabled(true); dontChange = false; } + // Walk through the list of teams. There // can't be more teams than players. StringBuffer buff; if (clientgui != null) { - Enumeration loop = clientgui.getClient().getGame().getPlayers(); - while (loop.hasMoreElements()) { - Player player = loop.nextElement(); + Game game = clientgui.getClient().getGame(); + GameOptions gameOptions = game.getOptions(); + + for (Player player : game.getPlayersList()) { int team = player.getTeam(); if (en.isNarcedBy(team) && !player.isObserver()) { buff = new StringBuffer(Messages.getString("MechDisplay.NARCedBy")); @@ -467,81 +470,84 @@ public void displayMech(Entity en) { if (narcList.getModel().getSize() == 0) { ((DefaultListModel) narcList.getModel()).addElement(" "); } - } - // transport values - String unused = en.getUnusedString(); - if (unused.isBlank()) { - unused = Messages.getString("MechDisplay.None"); - } - unusedR.setText(unused); - carrysR.setText(null); - // boolean hasText = false; - for (Entity other : en.getLoadedUnits()) { - carrysR.append(other.getShortName()); - carrysR.append("\n"); - } + // transport values + String unused = en.getUnusedString(); + if (unused.isBlank()) { + unused = Messages.getString("MechDisplay.None"); + } + unusedR.setText(unused); + carrysR.setText(null); + // boolean hasText = false; + for (Entity other : en.getLoadedUnits()) { + carrysR.append(other.getShortName()); + carrysR.append("\n"); + } - // Show club(s). - for (Mounted club : en.getClubs()) { - carrysR.append(club.getName()); - carrysR.append("\n"); - } + // Show club(s). + for (Mounted club : en.getClubs()) { + carrysR.append(club.getName()); + carrysR.append("\n"); + } - // Show searchlight - if (en.hasSearchlight()) { - if (en.isUsingSearchlight()) { - carrysR.append(Messages.getString("MechDisplay.SearchlightOn")); - } else { - carrysR.append(Messages.getString("MechDisplay.SearchlightOff")); + // Show searchlight + if (en.hasSearchlight()) { + if (en.isUsingSearchlight()) { + carrysR.append(Messages.getString("MechDisplay.SearchlightOn")); + } else { + carrysR.append(Messages.getString("MechDisplay.SearchlightOff")); + } } - } - // Show Heat Effects, but only for Mechs. - heatR.setText(""); - sinksR.setText(""); + // Show Heat Effects, but only for Mechs. + heatR.setText(""); + sinksR.setText(""); - if (en instanceof Mech) { - Mech m = (Mech) en; + if (en instanceof Mech) { + Mech m = (Mech) en; - sinks2B.setEnabled(!dontChange); - sinks = m.getActiveSinksNextRound(); - if (m.hasDoubleHeatSinks()) { - sinksR.append(Messages.getString("MechDisplay.activeSinksTextDouble", - sinks, sinks * 2)); - } else { - sinksR.append(Messages.getString("MechDisplay.activeSinksTextSingle", sinks)); - } + sinks2B.setEnabled(!dontChange); + sinks = m.getActiveSinksNextRound(); + if (m.hasDoubleHeatSinks()) { + sinksR.append(Messages.getString("MechDisplay.activeSinksTextDouble", + sinks, sinks * 2)); + } else { + sinksR.append(Messages.getString("MechDisplay.activeSinksTextSingle", sinks)); + } - boolean hasTSM = false; - boolean mtHeat = false; - if (((Mech) en).hasTSM(false)) { - hasTSM = true; - } + boolean hasTSM = false; + boolean mtHeat = false; + if (((Mech) en).hasTSM(false)) { + hasTSM = true; + } - if ((clientgui != null) - && clientgui.getClient().getGame().getOptions() - .booleanOption(OptionsConstants.ADVCOMBAT_TACOPS_HEAT)) { - mtHeat = true; + if (gameOptions.booleanOption(OptionsConstants.ADVCOMBAT_TACOPS_HEAT)) { + mtHeat = true; + } + heatR.setForeground(GUIPreferences.getInstance().getColorForHeat(en.heat)); + heatR.append(HeatEffects.getHeatEffects(en.heat, mtHeat, hasTSM)); + } else { + // Non-Mechs cannot configure their heat sinks + sinks2B.setEnabled(false); } - heatR.setForeground(GUIPreferences.getInstance().getColorForHeat(en.heat)); - heatR.append(HeatEffects.getHeatEffects(en.heat, mtHeat, hasTSM)); - } else { - // Non-Mechs cannot configure their heat sinks - sinks2B.setEnabled(false); - } - dumpBombs.setEnabled(false); + dumpBombs.setEnabled(false); - refreshSensorChoices(en); + refreshSensorChoices(en); - if (null != en.getActiveSensor()) { - String tmpStr = Messages.getString("MechDisplay.CurrentSensors") + " " + UnitToolTip.getSensorDesc(en); - tmpStr = String.format("
%s
", 250, tmpStr); - curSensorsL.setText(tmpStr); - } else { - curSensorsL.setText((Messages.getString("MechDisplay.CurrentSensors")).concat(" ")); + if (null != en.getActiveSensor()) { + String sensorDesc = ""; + if (gameOptions.booleanOption(OptionsConstants.ADVANCED_TACOPS_SENSORS) + || (gameOptions.booleanOption(OptionsConstants.ADVAERORULES_STRATOPS_ADVANCED_SENSORS)) && en.isSpaceborne()) { + sensorDesc = UnitToolTip.getSensorDesc(en); + } + String tmpStr = Messages.getString("MechDisplay.CurrentSensors") + " " + sensorDesc; + tmpStr = String.format("
%s
", 250, tmpStr); + curSensorsL.setText(tmpStr); + } else { + curSensorsL.setText((Messages.getString("MechDisplay.CurrentSensors")).concat(" ")); + } } if (en.getLastTarget() != Entity.NONE) {