Skip to content

Conversation

@HammerGS
Copy link
Member

@HammerGS HammerGS commented Jan 30, 2026

Summary

Adds core support loading and improvements to validating for three cockpit modification equipment types: DNI Cockpit Modification (IS, Advanced), Enhanced Imaging (EI) Interface (Clan, Experimental), and Damage Interrupt Circuit (IS, Experimental). Also adds game year validation support for equipment availability.

Requires: MegaMekLab PR Implement-DNI-EI-DIC-UI for full UI functionality.

Changes

  1. Add equipment definitions with correct tech levels (DNI=Advanced, DIC=Experimental)
  2. Add BLK file save/load for slotless (LOC_NONE) equipment across all unit types
  3. Fix Unit Viewer to display cockpit modifications for non-Mek units
  4. Add game year support in ITechManager.isLegal() for equipment availability
  5. Add game year support in TestEntity.hasIncorrectIntroYear() for validation
  6. Mark DNI and EI as retrofittable equipment (skipped in intro year validation per IO p.69)

Files Changed

  • MiscType.java - Tech level fixes for DNI and DIC
  • ITechManager.java - Game year support in isLegal()
  • TestEntity.java - Game year field and validation support
  • BLKFile.java - Slotless equipment save/load methods
  • BLK*File.java (10 files) - Load slotless equipment for each unit type
  • ReadoutUtils.java - Show cockpit mods in Unit Viewer
  • *TROView.java (4 files) - TRO display for cockpit mods
  • CockpitModificationTest.java - Unit tests for save/load
  • TestEntityGameYearValidationTest.java - Unit tests for game year validation

Testing

  • Unit Tests: 17 tests covering save/load and game year validation (all passing)
  • Manual Testing: Verified on Mek, Combat Vehicle, Conventional Fighter, Aerospace Fighter, Support Vehicle (Ground/VTOL), Battle Armor
    (IS/Clan)
  • Game Year Validation: Tested EI (intro 3040) and DNI (intro 3052) with game years before/after intro dates

@HammerGS HammerGS added AI Generated Fix AI-generated fix. Requires human testing and review before merging. Needs Player Testing PR lacks actual play testing. labels Jan 30, 2026
@HammerGS HammerGS requested a review from a team as a code owner January 30, 2026 22:53
Copilot AI review requested due to automatic review settings January 30, 2026 22:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for DNI Cockpit Modifications, EI Interface, and Damage Interrupt Circuit across save/load, validation, and unit readouts, and wires intro-date checks to game-year–based availability.

Changes:

  • Marks DNI and DIC with correct static tech levels and treats DNI/EI as retrofittable in intro-year validation logic.
  • Extends BLK save/load to persist slotless equipment (LOC_NONE) across multiple unit types, and updates viewer/TRO templates to show cockpit mods on non-‘Mek units.
  • Introduces explicit game-year handling in ITechManager.isLegal() and TestEntity.hasIncorrectIntroYear(), with new unit tests covering save/load and game-year validation.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
