feat(tuning): configure tuning for each game copy

This commit is contained in:
N0VAN0M4LY committed 2026-11-29 16:24:21 +08:00
1 parent 61255f5473
commit 893d60854f
15 files changed
+440 -9

No files matched your search

+1
View File
@@ -17,6 +17,7 @@ export const APP_ERROR_CODES = [
'logs_folder_open_failed',
'diagnostics_export_failed',
'copy_not_found',
'tuning_invalid',
'save_not_found',
'save_archive_invalid',
'save_official_invalid',
+2
View File
@@ -14,6 +14,8 @@ export const IPC_CHANNEL_PREFIXES = [
'install:',
/** Listing and managing installed copies. */
'copies:',
/** Settings shared by the saves of a game copy. */
'tuning:',
/** Local account and save management. */
'saves:',
/** Starting and stopping the active copy. */
+9
View File
@@ -16,6 +16,7 @@ import {
import { LabInfoSchema, LaunchStateSchema } from '../schemas/launch.ts';
import { MaintenanceInfoSchema, MaintenanceProgressSchema, MaintenanceRequestSchema } from '../schemas/maintenance.ts';
import { ResearchBranchSchema, ResearchOperationSchema, SaveResearchSchema, OfficialImportOptionsSchema, OfficialPreviewSchema, SaveOfficialRequestSchema, CurrencyEditsSchema, SaveBackupNameSchema, SaveBackupSchema, SaveDetailsSchema, SaveKeysSchema, SaveListSchema, SaveRegistrationSchema, SaveTransferSchema } from '../schemas/saves.ts';
import { TuningPatchSchema, TuningViewSchema } from '../schemas/tuning.ts';
import { SettingsPatchSchema, SettingsSchema } from '../schemas/settings.ts';
/**
@@ -196,6 +197,14 @@ export const ipcContract = {
input: SaveKeysSchema.extend({ branch: ResearchBranchSchema, action: ResearchOperationSchema }),
output: SaveResearchSchema,
},
'tuning:get': {
input: z.object({ copyId: CopyIdSchema }),
output: TuningViewSchema,
},
'tuning:update': {
input: z.object({ copyId: CopyIdSchema, patch: TuningPatchSchema }),
output: TuningViewSchema,
},
'launch:getState': {
input: z.void(),
output: LaunchStateSchema,
@@ -0,0 +1,24 @@
import { z } from 'zod';
export const AUTO_TARGET_PICKS = ['lowestRank', 'highestRank', 'treeOrder'] as const;
export const TuningValuesSchema = z.object({
rewardMultiplierSilverLions: z.number().min(0).max(100),
rewardMultiplierResearchPoints: z.number().min(0).max(100),
friendlyKillPenaltyMul: z.number().min(0).max(100),
maxPlayers: z.number().int().min(2).max(64),
smallTeamsMaxPlayers: z.number().int().min(2).max(64),
brSpreadMrank: z.number().int().min(0).max(12),
subModeChance: z.number().min(0).max(1),
tankBotRespawns: z.number().int().min(1).max(10),
airBotRespawns: z.number().int().min(1).max(10),
strikeUcavSpawnScore: z.number().int().min(1).max(10000),
silverLions: z.number().int().nonnegative(),
goldenEagles: z.number().int().min(0).max(0x7fffffff),
preferLineSuccessor: z.boolean(),
autoTargetPick: z.enum(AUTO_TARGET_PICKS),
});
export const TuningPatchSchema = TuningValuesSchema.partial();
export const TuningViewSchema = z.object({ defaults: TuningValuesSchema, effective: TuningValuesSchema });
export type TuningValues = z.output<typeof TuningValuesSchema>;
export type TuningPatch = z.output<typeof TuningPatchSchema>;
export type TuningView = z.output<typeof TuningViewSchema>;