Merge branch 'master' into refactor/migrate-military-generator

This commit is contained in:
Marc Emmanuel 2026-02-22 17:32:52 +01:00
commit 3f282c74d0
15 changed files with 2885 additions and 1470 deletions

View file

@ -482,6 +482,12 @@ class MilitaryModule {
return regiments as MilitaryRegiment[];
};
// remove all existing regiment notes before regenerating
for (let i = notes.length - 1; i >= 0; i--) {
if (notes[i].id.startsWith("regiment")) notes.splice(i, 1);
}
// get regiments for each state
valid.forEach((s) => {
s.military = createRegiments(s.temp.platoons, s);
@ -594,7 +600,14 @@ class MilitaryModule {
: gauss(options.year - 100, 150, 1, options.year - 6);
const conflict = campaign ? ` during the ${campaign.name}` : "";
const legend = `Regiment was formed in ${year} ${options.era}${conflict}. ${station}${troops}`;
notes.push({ id: `regiment${s.i}-${r.i}`, name: r.name, legend });
const id = `regiment${s.i}-${r.i}`;
const existing = notes.find(n => n.id === id);
if (existing) {
existing.name = r.name;
existing.legend = legend;
} else {
notes.push({id, name: r.name, legend});
}
}
// get default regiment emblem