Skip to content

Bfs assets - #8533

Merged
pavelbraginskiy merged 41 commits into
MegaMek:mainfrom
pavelbraginskiy:bfs-assets
Aug 2, 2026
Merged

Bfs assets#8533
pavelbraginskiy merged 41 commits into
MegaMek:mainfrom
pavelbraginskiy:bfs-assets

Conversation

@pavelbraginskiy

@pavelbraginskiy pavelbraginskiy commented Jul 16, 2026

Copy link
Copy Markdown
Member

Must be merged with PRs MegaMek/megameklab#2264. MegaMek/mekhq#9653, MegaMek/mm-data#470

Add Battlefield Support Assets

This adds Battlefield Support Assets as a first-class unit type,
using a new .bfs YAML format for their card-based stats and UUID links to corresponding standard units.
Assets are integrated into the unit cache and selector,
include Advanced Search filters, render printable BFS cards, and support standalone or linked unit forms.

The update also adds lobby selection and configuration, Regular/Veteran crews and costs,
persistent damage and MUL round-tripping, distinctive camouflage overlays,
and dedicated Summary, TRO, and BFS Card views.
This PR provides the data model and non-gameplay infrastructure;
the Asset movement and combat rules will follow separately.

pavelbraginskiy and others added 2 commits July 15, 2026 15:18
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Battlefield Support Assets (BFS) as a first-class, card-stat unit type backed by a new .bfs YAML format, integrating them into unit loading/caching, MUL serialization, unit selection UI, readouts/TRO views, and advanced search—providing the non-gameplay infrastructure needed for later movement/combat rules.

Changes:

  • Introduces .bfs loader + BFS asset data primitives (damage/range/specials, asset type, artillery type) and BV calculation derived from BSP.
  • Extends cache + MUL I/O to use unit-file UUIDs as primary lookup keys, adds asset-only persistence (Destroy Check damage) and camouflage marker overlay persistence.
  • Adds UI support (unit selector behavior, lobby formatting, dedicated BFS card panel/view) and a large set of focused unit tests + .bfs fixtures.

Reviewed changes

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

