Key Clan Goliath Scorpion's Force Generator era data to CGS - #525
Open
HammerGS wants to merge 1 commit into
Open
Key Clan Goliath Scorpion's Force Generator era data to CGS#525HammerGS wants to merge 1 commit into
HammerGS wants to merge 1 commit into
Conversation
The per-era Force Generator parameters for Clan Goliath Scorpion - the Clan, Star League and Omni percentages, the tech margins and the salvage table - were still written under the retired codes CEI and SE in the seven era files from 3082 to 3160. The Escorpion Imperio and the Scorpion Empire were consolidated into the CGS faction file, so no CGS block existed in those files at all and MegaMek logged "Faction CEI not found in data/forcegenerator/3082.xml" for each one. Those blocks are now keyed CGS. Two files, 3078 and 3131, also carried a placeholder block for the code the faction was about to take, holding nothing but a tech margin that already matched the real block in the same file. Both are removed, so each era names the faction exactly once. The availability entries in the units sections are left as they are. They still name the faction by the code it used in that era, which resolves through the aliases in CGS.yml, and they record what the faction was called at the time. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Merged
5 tasks
IllianiBird
added a commit
to MegaMek/megamek
that referenced
this pull request
Aug 21, 2026
…ion code (#8766) ## What this changes Clan Goliath Scorpion generated untuned forces from 3082 onwards. A 3145 Scorpion Empire force at the top equipment rating should come out about 90% Clan tech, 10% Star League, with 10% of the force salvaged from Clan Hell's Horses. None of that was applied, because the faction had no era parameters loaded at all for seven era buckets. Each Force Generator era file has two parts: a `<factions>` block holding the per-era tuning, and a `<units>` section holding availability. Clan Goliath Scorpion absorbed the Escorpion Imperio and the Scorpion Empire, so its blocks from 3082 on are still keyed `CEI` and then `SE`. The `<units>` section already resolved retired codes through `getFaction()`, but the `<factions>` section looked the code up directly in the faction map, which by design holds no alias keys. Every one of those blocks was dropped with `Faction CEI not found in data/forcegenerator/3082.xml`, and the faction fell back on its parent's tech mix. While testing this, a second defect turned up. `reloadFromDir` cleared both the `initialized` and `initializing` flags before reinitializing, so any `getInstance()` call during the reload started a second loader thread. That thread rebuilt every faction record once the reload released the lock, but skipped the era files because they were already marked loaded, leaving the records empty. Era parameters could not survive a reload at all, which also affects the RAT Generator Editor. ## Testing - New `RATGeneratorAliasedEraParametersTest`, four tests covering both shapes the shipped files take: an era holding only the retired code (like 3082 to 3160) and an era holding both the retired and surviving codes (like 3078 and 3131). - Confirmed the new tests genuinely catch the bug by reverting the alias lookup on its own: three of the four fail, and pass again with it restored. - Confirmed both halves of the fix are needed by reverting each independently. Neither alone makes the new tests pass. - Read Clan Goliath Scorpion's era parameters back out of the Force Generator against the real shipped data, before and after. Every bucket from 3082 to 3160 previously came back empty, at tech margin 0 with no percentages. After the fix each carries its values: tech margin 3 at 3082 and 3085, 6 at 3100, 12 at 3131, 15 at 3145, 16 at 3150 and 18 at 3160. - Loaded the real data through the running Force Generator and read `megamek.log`. The `Faction CEI not found` and `Faction SE not found` errors are gone, and the new duplicate-block warning fires exactly twice, for the two files that legitimately name both codes. - Generated Clan Goliath Scorpion 'Mek tables at 3100, 3145 and 3160, returning 214, 317 and 342 entries, confirming availability still resolves. - Full suite: 15291 tests, 8 skipped, 1 failure. That failure is `AeroWeaponFireInfoProbeTest.velocityPenaltyFiresOnALiveStyleRanking`, which fails identically on clean `main` with these changes stashed. It is unrelated and pre-existing. - Checkstyle passes. ## What is not proven yet - The Force Generator was never opened in the GUI. The values were read back through the real loading path rather than by generating a force from the menu. - Nothing exercises the RAT Generator Editor, so the reload fix is proven by the parameters surviving a reload in the harness, not by using the editor. - Two era files, 3078 and 3131, name both the retired and the surviving code. Their blocks are merged in document order and the later one wins for each field it sets. The overlapping values agree in the shipped data, so nothing changes today, but the merge order itself is not something a test pins down; it is logged instead, and the data fix is MegaMek/mm-data#525. --- - [x] This PR is focused on one issue or RFE. Large refactoring or accessibility work is in its own PR - [x] Every file in the diff has a deliberate change (no stray formatting, no unrelated files) - [x] Tests added or updated, if this implements a rule or changes game state - [x] Javadoc literals use `{@code true}` / `{@code null}` rather than bare or quoted text - [x] Dev team only: if AI tools were used, the **AI Assisted Development** label is applied, and I can explain and have verified the result
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Clan Goliath Scorpion had no Force Generator tuning of its own from 3082 onwards. Its per-era
parameters - the Clan, Star League and Omni percentages, the tech margins and the salvage table -
were still written under the retired codes
CEIandSEin the seven era files from 3082 to 3160.When the Escorpion Imperio and the Scorpion Empire were consolidated into the
CGSfaction file,those blocks were left behind, so no
CGSblock existed in any of those files and MegaMek loggedFaction CEI not found in data/forcegenerator/3082.xmlfor each one on startup.In practice a Scorpion Empire force came out untuned. The 3145 file asks for about 90% Clan tech at
the top equipment rating and 10% salvage taken from Clan Hell's Horses; with no block loaded, none
of that shaped the generated force. Those seven blocks are now keyed
CGS.Two files, 3078 and 3131, also carried a placeholder block for the code the faction was about to
take, holding nothing but a tech margin that already matched the real block in the same file. Both
are removed, so each era names the faction exactly once.
The availability entries in the
<units>sections are deliberately left alone. They name thefaction by the code it used in that era, which resolves through the aliases in
CGS.yml, and theyare a useful record of what the faction was called at the time.
This is the Force Generator counterpart to #507, which did the same for the diplomacy data.
Source
Not a canon data change - no percentage, margin or salvage value is altered. This corrects which
faction key the existing values are filed under, following the consolidation of the Escorpion
Imperio and Scorpion Empire into
CGS.yml, whosealiasesblock already records3080: CEIand3141: SE.How this was checked
Loaded the changed files in MegaMek and read Clan Goliath Scorpion's era parameters back out of the
Force Generator, before and after. Every bucket from 3082 to 3160 previously came back empty - tech
margin 0 and no percentages at all. After the change each one carries its values: tech margin 3 at
3082 and 3085, 6 at 3100, 12 at 3131, 15 at 3145, 16 at 3150 and 18 at 3160, with 90% Clan, 10%
Star League, 80% Omni at the top rating and 10% salvage throughout. The
Faction CEI not foundand
Faction SE not founderrors are gone from the log.Also generated Clan Goliath Scorpion 'Mek tables at 3100, 3145 and 3160, which returned 214, 317
and 342 entries. That confirms the availability entries still resolve with the parameter blocks
renamed.