From 5a6a738d3822a3d36c24a7a1e136682a3d8594e1 Mon Sep 17 00:00:00 2001 From: cwspain Date: Sat, 18 Nov 2023 11:09:38 -0600 Subject: [PATCH] Don't require fuel for fixed wing with prop mod and fusion, fission, or solar engine. --- .../megamek/client/ui/swing/MovementDisplay.java | 2 +- megamek/src/megamek/common/FixedWingSupport.java | 14 ++++++++++---- megamek/src/megamek/common/IAero.java | 4 ++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/megamek/src/megamek/client/ui/swing/MovementDisplay.java b/megamek/src/megamek/client/ui/swing/MovementDisplay.java index 39ab6c74e5..e4c3243c25 100644 --- a/megamek/src/megamek/client/ui/swing/MovementDisplay.java +++ b/megamek/src/megamek/client/ui/swing/MovementDisplay.java @@ -4110,7 +4110,7 @@ private void checkFuel() { } IAero aero = (IAero) ce; - if ((aero.getCurrentFuel() < 1) && !(ce.hasEngine() && ce.getEngine().isSolar())) { + if ((aero.getCurrentFuel() < 1) && aero.requiresFuel()) { disableButtons(); butDone.setEnabled(true); getBtn(MoveCommand.MOVE_NEXT).setEnabled(true); diff --git a/megamek/src/megamek/common/FixedWingSupport.java b/megamek/src/megamek/common/FixedWingSupport.java index 10dec9c75a..fa01afb6c8 100644 --- a/megamek/src/megamek/common/FixedWingSupport.java +++ b/megamek/src/megamek/common/FixedWingSupport.java @@ -135,12 +135,11 @@ public boolean hasPropChassisMod() { * @return The mass of each point of fuel in kg. */ public int kgPerFuelPoint() { + if (!requiresFuel()) { + return 0; + } int kg = KG_PER_FUEL_POINT[getWeightClass() - EntityWeightClass.WEIGHT_SMALL_SUPPORT][getEngineTechRating()]; if (hasPropChassisMod() || getMovementMode().equals(EntityMovementMode.AIRSHIP)) { - if (getEngine().isFusion() || (getEngine().getEngineType() == Engine.FISSION) - || (getEngine().getEngineType() == Engine.SOLAR)) { - return 0; - } kg = (int) Math.ceil(kg * 0.75); } return kg; @@ -157,6 +156,13 @@ public double getFuelPointsPerTon() { return 1000.0 / kgPerFuelPoint(); } + @Override + public boolean requiresFuel() { + return !(((hasPropChassisMod() || getMovementMode().isAirship())) + && hasEngine() && (getEngine().isFusion() || (getEngine().getEngineType() == Engine.FISSION) + || (getEngine().getEngineType() == Engine.SOLAR))); + } + private static final TechAdvancement TA_FIXED_WING_SUPPORT = new TechAdvancement(TECH_BASE_ALL) .setAdvancement(DATE_PS, DATE_PS, DATE_PS) .setTechRating(RATING_B).setAvailability(RATING_C, RATING_D, RATING_C, RATING_C) diff --git a/megamek/src/megamek/common/IAero.java b/megamek/src/megamek/common/IAero.java index 13179ec299..baf5da7717 100644 --- a/megamek/src/megamek/common/IAero.java +++ b/megamek/src/megamek/common/IAero.java @@ -146,6 +146,10 @@ default int getClusterMods() { double getFuelPointsPerTon(); + default boolean requiresFuel() { + return true; + } + // Capital fighters int getCapArmor();