Show a summary per file
File Description
megamek/unittests/megamek/common/units/EntityListFileUnitUuidTest.java Tests unit-file UUID serialization behavior for non-assets and legacy overlay safety.
megamek/unittests/megamek/common/units/EntityListFileBattlefieldSupportAssetTest.java Tests BFS asset MUL serialization/round-trip (UUID, destroy check, overlay).
megamek/unittests/megamek/common/templates/BattlefieldSupportAssetTROViewTest.java Tests BFS asset TRO view dispatch + rendering.
megamek/unittests/megamek/common/loaders/BFSMekSummaryTest.java Tests building MekSummary from .bfs and caching BFS fields.
megamek/unittests/megamek/common/icons/CamouflageTest.java Tests legacy overlay-field defaults and equality/hash behavior.
megamek/unittests/megamek/common/battlefieldSupport/cardDrawer/BattlefieldSupportCardRenderTest.java Smoke test/dev harness rendering BFS cards to PNG.
megamek/unittests/megamek/common/battlefieldSupport/BFSSpecialTypeTest.java Tests special-type lookup/aliases and artillery type parsing.
megamek/unittests/megamek/common/battlefieldSupport/BFSSpecialTest.java Tests special parsing/display/known-type resolution.
megamek/unittests/megamek/common/battlefieldSupport/BFSRangeTest.java Tests BFS range display behavior.
megamek/unittests/megamek/common/battlefieldSupport/BFSDamageTest.java Tests BFS damage parsing/display/totaling.
megamek/unittests/megamek/common/battlefieldSupport/BattlefieldSupportAssetYamlTest.java Tests BFS YAML round-tripping, optionals, UUID/link fields.
megamek/unittests/megamek/client/ui/util/FluffImageHelperAssetTest.java Tests fluff-image folder selection for BFS assets.
megamek/unittests/megamek/client/ui/tileset/MekTilesetAssetTest.java Tests generic sprite resolution for BFS assets.
megamek/unittests/megamek/client/ui/panels/battlefieldSupport/BFSCardPanelTest.java Tests BFS card panel rendering/empty state/font/scale.
megamek/unittests/megamek/client/ui/entityreadout/BattlefieldSupportAssetReadoutTest.java Tests BFS asset readout factory + format expectations.
megamek/unittests/megamek/client/ui/dialogs/unitSelectorDialogs/EntityViewPaneBattlefieldSupportTest.java Tests selector entity view tab layouts for standalone/linked assets.
megamek/unittests/megamek/client/ui/dialogs/unitSelectorDialogs/AbstractUnitSelectorDialogFilterTest.java Tests unit-type filter semantics for BFS assets and linked base units.
megamek/unittests/megamek/client/ui/dialogs/advancedsearch/BFSAdvancedSearchPanelTest.java Tests BFS advanced-search filtering semantics and state round-trip.
megamek/testresources/data/mekfiles/Mobile Long Tom LT-MOB-25.bfs BFS fixture (keyword range/artillery special).
megamek/testresources/data/mekfiles/Maxim Heavy Hover Transport.bfs BFS fixture (linked vehicle asset).
megamek/testresources/data/mekfiles/Heavy Emplacement.bfs BFS fixture (emplacement).
megamek/testresources/data/mekfiles/Foot Platoon (Rifle).bfs BFS fixture (conventional infantry).
megamek/testresources/data/mekfiles/Elemental Battle Armor [MG] (Sqd5).bfs BFS fixture (battle armor).
megamek/testresources/data/mekfiles/Browning Mobile HQ.bfs BFS fixture (ECM numeric special).
megamek/src/megamek/common/units/UnitType.java Adds BFS unit type constant and name entry.
megamek/src/megamek/common/units/EntityListFile.java Writes unit-file UUID + BFS destroy check + overlay attrs; embeds .bfs YAML.
megamek/src/megamek/common/units/Entity.java Adds BFS entity-type flag constant.
megamek/src/megamek/common/units/BTObject.java Adds isBattlefieldSupportAsset() default hook.
megamek/src/megamek/common/templates/TROView.java Dispatches BFS assets to a dedicated TRO view.
megamek/src/megamek/common/templates/BattlefieldSupportAssetTROView.java New TRO view model for BFS assets and templates.
megamek/src/megamek/common/net/marshalling/SanityInputFilter.java Allows java.awt.Color for marshalling.
megamek/src/megamek/common/loaders/MULParser.java Adds overlay attrs + unit-file UUID lookup + BFS destroy-check persistence.
megamek/src/megamek/common/loaders/MekSummaryCache.java Adds .bfs support, UUID maps, asset linkage maps, BFS summary population.
megamek/src/megamek/common/loaders/MekSummary.java Adds UUID/link fields + cached BFS stats for filtering.
megamek/src/megamek/common/loaders/MekFileParser.java Adds .bfs parsing and in-memory content routing.
megamek/src/megamek/common/loaders/BFSFile.java New loader converting .bfs YAML into BattlefieldSupportAsset.
megamek/src/megamek/common/icons/Camouflage.java Adds BFS marker-overlay settings, persistence helpers, equality/hash updates.
megamek/src/megamek/common/battleValue/BVCalculator.java Routes BFS assets to a dedicated BV calculator.
megamek/src/megamek/common/battleValue/BattlefieldSupportAssetBVCalculator.java BV derived directly from BSP/crew grade for BFS assets.
megamek/src/megamek/common/battlefieldSupport/StripeDirection.java New enum for overlay stripe direction.
megamek/src/megamek/common/battlefieldSupport/OverlayStyle.java New enum for overlay style (none/band/hazard).
megamek/src/megamek/common/battlefieldSupport/BFSSpecialType.java Registry of known BFS specials + code normalization/aliases.
megamek/src/megamek/common/battlefieldSupport/BFSSpecial.java Value-carrying special token model + parse/display helpers.
megamek/src/megamek/common/battlefieldSupport/BFSRange.java Range value object + keyword/NA display behavior.
megamek/src/megamek/common/battlefieldSupport/BFSDamage.java Damage value object + parse/display/total helpers.
megamek/src/megamek/common/battlefieldSupport/BFSAssetType.java BFS asset-type enum + tolerant parsing.
megamek/src/megamek/common/battlefieldSupport/BFSArtilleryType.java Artillery-type enum + tolerant parsing.
megamek/src/megamek/client/ui/util/StringDrawer.java Adds “draw as text” mode for SVG-friendly output.
megamek/src/megamek/client/ui/util/FluffImageHelper.java Adds asset fluff folder + ordered folder search for assets.
megamek/src/megamek/client/ui/tileset/MekTileset.java Adds generic sprite selection logic for BFS assets.
megamek/src/megamek/client/ui/tileset/EntityImage.java Adds camo-driven marker overlay rendering for BFS assets.
megamek/src/megamek/client/ui/panels/phaseDisplay/lobby/LobbyMekCellFormatter.java Formats BFS assets distinctly in lobby (yellow name, no “0 tons”, crew grade).
megamek/src/megamek/client/ui/panels/phaseDisplay/lobby/LobbyActions.java Adds BFS asset config/damage dialogs and multi-entity camo handling.
megamek/src/megamek/client/ui/panels/phaseDisplay/lobby/ChatLounge.java Updates camo chooser wiring to handle multiple displayed entities.
megamek/src/megamek/client/ui/panels/battlefieldSupport/BFSCardPanel.java New Swing component to render/copy BFS cards.
megamek/src/megamek/client/ui/entityreadout/LiveEntityViewPane.java Shows BFS card instead of AS card for assets in live readout.
megamek/src/megamek/client/ui/entityreadout/EntityReadoutUnitType.java Adds BFS unit type label to readouts.
megamek/src/megamek/client/ui/entityreadout/EntityReadout.java Adds BFS asset readout dispatch.
megamek/src/megamek/client/ui/entityreadout/BattlefieldSupportAssetReadout.java New summary readout implementation for BFS assets.
megamek/src/megamek/client/ui/dialogs/unitSelectorDialogs/MegaMekUnitSelectorDialog.java Adds “Select as Unit/Asset” flows and asset-aware skill generation.
megamek/src/megamek/client/ui/dialogs/unitSelectorDialogs/EntityViewPane.java Adds standalone/linked asset tab configurations + BFS sub-tabs.
megamek/src/megamek/client/ui/dialogs/customMek/BattlefieldSupportAssetDamageDialog.java New minimal dialog for asset persistent damage (Destroy Check).
megamek/src/megamek/client/ui/dialogs/customMek/BattlefieldSupportAssetConfigDialog.java New minimal dialog for asset crew name + Regular/Veteran grade.
megamek/src/megamek/client/ui/dialogs/advancedsearch/AdvSearchState.java Adds persisted BFS advanced-search state.
megamek/src/megamek/client/ui/dialogs/advancedsearch/AdvancedSearchDialog.java Adds BFS advanced-search tab and save/load integration.
megamek/resources/megamek/common/templates/tro/bfs_asset.ftlh New HTML TRO template for BFS assets.
megamek/resources/megamek/common/templates/tro/bfs_asset.ftl New text TRO template for BFS assets.
megamek/resources/megamek/common/messages.properties Adds UnitType display string for BFS assets.
megamek/resources/megamek/client/messages.properties Adds BFS UI strings (tabs, dialogs, advanced search, selector).
megamek/build.gradle Adds Batik bridge dependency for SVG-related rendering.

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

