From 8af367120e2047d25fdcc30c470b90dbad839caf Mon Sep 17 00:00:00 2001 From: sleet01 Date: Fri, 2 Aug 2024 23:54:18 -0700 Subject: [PATCH] Add unofficial toggle for dropship uncontrolled crash destruction and clean up code --- megamek/i18n/megamek/common/options/messages.properties | 2 ++ megamek/src/megamek/common/options/GameOptions.java | 1 + megamek/src/megamek/common/options/OptionsConstants.java | 1 + megamek/src/megamek/server/GameManager.java | 5 ++--- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/megamek/i18n/megamek/common/options/messages.properties b/megamek/i18n/megamek/common/options/messages.properties index 837dc6e4052..2e677568426 100644 --- a/megamek/i18n/megamek/common/options/messages.properties +++ b/megamek/i18n/megamek/common/options/messages.properties @@ -485,6 +485,8 @@ GameOptionsInfo.option.cargo_bay_damage.displayableName=(Unofficial) Damage Carg GameOptionsInfo.option.cargo_bay_damage.description= If a Cargo critical hit is taken, the cargo/transport bay itself suffers damage in addition to the cargo/units inside. GameOptionsInfo.option.aero_artillery_munitions.displayableName=(Unofficial) DropShips can use alternate artillery munitions GameOptionsInfo.option.aero_artillery_munitions.description=If checked, DropShips mounting artillery weapons can load and use alternate munitions +GameOptionsInfo.option.crashed_dropships_survive.displayableName=(Unofficial) Uncontrolled Crashing DropShips can survive +GameOptionsInfo.option.crashed_dropships_survive.description=If checked, DropShips (and larger) that crash while out of control are not instantly destroyed. GameOptionsInfo.option.expanded_kf_drive_damage.displayableName=(Unofficial) Damage individual K-F Drive components on K-F Drive Critical Hit GameOptionsInfo.option.expanded_kf_drive_damage.description=If a K-F Drive critical hit is taken, a random component is hit (per BattleSpace rules). diff --git a/megamek/src/megamek/common/options/GameOptions.java b/megamek/src/megamek/common/options/GameOptions.java index abf399a2788..ddbd9563a98 100755 --- a/megamek/src/megamek/common/options/GameOptions.java +++ b/megamek/src/megamek/common/options/GameOptions.java @@ -267,6 +267,7 @@ public synchronized void initialize() { addOption(advAeroRules, OptionsConstants.ADVAERORULES_ALLOW_LARGE_SQUADRONS, false); addOption(advAeroRules, OptionsConstants.ADVAERORULES_SINGLE_NO_CAP, false); addOption(advAeroRules, OptionsConstants.ADVAERORULES_AERO_ARTILLERY_MUNITIONS, false); + addOption(advAeroRules, OptionsConstants.ADVAERORULES_CRASHED_DROPSHIPS_SURVIVE, false); addOption(advAeroRules, OptionsConstants.ADVAERORULES_EXPANDED_KF_DRIVE_DAMAGE, false); IBasicOptionGroup initiative = addGroup("initiative"); diff --git a/megamek/src/megamek/common/options/OptionsConstants.java b/megamek/src/megamek/common/options/OptionsConstants.java index 9a65c56b4e8..973eaba6607 100644 --- a/megamek/src/megamek/common/options/OptionsConstants.java +++ b/megamek/src/megamek/common/options/OptionsConstants.java @@ -499,6 +499,7 @@ public class OptionsConstants { public static final String ADVAERORULES_ALLOW_LARGE_SQUADRONS = "allow_large_squadrons"; public static final String ADVAERORULES_SINGLE_NO_CAP = "single_no_cap"; public static final String ADVAERORULES_AERO_ARTILLERY_MUNITIONS = "aero_artillery_munitions"; + public static final String ADVAERORULES_CRASHED_DROPSHIPS_SURVIVE = "crashed_dropships_survive"; public static final String ADVAERORULES_EXPANDED_KF_DRIVE_DAMAGE = "expanded_kf_drive_damage"; public static final String INIT_INF_MOVE_EVEN = "inf_move_even"; public static final String INIT_INF_DEPLOY_EVEN = "inf_deploy_even"; diff --git a/megamek/src/megamek/server/GameManager.java b/megamek/src/megamek/server/GameManager.java index 887209680e2..a4bcfd9a2e8 100644 --- a/megamek/src/megamek/server/GameManager.java +++ b/megamek/src/megamek/server/GameManager.java @@ -4936,7 +4936,6 @@ private Vector processCrash(Entity entity, int vel, Coords c) { crateredElevation = h.getLevel() - 2; } if (entity instanceof Dropship) { - Dropship ds = (Dropship) entity; for (int i = 0; i < 6; i++) { Coords adjCoords = c.translated(i); if (!game.getBoard().contains(adjCoords)) { @@ -5168,7 +5167,8 @@ private Vector processCrash(Entity entity, int vel, Coords c) { } } - if (destroyDropShip) { + if (destroyDropShip + && game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_CRASHED_DROPSHIPS_SURVIVE)) { // Out-of-control DropShip that crashes is automatically destroyed. r = new Report(9708, Report.PUBLIC); r.indent(); @@ -18645,7 +18645,6 @@ else if ((entity.heat >= 14) && !entity.isShutDown()) { if (entity.getCrew().hasActiveTechOfficer()) { rollValue += 2; String rollCalc = rollValue + " [" + diceRoll.getIntValue() + " + 2]"; - ; r.addDataWithTooltip(rollCalc, diceRoll.getReport()); } else { r.add(diceRoll);