Skip to content

Commit

Permalink
Merge pull request #5887 from NickAragua/torso_twist_fix
Browse files Browse the repository at this point in the history
Torso twist fix
  • Loading branch information
IllianiCBT authored Aug 12, 2024
2 parents 7fd80cd + bcc7652 commit 633965d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ private void selectEntity(int en) {
clientgui.getBoardView().centerOnHex(ce().getPosition());
}

setTwistEnabled(phase.isOffboard() && ce().canChangeSecondaryFacing() && ce().getCrew().isActive());
setTwistEnabled(ce().canChangeSecondaryFacing() && ce().getCrew().isActive());
setFlipArmsEnabled(ce().canFlipArms() && ce().getCrew().isActive());
updateSearchlight();

Expand Down Expand Up @@ -965,6 +965,7 @@ void torsoTwist(Coords twistTarget) {
clearAttacks();
addAttack(new TorsoTwistAction(currentEntity, direction));
ce().setSecondaryFacing(direction);
clientgui.updateFiringArc(ce());
refreshAll();
}
}
Expand Down Expand Up @@ -1020,8 +1021,8 @@ public void hexMoused(BoardViewEvent b) {
}

if (b.getType() == BoardViewEvent.BOARD_HEX_DRAGGED) {
if (phase.isOffboard() && (shiftheld || twisting)) {
if (ce() != null) {
if (shiftheld || twisting) {
if ((ce() != null) && !ce().getAlreadyTwisted()) {
updateFlipArms(false);
torsoTwist(b.getCoords());
}
Expand All @@ -1046,7 +1047,7 @@ public void hexSelected(BoardViewEvent b) {

if (client.isMyTurn() && (b.getCoords() != null)
&& (ce() != null) && !b.getCoords().equals(ce().getPosition())) {
if (shiftheld && phase.isOffboard()) {
if (shiftheld && !ce().getAlreadyTwisted()) {
updateFlipArms(false);
torsoTwist(b.getCoords());
} else if (phase.isTargeting()) {
Expand Down
5 changes: 2 additions & 3 deletions megamek/src/megamek/common/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1900,7 +1900,7 @@ public void setArmsFlipped(boolean armsFlipped) {
if (getAlreadyTwisted()) {
return;
}
if (phase.isOffboard() || phase.isFiring()) {
if (phase.isTargeting() || phase.isOffboard() || phase.isFiring()) {
// Only Offboard and Firing phases could conceivably have later phases with twisting
setAlreadyTwisted(true);
}
Expand Down Expand Up @@ -2683,8 +2683,7 @@ public void setSecondaryFacing(int sec_facing, boolean fireEvent) {
if (getAlreadyTwisted()) {
return;
}
if (phase.isOffboard() || phase.isFiring()) {
// Only Offboard and Firing phases could conceivably have later phases with twisting
if (phase.isTargeting() || phase.isOffboard() || phase.isFiring()) {
setAlreadyTwisted(true);
}
}
Expand Down

0 comments on commit 633965d

Please sign in to comment.