Skip to content

Commit

Permalink
Merge pull request #4894 from MegaMek/jumpship_jets
Browse files Browse the repository at this point in the history
JumpShip movement fix
  • Loading branch information
neoancient authored Nov 17, 2023
2 parents 91828f6 + be62fde commit 32eaa23
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions megamek/src/megamek/client/ui/swing/MovementDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,13 @@ private synchronized void updateSpeedButtons() {
setAccNEnabled(false);
}

// Disable accn/decn if a jumpship has changed facing
if ((a instanceof Jumpship) && ((Jumpship) a).hasStationKeepingDrive()
&& (cmd.contains(MoveStepType.TURN_LEFT) || cmd.contains(MoveStepType.TURN_RIGHT))) {
setDecNEnabled(false);
setAccNEnabled(false);
}

// if in atmosphere, limit acceleration to 2x safe thrust
if (!clientgui.getClient().getGame().getBoard().inSpace()
&& (vel == (2 * ce.getWalkMP()))) {
Expand Down
2 changes: 2 additions & 0 deletions megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java
Original file line number Diff line number Diff line change
Expand Up @@ -1611,6 +1611,8 @@ private static StringBuilder getMovement(Entity entity) {
if (jumpMPModified > 0) {
sMove += "/" + jumpMPModified;
}
} else if ((entity instanceof Jumpship) && ((Jumpship) entity).hasStationKeepingDrive()) {
sMove += String.format("%s%1.1f", DOT_SPACER, ((Jumpship) entity).getAccumulatedThrust());
}

sMove += DOT_SPACER;
Expand Down
7 changes: 7 additions & 0 deletions megamek/src/megamek/common/MoveStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,13 @@ private void compileIllegal(final Game game, final Entity entity,
&& (velocity != 0) && (getNTurns() > 1)) {
return;
}

// Jumpships cannot change velocity and use attitude jets in the same turn.
if ((a instanceof Jumpship) && ((Jumpship) a).hasStationKeepingDrive()
&& (prev.getMovementType(false) == EntityMovementType.MOVE_OVER_THRUST)
&& ((type == MoveStepType.TURN_LEFT) || (type == MoveStepType.TURN_RIGHT))) {
return;
}
}

// atmosphere has its own rules about turning
Expand Down

0 comments on commit 32eaa23

Please sign in to comment.