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

VTOL infantry fixes #4916

Merged
merged 4 commits into from
Nov 28, 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
4 changes: 3 additions & 1 deletion megamek/src/megamek/client/ui/swing/MovementDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,9 @@ private void updateButtons() {

setWalkEnabled(!ce.isImmobile() && ((ce.getWalkMP() > 0) || (ce.getRunMP() > 0))
&& !ce.isStuck());
setJumpEnabled(!isAero && !ce.isImmobile() && !ce.isProne() && (ce.getJumpMP() > 0)
setJumpEnabled(!isAero && !ce.isImmobile() && !ce.isProne()
// Conventional infantry also uses jump MP for VTOL and UMU MP
&& ((ce.getJumpMP() > 0) && (!ce.isConventionalInfantry() || ce.getMovementMode().isJumpInfantry()))
&& !(ce.isStuck() && !ce.canUnstickByJumping()));
setSwimEnabled(!isAero && !ce.isImmobile() && (ce.getActiveUMUCount() > 0)
&& ce.isUnderwater());
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/Infantry.java
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@ public void setMotorizedScuba() {

@Override
public String getMovementModeAsString() {
if (!hasETypeFlag(Entity.ETYPE_BATTLEARMOR)) {
if (isConventionalInfantry() && (mount == null)) {
if (getMovementMode().isVTOL()) {
return hasMicrolite() ? "Microlite" : "Microcopter";
}
Expand Down
3 changes: 2 additions & 1 deletion megamek/src/megamek/common/MoveStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -2970,7 +2970,8 @@ protected void calcMovementCostFor(Game game, MoveStep prevStep, CachedEntitySta
// 0 MP infantry units can move 1 hex
if (isInfantry
&& (cachedEntityState.getWalkMP() == 0)
&& (moveMode != EntityMovementMode.SUBMARINE)
&& !moveMode.isSubmarine()
&& !moveMode.isVTOL()
&& getEntity().getPosition().equals(prev)
&& (getEntity().getPosition().distance(getPosition()) == 1)
&& (!isJumping())) {
Expand Down
12 changes: 9 additions & 3 deletions megamek/src/megamek/common/pathfinder/InfantryPathFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,15 @@ private List<MovePath> generateChildren(MovePath startingPath) {
// we've visited this hex already
// we are walking and at or past our movement mp
// we are jumping and at or past our jump mp
if (visitedCoords.contains(startingPath.getFinalCoords()) ||
(!startingPath.isJumping() && (startingPath.getMpUsed() >= startingPath.getEntity().getRunMP()))||
(startingPath.isJumping() && (startingPath.getMpUsed() >= startingPath.getEntity().getJumpMP()))) {
int mp;
if (startingPath.isJumping() || startingPath.getEntity().getMovementMode().isVTOL()) {
mp = startingPath.getEntity().getJumpMP();
} else if (startingPath.getEntity().hasUMU()) {
mp = startingPath.getEntity().getActiveUMUCount();
} else {
mp = startingPath.getEntity().getRunMP();
}
if (visitedCoords.contains(startingPath.getFinalCoords()) || (startingPath.getMpUsed() >= mp)) {
return retval;
}

Expand Down