feat(profile): support first-run selection and tutorial skipping

Save the selected country, starting crew, and unlocks when the client
submits its first-run selection. Use the stock unlock and crew formats.
Enable the existing option to skip the basic tutorial.

The client reached the hangar. Tutorial verification is pending.
This commit is contained in:
N0VAN0M4LY committed 2026-11-24 10:01:47 +08:00
1 parent ac2c185d4c
commit d88aa3ff4f
8 files changed
+227 -10

No files matched your search

@@ -0,0 +1,31 @@
/**
* Game features (feature flags) the offline version turns on for every player.
*
* char.vromfs.bin config/game_settings.blk lists features as features{ <name>{ condition:t } };
* condition:t="" means every player has it (the UI scripts ask with hasFeature, which falls
* back to the native local_player_has_feature, scripts/user/features.nut).
*
* AllowedToSkipBaseTutorials: lets the player skip the base tutorials. The stock tutorial
* offer (scripts/tutorials/nextTutorialHandler.nut) enables its skip and close buttons only
* with this feature (tutorialsData.nut canSkipByFeature). The offline version makes the
* tutorial optional (local verification).
*/
import { ensureBlock, setParam, type BlkBlock } from '@wto/blk';
export const GAME_SETTINGS_PATH = 'config/game_settings.blk';
export const OFFLINE_FEATURES: readonly string[] = ['AllowedToSkipBaseTutorials'];
/** Give every player the features; returns the ones that were not on for everyone before. */
export function enableFeaturesForEveryone(gameSettings: BlkBlock, names: readonly string[]): string[] {
const features = ensureBlock(gameSettings, 'features');
const changed: string[] = [];
for (const name of names) {
const feature = ensureBlock(features, name);
const condition = feature.params.find((param) => param.name === 'condition')?.value;
if (condition?.type === 'string' && condition.value === '') continue;
setParam(feature, 'condition', { type: 'string', value: '' });
changed.push(name);
}
return changed;
}