make new account + orientation work

This commit is contained in:
Devin Zuczek
2026-06-16 01:29:48 -04:00
parent 335b4d68ce
commit 1fa841f955
7 changed files with 72 additions and 73 deletions
+11 -6
View File
@@ -1,17 +1,22 @@
/**
* Default player settings seeded on a player's first read, ported verbatim from
* the C# `PlayerSettingsController.GetPlayerSettings`. Ordered; written to KV the
* first time a player has no stored settings.
* Default player settings seeded on a player's first read. Based on the C#
* `PlayerSettingsController.GetPlayerSettings`, but the onboarding/progress flags
* are reset to a *fresh* player — the C# values were copied from an already-
* onboarded account, which made new accounts skip Orientation (the client saw
* OOBE/tutorials as complete and warped them to the dorm within seconds).
* Ordered; written to KV the first time a player has no stored settings.
*/
export const DEFAULT_SETTINGS: Array<{ Key: string; Value: string }> = [
{ Key: 'Recroom.OOBE', Value: '77' },
// 0 = no OOBE steps done, so the new-user Orientation flow runs.
{ Key: 'Recroom.OOBE', Value: '0' },
{
Key: 'SplitTestAssignedSegments',
Value:
'1|{"SplitTesting+PhotonMaxDatagrams_2021_01_11":"Off","SplitTesting+Curated_Rooms_2020_08_06":"Off","SplitTesting+RoomRecommendationsType_2020_08_14":"Aug14MinVisitors35000"}',
},
{ Key: 'PlayerSessionCount', Value: '13' },
{ Key: 'TUTORIAL_COMPLETE_MASK', Value: '11' },
{ Key: 'PlayerSessionCount', Value: '0' },
// 0 = no tutorials completed (fresh player).
{ Key: 'TUTORIAL_COMPLETE_MASK', Value: '0' },
{ Key: 'BACKPACK_FAVORITE_TOOL', Value: '1' },
{ Key: 'VoiceChat', Value: '2' },
{ Key: 'VRAUTOSPRINT', Value: '1' },
@@ -66,12 +66,13 @@ describe('playersettings endpoints', () => {
const settings = (await res.json()) as Array<{ PlayerId: number; Key: string; Value: string }>
expect(settings.length).toBeGreaterThan(0)
expect(settings.every((s) => s.PlayerId === 100)).toBe(true)
expect(settings.find((s) => s.Key === 'Recroom.OOBE')?.Value).toBe('77')
expect(settings.find((s) => s.Key === 'PlayerSessionCount')?.Value).toBe('13')
// Fresh-player onboarding defaults so the new-user Orientation flow runs.
expect(settings.find((s) => s.Key === 'Recroom.OOBE')?.Value).toBe('0')
expect(settings.find((s) => s.Key === 'TUTORIAL_COMPLETE_MASK')?.Value).toBe('0')
// Defaults were persisted to KV.
const stored = await env.PLAYER_SETTINGS.get<Record<string, string>>('player:100', 'json')
expect(stored?.['Recroom.OOBE']).toBe('77')
expect(stored?.['Recroom.OOBE']).toBe('0')
})
it('GET /playersettings reflects a value written by PUT', async () => {