Comment thread megamek/src/megamek/common/icons/Camouflage.java
Comment thread megamek/src/megamek/client/ui/util/FluffImageHelper.java Outdated
@pavelbraginskiy pavelbraginskiy added the AI ready for Review Indicates that is has been in game tested and is ready for review as it can be label Jul 16, 2026
Comment thread megamek/src/megamek/client/ui/dialogs/iconChooser/CamoChooserDialog.java Dismissed
Comment thread megamek/src/megamek/client/ui/tileset/MekTileset.java Dismissed
case GunEmplacement ignored -> new GunEmplacementBVCalculator(entity);
case HandheldWeapon ignored -> new HandheldWeaponBVCalculator(entity);
case AbstractBuildingEntity ignored -> new AbstractBuildingEntityBVCalculator(entity);
case BattlefieldSupportAsset ignored -> new BattlefieldSupportAssetBVCalculator(entity);
Comment thread megamek/src/megamek/common/battlefieldSupport/BFSDamage.java Fixed
Comment thread megamek/src/megamek/common/battlefieldSupport/BFSDamage.java Fixed
Comment thread megamek/src/megamek/common/loaders/MekSummary.java Fixed
pavelbraginskiy and others added 3 commits July 15, 2026 17:37
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.72000% with 857 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.59%. Comparing base (bb7f4cc) to head (c7f4e34).
⚠️ Report is 26 commits behind head on main.

