Skip to content

Commit

Permalink
Dirt Road - Landing Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
psikomonkie committed Dec 22, 2024
1 parent 76a6c50 commit 8f0496b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion megamek/src/megamek/common/IAero.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 9 additions & 0 deletions megamek/src/megamek/common/Terrains.java
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 8f0496b

Please sign in to comment.