Skip to content

Commit

Permalink
Merge pull request #4626 from SJuliez/spot_welder_salvage_arm
Browse files Browse the repository at this point in the history
TestMech errata update
  • Loading branch information
SJuliez authored Jul 16, 2023
2 parents 0ef6553 + 21c94a9 commit 808d488
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions megamek/src/megamek/common/verifier/TestMech.java
Original file line number Diff line number Diff line change
Expand Up @@ -936,13 +936,28 @@ public boolean hasIllegalEquipmentCombinations(StringBuffer buff) {
illegal = true;
buff.append("Mech can only mount ").append(misc.getName())
.append(" in arm with no lower arm actuator.\n");
} else if (requiresHandActuator(misc) && !mech.hasSystem(Mech.ACTUATOR_HAND, m.getLocation())) {
} else if (requiresHandActuator(misc) && (m.getLocation() != Entity.LOC_NONE) && !mech.hasSystem(Mech.ACTUATOR_HAND, m.getLocation())) {
illegal = true;
buff.append("Mech requires a hand actuator in the arm that mounts ").append(misc.getName()).append("\n");
} else if (requiresLowerArm(misc) && !mech.hasSystem(Mech.ACTUATOR_LOWER_ARM, m.getLocation())) {
} else if (requiresLowerArm(misc) && (m.getLocation() != Entity.LOC_NONE) && !mech.hasSystem(Mech.ACTUATOR_LOWER_ARM, m.getLocation())) {
illegal = true;
buff.append("Mech requires a lower arm actuator in the arm that mounts ").append(misc.getName()).append("\n");
}
if (replacesHandActuator(misc) && (m.getLocation() != Entity.LOC_NONE)) {
String errorMsg = "Can only mount a single equipment item in the "
+ mech.getLocationName(m.getLocation())
+ " that replaces the hand actuator\n";
// This error message would appear once for each offending equipment; instead, add it only once
if (!buff.toString().contains(errorMsg)) {
int miscId = mech.getEquipmentNum(m);
if (mech.getMisc().stream().filter(otherMisc -> mech.getEquipmentNum(otherMisc) != miscId)
.filter(otherMisc -> otherMisc.getLocation() == m.getLocation())
.anyMatch(otherMisc -> replacesHandActuator((MiscType) otherMisc.getType()))) {
illegal = true;
buff.append(errorMsg);
}
}
}
}
if (misc.hasFlag(MiscType.F_HEAD_TURRET)
&& isCockpitLocation(Mech.LOC_HEAD)) {
Expand Down

0 comments on commit 808d488

Please sign in to comment.