Files with missing lines Patch % Lines
...nitSelectorDialogs/AbstractUnitSelectorDialog.java 6.00% 141 Missing ⚠️
...ient/ui/dialogs/iconChooser/CamoChooserDialog.java 0.00% 96 Missing ⚠️
...on/battlefieldSupport/BattlefieldSupportAsset.java 77.69% 42 Missing and 16 partials ⚠️
...ent/ui/panels/battlefieldSupport/BFSCardPanel.java 31.70% 55 Missing and 1 partial ⚠️
...mek/src/megamek/client/ui/tileset/EntityImage.java 3.50% 52 Missing and 3 partials ⚠️
...ieldSupport/cardDrawer/BattlefieldSupportCard.java 85.20% 38 Missing and 12 partials ⚠️
...dialogs/advancedsearch/BFSAdvancedSearchPanel.java 86.15% 17 Missing and 32 partials ⚠️
...s/battlefieldSupport/ConfigurableBFSCardPanel.java 53.00% 41 Missing and 6 partials ⚠️
...unitSelectorDialogs/MegaMekUnitSelectorDialog.java 4.76% 40 Missing ⚠️
...customMek/BattlefieldSupportAssetConfigDialog.java 0.00% 30 Missing ⚠️
... and 32 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8533      +/-   ##
============================================
+ Coverage     31.83%   32.59%   +0.75%     
- Complexity    22684    23849    +1165     
============================================
  Files          3393     3428      +35     
  Lines        330218   333518    +3300     
  Branches      58098    58528     +430     
============================================
+ Hits         105120   108695    +3575     
+ Misses       213048   212309     -739     
- Partials      12050    12514     +464     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

# Conflicts:
#	megamek/src/megamek/client/ui/panels/phaseDisplay/lobby/LobbyActions.java
Copilot AI review requested due to automatic review settings July 23, 2026 01:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 81 out of 81 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

megamek/src/megamek/common/units/EntityListFile.java:1549

  • Same compilation issue here: logger.error(e); is not a valid MMLogger call. Use the overload that includes the throwable so the stack trace is logged (and Sentry capture happens) in one call.

Comment thread megamek/src/megamek/common/units/EntityListFile.java
pavelbraginskiy and others added 2 commits July 22, 2026 18:26
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

# Conflicts:
#	megamek/src/megamek/client/ui/tileset/EntityImage.java
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 23, 2026 05:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 81 out of 81 changed files in this pull request and generated 2 comments.

Comment thread megamek/src/megamek/common/loaders/MekSummary.java
Comment thread megamek/src/megamek/common/loaders/MULParser.java
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 23, 2026 07:42
Comment thread megamek/src/megamek/common/units/EntityListFile.java Dismissed
Comment thread megamek/src/megamek/common/units/EntityListFile.java Dismissed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 81 out of 81 changed files in this pull request and generated 1 comment.

Comment thread megamek/src/megamek/client/ui/panels/phaseDisplay/lobby/LobbyActions.java Outdated
@pavelbraginskiy
pavelbraginskiy merged commit 34d84c1 into MegaMek:main Aug 2, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants