Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JumpShip movement fix #4894

Merged
merged 3 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -2490,6 +2490,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 @@ -1600,6 +1600,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