From 8f0496b1f66188d65e07563f5e1f5504bf56c337 Mon Sep 17 00:00:00 2001 From: psikomonkie <189469115+psikomonkie@users.noreply.github.com> Date: Sun, 22 Dec 2024 11:28:22 -0500 Subject: [PATCH] Dirt Road - Landing Fixes --- megamek/src/megamek/common/IAero.java | 10 +++++++++- megamek/src/megamek/common/Terrains.java | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/megamek/src/megamek/common/IAero.java b/megamek/src/megamek/common/IAero.java index 5042a547d30..2e731def1ec 100644 --- a/megamek/src/megamek/common/IAero.java +++ b/megamek/src/megamek/common/IAero.java @@ -515,7 +515,15 @@ default PilotingRollData checkLanding(EntityMovementType moveType, int velocity, boolean clear = false; for (Coords pos : landingPositions) { Hex hex = ((Entity) this).getGame().getBoard().getHex(pos); - if ((hex == null) || hex.hasPavementOrRoad()) { + if (hex == null) { + continue; + } + if (hex.hasPavementOrRoad()) { + if (hex.containsTerrain(Terrains.ROAD)) { //Check for dirt or gravel road, they're harder to land on + if (Terrains.landingModifier(Terrains.ROAD, hex.terrainLevel(Terrains.ROAD)) > 0) { + terrains.add(List.of(Terrains.ROAD, hex.terrainLevel(Terrains.ROAD))); + } + } continue; } if (hex.getBaseTerrainType() == 0) { diff --git a/megamek/src/megamek/common/Terrains.java b/megamek/src/megamek/common/Terrains.java index 7bd9a80ab2c..127db3a4db1 100644 --- a/megamek/src/megamek/common/Terrains.java +++ b/megamek/src/megamek/common/Terrains.java @@ -550,6 +550,15 @@ public static int landingModifier(int terrainType, int terrainLevel) { return 2; case BUILDING: return terrainLevel + 1; + case ROAD: + switch (terrainLevel) { + case ROAD_LVL_DIRT: + return 2; + case ROAD_LVL_GRAVEL: + return 1; + default: + return 0; + } case SNOW: return (terrainLevel == 2) ? 1 : 0; case ICE: