From ef8b22458d99b5eab995493d3f46ce1d0ba355f7 Mon Sep 17 00:00:00 2001 From: DM0000 <98051919+DM0000@users.noreply.github.com> Date: Thu, 3 Oct 2024 20:58:20 -0700 Subject: [PATCH] added check for sprint and TSM in isEligibleForFiring --- megamek/src/megamek/common/Entity.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/megamek/src/megamek/common/Entity.java b/megamek/src/megamek/common/Entity.java index bbff056fd0..469a6c4aa4 100644 --- a/megamek/src/megamek/common/Entity.java +++ b/megamek/src/megamek/common/Entity.java @@ -84,6 +84,8 @@ import megamek.logging.MMLogger; import megamek.utilities.xml.MMXMLUtility; +import static megamek.common.EquipmentTypeLookup.TSM; + /** * Entity is a master class for basically anything on the board except terrain. */ @@ -9929,6 +9931,14 @@ public boolean isEligibleForFiring() { return false; } + if (moved == EntityMovementType.MOVE_SPRINT + || moved == EntityMovementType.MOVE_VTOL_SPRINT) { + if(isMek()) { + return getMisc().stream().anyMatch(m -> m.getType().hasFlag(MiscType.F_TSM)); + } + return false; + } + // if you're offboard, no shooting if (isOffBoard() || isAssaultDropInProgress()) { return false;