megamek/src/megamek/common/equipment/MiscType.java Sets static tech levels for DNI (Advanced) and DIC (Experimental) to match their intended rules levels.
megamek/src/megamek/common/interfaces/ITechManager.java Changes isLegal to use getGameYear() for intro/extinction checks and tech-era lookup, aligning legality with configured game year.
megamek/src/megamek/common/verifier/TestEntity.java Adds a gameYear field with getter/setter and updates hasIncorrectIntroYear to use either the explicit game year or Entity.getTechLevelYear(), and to skip both DNI and EI as retrofittable.
megamek/src/megamek/common/loaders/BLKFile.java Introduces BLK_SLOTLESS_EQUIPMENT tag plus loadSlotlessEquipment and updates getBlock to persist/load slotless equipment like cockpit mods.
megamek/src/megamek/common/loaders/BLKVTOLFile.java Calls loadSlotlessEquipment so VTOL BLKs restore slotless cockpit mods.
megamek/src/megamek/common/loaders/BLKTankFile.java Calls loadSlotlessEquipment so combat vehicle BLKs restore slotless cockpit mods.
megamek/src/megamek/common/loaders/BLKSupportVTOLFile.java Calls loadSlotlessEquipment to reload slotless mods on support VTOLs.
megamek/src/megamek/common/loaders/BLKSupportTankFile.java Calls loadSlotlessEquipment to reload slotless mods on support ground vehicles.
megamek/src/megamek/common/loaders/BLKLargeSupportTankFile.java Calls loadSlotlessEquipment for large support tank BLKs.
megamek/src/megamek/common/loaders/BLKFixedWingSupportFile.java Calls loadSlotlessEquipment for fixed-wing support aircraft BLKs.
megamek/src/megamek/common/loaders/BLKConvFighterFile.java Calls loadSlotlessEquipment for conventional fighter BLKs.
megamek/src/megamek/common/loaders/BLKBattleArmorFile.java Calls loadSlotlessEquipment for battle armor BLKs so slotless cockpit mods are reloaded.
megamek/src/megamek/common/loaders/BLKAeroSpaceFighterFile.java Calls loadSlotlessEquipment for aerospace fighter BLKs.
megamek/src/megamek/client/ui/entityreadout/ReadoutUtils.java Adjusts hideMisc to always show DNI, EI, and DIC even when mounted in LOC_NONE.
megamek/src/megamek/common/templates/VehicleTROView.java Overrides skipMount to hide CASE/armor/structure at LOC_NONE while displaying cockpit mods in vehicle TROs.
megamek/src/megamek/common/templates/SupportVeeTROView.java Same skipMount override for support vehicles so cockpit mods are visible in TROs.
megamek/src/megamek/common/templates/BattleArmorTROView.java Refines equipment filtering so BA LOC_NONE DNI/EI cockpit mods are shown while other slotless items remain hidden.
megamek/src/megamek/common/templates/AeroTROView.java Adds skipMount override so aerospace/conventional fighters show cockpit mods but hide CASE/armor/structure at LOC_NONE.
megamek/unittests/megamek/common/CockpitModificationTest.java Adds MTF and BLK round-trip tests verifying that DNI, EI, and DIC are preserved on Meks and DNI on Tanks.
megamek/unittests/megamek/common/verifier/TestEntityGameYearValidationTest.java Adds tests for TestMek game-year getter/setter and for treating DNI/EI as retrofittable in intro-year validation, based on entity year vs explicit game year.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HammerGS
Copy link
Member Author

Here are some pre-made test units of the various classes.

Test Units.zip

@HammerGS HammerGS force-pushed the Implement-DNI-EI-DIC-Support branch 2 times, most recently from 1283178 to e2233e7 Compare January 30, 2026 23:18
- Add DNI Cockpit Modification (IS, Advanced) for Meks, BA, CV, SV, Fighters
- Add Enhanced Imaging (EI) Interface (Clan, Experimental) for Meks and BA
- Add Damage Interrupt Circuit (IS, Experimental) for Meks only
- Fix tech levels: DNI stays Advanced, DIC stays Experimental
- Add BLK file save/load for slotless (LOC_NONE) equipment
- Fix Unit Viewer to display cockpit modifications for all unit types
- Add game year support in ITechManager.isLegal() and TestEntity validation
- Mark DNI and EI as retrofittable equipment (skipped in intro year validation)
- Add unit tests for save/load and game year validation

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@HammerGS HammerGS force-pushed the Implement-DNI-EI-DIC-Support branch from e2233e7 to 95868e4 Compare January 31, 2026 00:02
mek.getCockpit() can return null CriticalSlot entries when cockpit
slots haven't been initialized yet (e.g., during cockpit type changes
in MegaMekLab). Added null filter before checking isArmored().

Fixes regression from 6bee6ab (Mark armored interface cockpit as invalid)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@HammerGS HammerGS added AI ready for Review Indicates that is has been in game tested and is ready for review as it can be and removed Needs Player Testing PR lacks actual play testing. labels Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Fix AI-generated fix. Requires human testing and review before merging. AI ready for Review Indicates that is has been in game tested and is ready for review as it can be

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants