Add modification, ammunition, and spare vehicle actions

Include modification, weapon, and spare vehicle prices, omitting zero
prices. Recalculate modification research and ranks and handle research
target selection, purchases, bulk purchases, and equipment toggles.
This commit is contained in:
N0VAN0M4LY committed 2026-11-24 21:43:35 +08:00
1 parent 56731efa76
commit 8692a13577
18 files changed
+742 -23

No files matched your search

+6 -2
View File
@@ -1,7 +1,7 @@
/**
* Assemble the players' profiles with the rules they depend on, the same way for the local
* service and for the save editor (save-cli.ts): static data from the dataset cache, the
* save store with its format upgrades, and the research state kept up to date.
* save store with its format upgrades, and the research and modification state kept up to date.
*/
import type { DatasetCache } from './game-data/datasets/dataset-cache.ts';
import { reserveVehicles } from './game-data/datasets/reserve-vehicles.ts';
@@ -10,6 +10,7 @@ import type { GameFiles } from './game-data/game-files.ts';
import { PlayerProfiles } from './profile/player-profiles.ts';
import { profileUpgrades } from './profile/profile-upgrades.ts';
import type { StartingContent } from './profile/starting-content.ts';
import { refreshModuleState } from './modifications/module-state.ts';
import { refreshResearchState } from './research/research-state.ts';
import { loadResearchRules, type ResearchRules } from './research/research-rules.ts';
import { SaveStore } from './saves/save-store.ts';
@@ -23,6 +24,9 @@ export function setUpProfiles(dataFolder: string, gameFiles: GameFiles, datasets
const startingContent: StartingContent = { reserveVehicles: datasets.load(reserveVehicles), branches: datasets.load(shopBranches) };
const research = loadResearchRules(datasets);
const saves = new SaveStore(dataFolder, profileUpgrades(startingContent));
const profiles = new PlayerProfiles(saves, gameFiles, startingContent, (profile) => refreshResearchState(profile, research));
const profiles = new PlayerProfiles(saves, gameFiles, startingContent, (profile) => {
refreshResearchState(profile, research);
refreshModuleState(profile, research.equipment);
});
return { profiles, research };
}