@battle-racing/br-common-lib 6.2.0-rc.8 → 6.2.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/data/all-tutorial-steps.js +37 -0
  2. package/dist/domains/command/Command.schema.d.ts +8 -4
  3. package/dist/domains/command/Command.schema.js +10 -2
  4. package/dist/domains/flow/Flow.schema.d.ts +2 -2
  5. package/dist/domains/game/Game.schema.d.ts +1 -1
  6. package/dist/domains/game/Game.schema.js +1 -1
  7. package/dist/domains/game/battle/Battle.schema.d.ts +1 -2
  8. package/dist/domains/game/battle/Battle.schema.js +0 -1
  9. package/dist/domains/game/race/Race.schema.d.ts +2 -3
  10. package/dist/domains/game/race/Race.schema.js +0 -1
  11. package/dist/domains/gameTrack/GameTrack.schema.d.ts +4 -0
  12. package/dist/domains/gameTrack/GameTrack.schema.js +2 -0
  13. package/dist/domains/powerUp/PowerUp.schema.d.ts +6 -6
  14. package/dist/domains/socket/serverToClient/SocketWebAppServerToClientEventsParams.d.ts +4 -0
  15. package/dist/domains/tutorial/Tutorial.const.d.ts +0 -2
  16. package/dist/domains/tutorial/Tutorial.const.js +1 -16
  17. package/dist/domains/tutorial/Tutorial.schema.d.ts +45 -31
  18. package/dist/domains/tutorial/Tutorial.schema.js +21 -23
  19. package/dist/domains/tutorial/Tutorial.types.d.ts +4 -2
  20. package/dist/domains/tutorial/TutorialConfig.schema.d.ts +9 -6
  21. package/dist/domains/tutorial/TutorialConfig.schema.js +1 -0
  22. package/dist/domains/utils/Utils.schema.d.ts +2 -0
  23. package/dist/domains/utils/Utils.schema.js +8 -3
  24. package/package.json +1 -1
  25. package/src/data/all-tutorial-steps.ts +41 -0
  26. package/src/domains/command/Command.schema.ts +10 -2
  27. package/src/domains/game/Game.schema.ts +1 -1
  28. package/src/domains/game/battle/Battle.schema.ts +0 -1
  29. package/src/domains/game/race/Race.schema.ts +0 -1
  30. package/src/domains/gameTrack/GameTrack.schema.ts +2 -0
  31. package/src/domains/socket/serverToClient/SocketWebAppServerToClientEventsParams.ts +2 -0
  32. package/src/domains/tutorial/Tutorial.const.ts +0 -16
  33. package/src/domains/tutorial/Tutorial.schema.ts +22 -22
  34. package/src/domains/tutorial/Tutorial.types.ts +6 -3
  35. package/src/domains/tutorial/TutorialConfig.schema.ts +1 -0
  36. package/src/domains/utils/Utils.schema.ts +8 -3
@@ -14,6 +14,23 @@ const nitroTutorialHud = {
14
14
  ...defaultTutorialHud,
15
15
  powerUp: domains_1.POWER_UP_NAME.BATTLE_NITRO,
16
16
  };
17
+ const startDrivingCommands = [
18
+ { module: 'speed', action: 'activate' },
19
+ { module: 'speed', action: 'change', params: { speed: '$kart.tutorialSpeed', forUnlimitedTime: true } },
20
+ ];
21
+ const stopKartCommands = [
22
+ { module: 'speed', action: 'change', params: { speed: 0, forUnlimitedTime: true } },
23
+ { module: 'speed', action: 'deactivate' },
24
+ ];
25
+ // The step fires the nitro, after it ends the speed module goes back to its default speed
26
+ const returnToFinishCommands = [
27
+ {
28
+ module: 'speed',
29
+ action: 'configure',
30
+ params: { defaultSpeed: '$kart.tutorialReturnSpeed', timeDuration: '$kart.powerUpTime' },
31
+ },
32
+ { module: 'speed', action: 'activate' },
33
+ ];
17
34
  exports.allTutorialConfig = {
18
35
  id: 'tutorial-master-v1',
19
36
  name: 'Standard Circuit Induction Tutorial',
@@ -33,6 +50,7 @@ exports.allTutorialConfig = {
33
50
  durationMs: 5000,
34
51
  },
35
52
  triggerCommands: [
53
+ ...stopKartCommands,
36
54
  {
37
55
  module: 'screen',
38
56
  action: 'showTutorialView',
@@ -52,6 +70,7 @@ exports.allTutorialConfig = {
52
70
  durationMs: 6000,
53
71
  },
54
72
  triggerCommands: [
73
+ ...stopKartCommands,
55
74
  {
56
75
  module: 'screen',
57
76
  action: 'showTutorialView',
@@ -78,6 +97,7 @@ exports.allTutorialConfig = {
78
97
  durationMs: 4000,
79
98
  },
80
99
  triggerCommands: [
100
+ ...stopKartCommands,
81
101
  {
82
102
  module: 'screen',
83
103
  action: 'showTutorialView',
@@ -97,6 +117,7 @@ exports.allTutorialConfig = {
97
117
  durationMs: 5000,
98
118
  },
99
119
  triggerCommands: [
120
+ ...stopKartCommands,
100
121
  {
101
122
  module: 'screen',
102
123
  action: 'showTutorialView',
@@ -116,6 +137,7 @@ exports.allTutorialConfig = {
116
137
  durationMs: 6000,
117
138
  },
118
139
  triggerCommands: [
140
+ ...startDrivingCommands,
119
141
  {
120
142
  module: 'screen',
121
143
  action: 'showTutorialView',
@@ -142,6 +164,7 @@ exports.allTutorialConfig = {
142
164
  target: domains_1.TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
143
165
  },
144
166
  triggerCommands: [
167
+ ...startDrivingCommands,
145
168
  {
146
169
  module: 'screen',
147
170
  action: 'showTutorialView',
@@ -169,6 +192,7 @@ exports.allTutorialConfig = {
169
192
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.RIGHT,
170
193
  },
171
194
  triggerCommands: [
195
+ ...stopKartCommands,
172
196
  {
173
197
  module: 'screen',
174
198
  action: 'showTutorialView',
@@ -188,6 +212,7 @@ exports.allTutorialConfig = {
188
212
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.LEFT,
189
213
  },
190
214
  triggerCommands: [
215
+ ...stopKartCommands,
191
216
  {
192
217
  module: 'screen',
193
218
  action: 'showTutorialView',
@@ -207,6 +232,7 @@ exports.allTutorialConfig = {
207
232
  durationMs: 4000,
208
233
  },
209
234
  triggerCommands: [
235
+ ...stopKartCommands,
210
236
  {
211
237
  module: 'screen',
212
238
  action: 'showTutorialView',
@@ -226,6 +252,7 @@ exports.allTutorialConfig = {
226
252
  target: domains_1.TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
227
253
  },
228
254
  triggerCommands: [
255
+ ...startDrivingCommands,
229
256
  {
230
257
  module: 'screen',
231
258
  action: 'showTutorialView',
@@ -246,6 +273,7 @@ exports.allTutorialConfig = {
246
273
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
247
274
  },
248
275
  triggerCommands: [
276
+ ...stopKartCommands,
249
277
  {
250
278
  module: 'screen',
251
279
  action: 'showTutorialView',
@@ -266,6 +294,7 @@ exports.allTutorialConfig = {
266
294
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
267
295
  },
268
296
  triggerCommands: [
297
+ ...stopKartCommands,
269
298
  {
270
299
  module: 'screen',
271
300
  action: 'showTutorialView',
@@ -286,6 +315,7 @@ exports.allTutorialConfig = {
286
315
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
287
316
  },
288
317
  triggerCommands: [
318
+ ...stopKartCommands,
289
319
  {
290
320
  module: 'screen',
291
321
  action: 'showTutorialView',
@@ -306,6 +336,7 @@ exports.allTutorialConfig = {
306
336
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
307
337
  },
308
338
  triggerCommands: [
339
+ ...stopKartCommands,
309
340
  {
310
341
  module: 'screen',
311
342
  action: 'showTutorialView',
@@ -333,6 +364,7 @@ exports.allTutorialConfig = {
333
364
  target: domains_1.TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
334
365
  },
335
366
  triggerCommands: [
367
+ ...startDrivingCommands,
336
368
  {
337
369
  module: 'screen',
338
370
  action: 'showTutorialView',
@@ -353,6 +385,7 @@ exports.allTutorialConfig = {
353
385
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
354
386
  },
355
387
  triggerCommands: [
388
+ ...stopKartCommands,
356
389
  {
357
390
  module: 'screen',
358
391
  action: 'showTutorialView',
@@ -373,6 +406,7 @@ exports.allTutorialConfig = {
373
406
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
374
407
  },
375
408
  triggerCommands: [
409
+ ...startDrivingCommands,
376
410
  {
377
411
  module: 'screen',
378
412
  action: 'showTutorialView',
@@ -388,11 +422,13 @@ exports.allTutorialConfig = {
388
422
  index: 3,
389
423
  name: 'Nitro Fired - Return to HUD',
390
424
  screenStep: domains_1.TUTORIAL_SCREEN_STEP.POWER_UP_RETURN_TO_HUD,
425
+ executePowerUpId: 'battle-nitro',
391
426
  listenEvent: {
392
427
  on: domains_1.TUTORIAL_LISTEN_EVENT_ON.CHECKPOINT,
393
428
  target: domains_1.TUTORIAL_CHECKPOINT_TARGET.FINISH,
394
429
  },
395
430
  triggerCommands: [
431
+ ...returnToFinishCommands,
396
432
  {
397
433
  module: 'screen',
398
434
  action: 'showTutorialView',
@@ -420,6 +456,7 @@ exports.allTutorialConfig = {
420
456
  durationMs: 5000,
421
457
  },
422
458
  triggerCommands: [
459
+ ...stopKartCommands,
423
460
  {
424
461
  module: 'screen',
425
462
  action: 'showTutorialView',
@@ -3,6 +3,10 @@ export declare const changeSpeedActionCommandOptionsSchema: z.ZodObject<{
3
3
  forUnlimitedTime: z.ZodOptional<z.ZodBoolean>;
4
4
  speed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
5
5
  }, z.core.$strip>;
6
+ export declare const configureSpeedActionCommandOptionsSchema: z.ZodObject<{
7
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
8
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
9
+ }, z.core.$strip>;
6
10
  export declare const speedModuleCommandSchema: z.ZodUnion<readonly [z.ZodObject<{
7
11
  module: z.ZodLiteral<"speed">;
8
12
  action: z.ZodLiteral<"activate">;
@@ -20,8 +24,8 @@ export declare const speedModuleCommandSchema: z.ZodUnion<readonly [z.ZodObject<
20
24
  module: z.ZodLiteral<"speed">;
21
25
  action: z.ZodLiteral<"configure">;
22
26
  params: z.ZodObject<{
23
- defaultSpeed: z.ZodNumber;
24
- timeDuration: z.ZodNumber;
27
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
28
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
25
29
  }, z.core.$strip>;
26
30
  }, z.core.$strip>]>;
27
31
  export declare const playSoundActionCommandOptionsSchema: z.ZodObject<{
@@ -1310,8 +1314,8 @@ export declare const allCommandsConfigSchema: z.ZodIntersection<z.ZodUnion<reado
1310
1314
  module: z.ZodLiteral<"speed">;
1311
1315
  action: z.ZodLiteral<"configure">;
1312
1316
  params: z.ZodObject<{
1313
- defaultSpeed: z.ZodNumber;
1314
- timeDuration: z.ZodNumber;
1317
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
1318
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
1315
1319
  }, z.core.$strip>;
1316
1320
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
1317
1321
  module: z.ZodLiteral<"leftStarBackLaser">;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.allCommandsConfigSchema = exports.lightsModuleCommandSchema = exports.emergencyModuleCommandSchema = exports.steeringWheelModuleCommandSchema = exports.screenModuleCommandSchema = exports.rightStarFrontLaserModuleCommandSchema = exports.leftStarBackLaserModuleCommandSchema = exports.rgbModuleCommandSchema = exports.flagModuleCommandSchema = exports.diskSensorBallShooterModuleCommandSchema = exports.ballSensorDiskThrowerModuleCommandSchema = exports.soundModuleCommandSchema = exports.playSoundActionCommandOptionsSchema = exports.speedModuleCommandSchema = exports.changeSpeedActionCommandOptionsSchema = void 0;
3
+ exports.allCommandsConfigSchema = exports.lightsModuleCommandSchema = exports.emergencyModuleCommandSchema = exports.steeringWheelModuleCommandSchema = exports.screenModuleCommandSchema = exports.rightStarFrontLaserModuleCommandSchema = exports.leftStarBackLaserModuleCommandSchema = exports.rgbModuleCommandSchema = exports.flagModuleCommandSchema = exports.diskSensorBallShooterModuleCommandSchema = exports.ballSensorDiskThrowerModuleCommandSchema = exports.soundModuleCommandSchema = exports.playSoundActionCommandOptionsSchema = exports.speedModuleCommandSchema = exports.configureSpeedActionCommandOptionsSchema = exports.changeSpeedActionCommandOptionsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const hardware_1 = require("../hardware");
6
6
  const utils_1 = require("../utils");
@@ -10,11 +10,19 @@ const arithmeticOrNumberSchema = zod_1.z.union([zod_1.z.number(), utils_1.arithm
10
10
  exports.changeSpeedActionCommandOptionsSchema = hardware_1.speedChangeOptionsSchema.omit({ speed: true }).extend({
11
11
  speed: arithmeticOrNumberSchema,
12
12
  });
13
+ exports.configureSpeedActionCommandOptionsSchema = zod_1.z.object({
14
+ defaultSpeed: arithmeticOrNumberSchema,
15
+ timeDuration: arithmeticOrNumberSchema,
16
+ });
13
17
  exports.speedModuleCommandSchema = zod_1.z.union([
14
18
  zod_1.z.object({ module: zod_1.z.literal('speed'), action: zod_1.z.literal('activate') }),
15
19
  zod_1.z.object({ module: zod_1.z.literal('speed'), action: zod_1.z.literal('deactivate') }),
16
20
  zod_1.z.object({ module: zod_1.z.literal('speed'), action: zod_1.z.literal('change'), params: exports.changeSpeedActionCommandOptionsSchema }),
17
- zod_1.z.object({ module: zod_1.z.literal('speed'), action: zod_1.z.literal('configure'), params: hardware_1.speedConfigurationSchema }),
21
+ zod_1.z.object({
22
+ module: zod_1.z.literal('speed'),
23
+ action: zod_1.z.literal('configure'),
24
+ params: exports.configureSpeedActionCommandOptionsSchema,
25
+ }),
18
26
  ]);
19
27
  // --- Sound Commands ---
20
28
  exports.playSoundActionCommandOptionsSchema = hardware_1.playSoundOptionsSchema.omit({ durationMs: true }).extend({
@@ -287,8 +287,8 @@ export declare const flowSchema: z.ZodObject<{
287
287
  module: z.ZodLiteral<"speed">;
288
288
  action: z.ZodLiteral<"configure">;
289
289
  params: z.ZodObject<{
290
- defaultSpeed: z.ZodNumber;
291
- timeDuration: z.ZodNumber;
290
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
291
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
292
292
  }, z.core.$strip>;
293
293
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
294
294
  module: z.ZodLiteral<"leftStarBackLaser">;
@@ -69,7 +69,7 @@ export declare const gameSchema: z.ZodObject<{
69
69
  position: z.ZodNumber;
70
70
  time: z.ZodNumber;
71
71
  }, z.core.$strip>>;
72
- tutorialConfigId: z.ZodOptional<z.ZodString>;
72
+ tutorialConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
73
  }, z.core.$strip>;
74
74
  export declare const assignKartSchema: z.ZodObject<{
75
75
  playerId: z.ZodString;
@@ -34,7 +34,7 @@ exports.gameSchema = zod_1.z.object({
34
34
  finishedReason: exports.gameFinishedReasonSchema.optional(),
35
35
  kartsState: zod_1.z.record(zod_1.z.string(), exports.gameKartStateSchema),
36
36
  gameRanking: zod_1.z.array(exports.kartRankingItemSchema),
37
- tutorialConfigId: zod_1.z.string().optional(),
37
+ tutorialConfigId: zod_1.z.string().nullable().optional(),
38
38
  });
39
39
  exports.assignKartSchema = zod_1.z.object({
40
40
  playerId: zod_1.z.string(),
@@ -36,7 +36,7 @@ export declare const battleSchema: z.ZodObject<{
36
36
  position: z.ZodNumber;
37
37
  time: z.ZodNumber;
38
38
  }, z.core.$strip>>;
39
- tutorialConfigId: z.ZodOptional<z.ZodString>;
39
+ tutorialConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
40
  type: z.ZodLiteral<"Battle">;
41
41
  lives: z.ZodNumber;
42
42
  kartsState: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -57,5 +57,4 @@ export declare const createBattleSchema: z.ZodObject<{
57
57
  gameTrackId: z.ZodString;
58
58
  gameTurnId: z.ZodOptional<z.ZodString>;
59
59
  isOfficial: z.ZodOptional<z.ZodBoolean>;
60
- tutorialConfigId: z.ZodOptional<z.ZodString>;
61
60
  }, z.core.$strip>;
@@ -27,5 +27,4 @@ exports.createBattleSchema = zod_1.z.object({
27
27
  gameTrackId: zod_1.z.string(),
28
28
  gameTurnId: zod_1.z.string().optional(),
29
29
  isOfficial: zod_1.z.boolean().optional(),
30
- tutorialConfigId: zod_1.z.string().optional(),
31
30
  });
@@ -106,7 +106,7 @@ export declare const raceSchema: z.ZodObject<{
106
106
  readonly EMERGENCY: "EMERGENCY";
107
107
  readonly BY_CONTROLLER: "BY_CONTROLLER";
108
108
  }>>;
109
- tutorialConfigId: z.ZodOptional<z.ZodString>;
109
+ tutorialConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
110
110
  type: z.ZodLiteral<"Race">;
111
111
  laps: z.ZodNumber;
112
112
  kartsState: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -166,7 +166,7 @@ export declare const raceWithDetailedRankingSchema: z.ZodObject<{
166
166
  readonly EMERGENCY: "EMERGENCY";
167
167
  readonly BY_CONTROLLER: "BY_CONTROLLER";
168
168
  }>>;
169
- tutorialConfigId: z.ZodOptional<z.ZodString>;
169
+ tutorialConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
170
170
  type: z.ZodLiteral<"Race">;
171
171
  laps: z.ZodNumber;
172
172
  kartsState: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -235,5 +235,4 @@ export declare const createRaceSchema: z.ZodObject<{
235
235
  gameTrackId: z.ZodString;
236
236
  gameTurnId: z.ZodOptional<z.ZodString>;
237
237
  isOfficial: z.ZodOptional<z.ZodBoolean>;
238
- tutorialConfigId: z.ZodOptional<z.ZodString>;
239
238
  }, z.core.$strip>;
@@ -70,5 +70,4 @@ exports.createRaceSchema = exports.startRaceSchema.partial().extend({
70
70
  gameTrackId: zod_1.z.string(),
71
71
  gameTurnId: zod_1.z.string().optional(),
72
72
  isOfficial: zod_1.z.boolean().optional(),
73
- tutorialConfigId: zod_1.z.string().optional(),
74
73
  });
@@ -17,6 +17,8 @@ export declare const gameTrackKartsConfigSchema: z.ZodObject<{
17
17
  waitTimeAfterHit: z.ZodNumber;
18
18
  }, z.core.$strip>;
19
19
  lowSpeed: z.ZodNumber;
20
+ tutorialSpeed: z.ZodNumber;
21
+ tutorialReturnSpeed: z.ZodNumber;
20
22
  }, z.core.$strip>;
21
23
  export declare const gameTrackKartConfigSchema: z.ZodObject<{
22
24
  gameTrackId: z.ZodString;
@@ -72,6 +74,8 @@ export declare const gameTrackSchema: z.ZodObject<{
72
74
  waitTimeAfterHit: z.ZodNumber;
73
75
  }, z.core.$strip>;
74
76
  lowSpeed: z.ZodNumber;
77
+ tutorialSpeed: z.ZodNumber;
78
+ tutorialReturnSpeed: z.ZodNumber;
75
79
  }, z.core.$strip>;
76
80
  macAddress: z.ZodOptional<z.ZodString>;
77
81
  isConnected: z.ZodBoolean;
@@ -18,6 +18,8 @@ exports.gameTrackKartsConfigSchema = zod_1.z.object({
18
18
  diskSensorBallShooter: hardware_1.configDiskSensorBallShooterModuleOptionsSchema,
19
19
  ballSensorDiskThrower: hardware_1.configureBallSensorDiskThrowerModuleOptionsSchema,
20
20
  lowSpeed: zod_1.z.number().min(0).max(100),
21
+ tutorialSpeed: zod_1.z.number().min(0).max(100),
22
+ tutorialReturnSpeed: zod_1.z.number().min(0).max(100),
21
23
  });
22
24
  exports.gameTrackKartConfigSchema = zod_1.z.object({
23
25
  gameTrackId: zod_1.z.string(),
@@ -283,8 +283,8 @@ export declare const powerUpCommandSchema: z.ZodIntersection<z.ZodUnion<readonly
283
283
  module: z.ZodLiteral<"speed">;
284
284
  action: z.ZodLiteral<"configure">;
285
285
  params: z.ZodObject<{
286
- defaultSpeed: z.ZodNumber;
287
- timeDuration: z.ZodNumber;
286
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
287
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
288
288
  }, z.core.$strip>;
289
289
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
290
290
  module: z.ZodLiteral<"leftStarBackLaser">;
@@ -1287,8 +1287,8 @@ export declare const powerUpSchema: z.ZodObject<{
1287
1287
  module: z.ZodLiteral<"speed">;
1288
1288
  action: z.ZodLiteral<"configure">;
1289
1289
  params: z.ZodObject<{
1290
- defaultSpeed: z.ZodNumber;
1291
- timeDuration: z.ZodNumber;
1290
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
1291
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
1292
1292
  }, z.core.$strip>;
1293
1293
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
1294
1294
  module: z.ZodLiteral<"leftStarBackLaser">;
@@ -2271,8 +2271,8 @@ export declare const powerUpSchema: z.ZodObject<{
2271
2271
  module: z.ZodLiteral<"speed">;
2272
2272
  action: z.ZodLiteral<"configure">;
2273
2273
  params: z.ZodObject<{
2274
- defaultSpeed: z.ZodNumber;
2275
- timeDuration: z.ZodNumber;
2274
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
2275
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
2276
2276
  }, z.core.$strip>;
2277
2277
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
2278
2278
  module: z.ZodLiteral<"leftStarBackLaser">;
@@ -3,6 +3,7 @@ import type { GameTrack } from '../../gameTrack';
3
3
  import type { Kart } from '../../kart';
4
4
  import type { CheckpointEvent } from '../../kartTracking';
5
5
  import type { Response } from '../../response';
6
+ import type { TutorialSession } from '../../tutorial';
6
7
  import type { MacAddressGameTrackConnections } from '../inputs';
7
8
  import type { SocketHardwareOnDataEventsParams } from '../SocketHardwareOnDataEventsParams';
8
9
  export interface SocketWebAppServerToClientEventsParams {
@@ -20,6 +21,9 @@ export interface SocketWebAppServerToClientEventsParams {
20
21
  'game:changed': {
21
22
  game: Game;
22
23
  };
24
+ 'tutorial:session:changed': {
25
+ session: TutorialSession;
26
+ };
23
27
  'gameTracks:onGameTrackUpdated': GameTrack[];
24
28
  'gameTracks:connectedRasperries': {
25
29
  macAddress: string;
@@ -51,5 +51,3 @@ export declare const TUTORIAL_CHECKPOINT_TARGET: {
51
51
  export declare const TUTORIAL_INPUT_SIGNAL_TYPE: {
52
52
  readonly STEERING_WHEEL_BUTTON_PRESSED: "SteeringWheelButtonPressed";
53
53
  };
54
- export declare const DRIVING_TUTORIAL_STEPS: readonly ["Pedal", "DriveToControls", "HudOverview", "PowerUpWaiting", "PowerUpNitroReady", "PowerUpReturnToHud"];
55
- export declare const isDrivingTutorialStep: (step?: string | null) => boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDrivingTutorialStep = exports.DRIVING_TUTORIAL_STEPS = exports.TUTORIAL_INPUT_SIGNAL_TYPE = exports.TUTORIAL_CHECKPOINT_TARGET = exports.TUTORIAL_STEERING_WHEEL_BUTTON = exports.TUTORIAL_LISTEN_EVENT_ON = exports.TUTORIAL_PHASE_ID = exports.TUTORIAL_STATUS = exports.TUTORIAL_SCREEN_STEP = void 0;
3
+ exports.TUTORIAL_INPUT_SIGNAL_TYPE = exports.TUTORIAL_CHECKPOINT_TARGET = exports.TUTORIAL_STEERING_WHEEL_BUTTON = exports.TUTORIAL_LISTEN_EVENT_ON = exports.TUTORIAL_PHASE_ID = exports.TUTORIAL_STATUS = exports.TUTORIAL_SCREEN_STEP = void 0;
4
4
  exports.TUTORIAL_SCREEN_STEP = {
5
5
  COUNTDOWN: 'Countdown',
6
6
  WELCOME: 'Welcome',
@@ -54,18 +54,3 @@ exports.TUTORIAL_CHECKPOINT_TARGET = {
54
54
  exports.TUTORIAL_INPUT_SIGNAL_TYPE = {
55
55
  STEERING_WHEEL_BUTTON_PRESSED: 'SteeringWheelButtonPressed',
56
56
  };
57
- exports.DRIVING_TUTORIAL_STEPS = [
58
- exports.TUTORIAL_SCREEN_STEP.PEDAL,
59
- exports.TUTORIAL_SCREEN_STEP.DRIVE_TO_CONTROLS,
60
- exports.TUTORIAL_SCREEN_STEP.HUD_OVERVIEW,
61
- exports.TUTORIAL_SCREEN_STEP.POWER_UP_WAITING,
62
- exports.TUTORIAL_SCREEN_STEP.POWER_UP_NITRO_READY,
63
- exports.TUTORIAL_SCREEN_STEP.POWER_UP_RETURN_TO_HUD,
64
- ];
65
- const isDrivingTutorialStep = (step) => {
66
- if (!step) {
67
- return false;
68
- }
69
- return exports.DRIVING_TUTORIAL_STEPS.includes(step);
70
- };
71
- exports.isDrivingTutorialStep = isDrivingTutorialStep;
@@ -43,6 +43,10 @@ export declare const tutorialSteeringWheelButtonSchema: z.ZodEnum<{
43
43
  left: "left";
44
44
  right: "right";
45
45
  }>;
46
+ export declare const tutorialInputButtonSchema: z.ZodEnum<{
47
+ left: "left";
48
+ right: "right";
49
+ }>;
46
50
  export declare const tutorialCheckpointTargetSchema: z.ZodEnum<{
47
51
  TRACK: "TRACK";
48
52
  POWER_UP: "POWER_UP";
@@ -124,7 +128,7 @@ export declare const tutorialKartSnapshotSchema: z.ZodObject<{
124
128
  }>>>;
125
129
  latestCheckpointId: z.ZodOptional<z.ZodString>;
126
130
  latestCheckpointProgress: z.ZodOptional<z.ZodNumber>;
127
- updatedAtISO: z.ZodString;
131
+ updatedAtISO: z.ZodISODateTime;
128
132
  }, z.core.$strip>;
129
133
  export declare const tutorialInputSignalTypeSchema: z.ZodEnum<{
130
134
  SteeringWheelButtonPressed: "SteeringWheelButtonPressed";
@@ -134,17 +138,16 @@ export declare const tutorialKartEventBaseSchema: z.ZodObject<{
134
138
  deviceId: z.ZodString;
135
139
  revision: z.ZodNumber;
136
140
  sequence: z.ZodNumber;
137
- originTimestampISO: z.ZodString;
141
+ originTimestampISO: z.ZodISODateTime;
138
142
  }, z.core.$strip>;
139
143
  export declare const tutorialSteeringWheelButtonPressedSchema: z.ZodObject<{
140
144
  tutorialSessionId: z.ZodString;
141
145
  deviceId: z.ZodString;
142
146
  revision: z.ZodNumber;
143
147
  sequence: z.ZodNumber;
144
- originTimestampISO: z.ZodString;
148
+ originTimestampISO: z.ZodISODateTime;
145
149
  type: z.ZodLiteral<"SteeringWheelButtonPressed">;
146
150
  button: z.ZodEnum<{
147
- any: "any";
148
151
  left: "left";
149
152
  right: "right";
150
153
  }>;
@@ -154,10 +157,9 @@ export declare const tutorialInputSignalSchema: z.ZodDiscriminatedUnion<[z.ZodOb
154
157
  deviceId: z.ZodString;
155
158
  revision: z.ZodNumber;
156
159
  sequence: z.ZodNumber;
157
- originTimestampISO: z.ZodString;
160
+ originTimestampISO: z.ZodISODateTime;
158
161
  type: z.ZodLiteral<"SteeringWheelButtonPressed">;
159
162
  button: z.ZodEnum<{
160
- any: "any";
161
163
  left: "left";
162
164
  right: "right";
163
165
  }>;
@@ -169,7 +171,7 @@ export declare const tutorialConfigurationSchema: z.ZodObject<{
169
171
  speedConfig: z.ZodOptional<z.ZodNumber>;
170
172
  }, z.core.$strip>;
171
173
  export declare const tutorialParticipantSchema: z.ZodObject<{
172
- deviceId: z.ZodString;
174
+ kartGuid: z.ZodString;
173
175
  playerId: z.ZodOptional<z.ZodString>;
174
176
  status: z.ZodEnum<{
175
177
  COMPLETED: "COMPLETED";
@@ -217,13 +219,17 @@ export declare const tutorialParticipantSchema: z.ZodObject<{
217
219
  total: z.ZodNumber;
218
220
  }, z.core.$strip>>;
219
221
  totalDurationSeconds: z.ZodDefault<z.ZodNumber>;
220
- startedAtISO: z.ZodOptional<z.ZodString>;
221
- updatedAtISO: z.ZodString;
222
+ startedAtISO: z.ZodOptional<z.ZodISODateTime>;
223
+ updatedAtISO: z.ZodISODateTime;
222
224
  }, z.core.$strip>;
223
225
  export declare const tutorialSessionSchema: z.ZodObject<{
224
226
  id: z.ZodString;
225
227
  gameTurnId: z.ZodOptional<z.ZodString>;
226
- gameId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
228
+ gameId: z.ZodNumber;
229
+ gameType: z.ZodEnum<{
230
+ readonly Race: "Race";
231
+ readonly Battle: "Battle";
232
+ }>;
227
233
  status: z.ZodEnum<{
228
234
  COMPLETED: "COMPLETED";
229
235
  PENDING: "PENDING";
@@ -232,7 +238,7 @@ export declare const tutorialSessionSchema: z.ZodObject<{
232
238
  SKIPPED: "SKIPPED";
233
239
  }>;
234
240
  participants: z.ZodArray<z.ZodObject<{
235
- deviceId: z.ZodString;
241
+ kartGuid: z.ZodString;
236
242
  playerId: z.ZodOptional<z.ZodString>;
237
243
  status: z.ZodEnum<{
238
244
  COMPLETED: "COMPLETED";
@@ -280,29 +286,37 @@ export declare const tutorialSessionSchema: z.ZodObject<{
280
286
  total: z.ZodNumber;
281
287
  }, z.core.$strip>>;
282
288
  totalDurationSeconds: z.ZodDefault<z.ZodNumber>;
283
- startedAtISO: z.ZodOptional<z.ZodString>;
284
- updatedAtISO: z.ZodString;
289
+ startedAtISO: z.ZodOptional<z.ZodISODateTime>;
290
+ updatedAtISO: z.ZodISODateTime;
285
291
  }, z.core.$strip>>;
286
- createdAtISO: z.ZodString;
287
- updatedAtISO: z.ZodString;
292
+ createdAtISO: z.ZodISODateTime;
293
+ updatedAtISO: z.ZodISODateTime;
288
294
  }, z.core.$strip>;
289
- export declare const startOperatorTutorialSchema: z.ZodObject<{
290
- gameId: z.ZodNumber;
291
- gameType: z.ZodEnum<{
292
- Race: "Race";
293
- Battle: "Battle";
294
- }>;
295
+ export declare const startRaceTutorialSchema: z.ZodObject<{
296
+ laps: z.ZodNumber;
297
+ coins: z.ZodNumber;
298
+ kartsGuids: z.ZodArray<z.ZodString>;
299
+ powerUpsIds: z.ZodArray<z.ZodString>;
300
+ time: z.ZodNumber;
301
+ speedConfig: z.ZodNumber;
302
+ playerKartMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
303
+ tutorialConfigId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
304
+ tutorialParams: z.ZodOptional<z.ZodObject<{
305
+ laps: z.ZodDefault<z.ZodNumber>;
306
+ coins: z.ZodDefault<z.ZodNumber>;
307
+ time: z.ZodDefault<z.ZodNumber>;
308
+ speedConfig: z.ZodOptional<z.ZodNumber>;
309
+ }, z.core.$strip>>;
310
+ }, z.core.$strip>;
311
+ export declare const startBattleTutorialSchema: z.ZodObject<{
312
+ lives: z.ZodNumber;
313
+ coins: z.ZodNumber;
314
+ kartsGuids: z.ZodArray<z.ZodString>;
315
+ powerUpsIds: z.ZodArray<z.ZodString>;
316
+ time: z.ZodNumber;
317
+ speedConfig: z.ZodNumber;
318
+ playerKartMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
295
319
  tutorialConfigId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
296
- params: z.ZodObject<{
297
- laps: z.ZodOptional<z.ZodNumber>;
298
- lives: z.ZodOptional<z.ZodNumber>;
299
- coins: z.ZodNumber;
300
- kartsGuids: z.ZodArray<z.ZodString>;
301
- powerUpsIds: z.ZodArray<z.ZodString>;
302
- time: z.ZodNumber;
303
- speedConfig: z.ZodNumber;
304
- playerKartMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
305
- }, z.core.$strip>;
306
320
  tutorialParams: z.ZodOptional<z.ZodObject<{
307
321
  laps: z.ZodDefault<z.ZodNumber>;
308
322
  coins: z.ZodDefault<z.ZodNumber>;
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.startOperatorTutorialSchema = exports.tutorialSessionSchema = exports.tutorialParticipantSchema = exports.tutorialConfigurationSchema = exports.tutorialInputSignalSchema = exports.tutorialSteeringWheelButtonPressedSchema = exports.tutorialKartEventBaseSchema = exports.tutorialInputSignalTypeSchema = exports.tutorialKartSnapshotSchema = exports.tutorialCheckpointTargetSchema = exports.tutorialSteeringWheelButtonSchema = exports.tutorialListenEventOnSchema = exports.tutorialPhaseIdSchema = exports.tutorialStatusSchema = exports.tutorialScreenStepSchema = void 0;
3
+ exports.startBattleTutorialSchema = exports.startRaceTutorialSchema = exports.tutorialSessionSchema = exports.tutorialParticipantSchema = exports.tutorialConfigurationSchema = exports.tutorialInputSignalSchema = exports.tutorialSteeringWheelButtonPressedSchema = exports.tutorialKartEventBaseSchema = exports.tutorialInputSignalTypeSchema = exports.tutorialKartSnapshotSchema = exports.tutorialCheckpointTargetSchema = exports.tutorialInputButtonSchema = exports.tutorialSteeringWheelButtonSchema = exports.tutorialListenEventOnSchema = exports.tutorialPhaseIdSchema = exports.tutorialStatusSchema = exports.tutorialScreenStepSchema = void 0;
4
4
  const zod_1 = require("zod");
5
+ const Battle_schema_1 = require("../game/battle/Battle.schema");
6
+ const Game_schema_1 = require("../game/Game.schema");
7
+ const Race_schema_1 = require("../game/race/Race.schema");
5
8
  const ScreenTutorial_schema_1 = require("../hardware/screen/ScreenTutorial.schema");
6
9
  const Tutorial_const_1 = require("./Tutorial.const");
7
10
  exports.tutorialScreenStepSchema = zod_1.z.enum([
@@ -48,6 +51,10 @@ exports.tutorialSteeringWheelButtonSchema = zod_1.z.enum([
48
51
  Tutorial_const_1.TUTORIAL_STEERING_WHEEL_BUTTON.LEFT,
49
52
  Tutorial_const_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
50
53
  ]);
54
+ exports.tutorialInputButtonSchema = zod_1.z.enum([
55
+ Tutorial_const_1.TUTORIAL_STEERING_WHEEL_BUTTON.RIGHT,
56
+ Tutorial_const_1.TUTORIAL_STEERING_WHEEL_BUTTON.LEFT,
57
+ ]);
51
58
  exports.tutorialCheckpointTargetSchema = zod_1.z.enum([
52
59
  Tutorial_const_1.TUTORIAL_CHECKPOINT_TARGET.TRACK,
53
60
  Tutorial_const_1.TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
@@ -67,7 +74,7 @@ exports.tutorialKartSnapshotSchema = zod_1.z.object({
67
74
  awaitingCheckpointTarget: exports.tutorialCheckpointTargetSchema.nullable().optional(),
68
75
  latestCheckpointId: zod_1.z.string().optional(),
69
76
  latestCheckpointProgress: zod_1.z.number().optional(),
70
- updatedAtISO: zod_1.z.string().datetime(),
77
+ updatedAtISO: zod_1.z.iso.datetime(),
71
78
  });
72
79
  exports.tutorialInputSignalTypeSchema = zod_1.z.enum([Tutorial_const_1.TUTORIAL_INPUT_SIGNAL_TYPE.STEERING_WHEEL_BUTTON_PRESSED]);
73
80
  exports.tutorialKartEventBaseSchema = zod_1.z.object({
@@ -75,11 +82,11 @@ exports.tutorialKartEventBaseSchema = zod_1.z.object({
75
82
  deviceId: zod_1.z.string().min(1),
76
83
  revision: zod_1.z.number().int().nonnegative(),
77
84
  sequence: zod_1.z.number().int().nonnegative(),
78
- originTimestampISO: zod_1.z.string().datetime(),
85
+ originTimestampISO: zod_1.z.iso.datetime(),
79
86
  });
80
87
  exports.tutorialSteeringWheelButtonPressedSchema = exports.tutorialKartEventBaseSchema.extend({
81
88
  type: zod_1.z.literal(Tutorial_const_1.TUTORIAL_INPUT_SIGNAL_TYPE.STEERING_WHEEL_BUTTON_PRESSED),
82
- button: exports.tutorialSteeringWheelButtonSchema,
89
+ button: exports.tutorialInputButtonSchema,
83
90
  });
84
91
  exports.tutorialInputSignalSchema = zod_1.z.discriminatedUnion('type', [exports.tutorialSteeringWheelButtonPressedSchema]);
85
92
  exports.tutorialConfigurationSchema = zod_1.z.object({
@@ -89,7 +96,7 @@ exports.tutorialConfigurationSchema = zod_1.z.object({
89
96
  speedConfig: zod_1.z.number().int().min(20).max(100).optional(),
90
97
  });
91
98
  exports.tutorialParticipantSchema = zod_1.z.object({
92
- deviceId: zod_1.z.string().min(1),
99
+ kartGuid: zod_1.z.string().min(1),
93
100
  playerId: zod_1.z.string().optional(),
94
101
  status: exports.tutorialStatusSchema,
95
102
  currentPhaseId: exports.tutorialPhaseIdSchema,
@@ -108,31 +115,22 @@ exports.tutorialParticipantSchema = zod_1.z.object({
108
115
  })
109
116
  .optional(),
110
117
  totalDurationSeconds: zod_1.z.number().int().default(180),
111
- startedAtISO: zod_1.z.string().optional(),
112
- updatedAtISO: zod_1.z.string(),
118
+ startedAtISO: zod_1.z.iso.datetime().optional(),
119
+ updatedAtISO: zod_1.z.iso.datetime(),
113
120
  });
114
121
  exports.tutorialSessionSchema = zod_1.z.object({
115
122
  id: zod_1.z.string().min(1),
116
123
  gameTurnId: zod_1.z.string().optional(),
117
- gameId: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
124
+ gameId: zod_1.z.number().int(),
125
+ gameType: Game_schema_1.gameTypeSchema,
118
126
  status: exports.tutorialStatusSchema,
119
127
  participants: zod_1.z.array(exports.tutorialParticipantSchema),
120
- createdAtISO: zod_1.z.string(),
121
- updatedAtISO: zod_1.z.string(),
128
+ createdAtISO: zod_1.z.iso.datetime(),
129
+ updatedAtISO: zod_1.z.iso.datetime(),
122
130
  });
123
- exports.startOperatorTutorialSchema = zod_1.z.object({
124
- gameId: zod_1.z.number().int(),
125
- gameType: zod_1.z.enum(['Race', 'Battle']),
131
+ const startTutorialOptionsSchema = zod_1.z.object({
126
132
  tutorialConfigId: zod_1.z.string().optional().default('BR_TUTORIAL_DEFAULT'),
127
- params: zod_1.z.object({
128
- laps: zod_1.z.number().int().optional(),
129
- lives: zod_1.z.number().int().optional(),
130
- coins: zod_1.z.number().int().min(0).max(254),
131
- kartsGuids: zod_1.z.array(zod_1.z.string()).min(1),
132
- powerUpsIds: zod_1.z.array(zod_1.z.string()).min(1),
133
- time: zod_1.z.number().int().min(30).max(1200),
134
- speedConfig: zod_1.z.number().int().min(20).max(100),
135
- playerKartMap: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
136
- }),
137
133
  tutorialParams: exports.tutorialConfigurationSchema.optional(),
138
134
  });
135
+ exports.startRaceTutorialSchema = Race_schema_1.startRaceSchema.extend(startTutorialOptionsSchema.shape);
136
+ exports.startBattleTutorialSchema = Battle_schema_1.startBattleSchema.extend(startTutorialOptionsSchema.shape);
@@ -1,10 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { tutorialInputSignalSchema, tutorialInputSignalTypeSchema, tutorialKartSnapshotSchema, tutorialListenEventOnSchema, tutorialCheckpointTargetSchema, tutorialPhaseIdSchema, tutorialScreenStepSchema, tutorialStatusSchema, tutorialSteeringWheelButtonPressedSchema, tutorialSteeringWheelButtonSchema, tutorialConfigurationSchema, tutorialParticipantSchema, tutorialSessionSchema, startOperatorTutorialSchema } from './Tutorial.schema';
2
+ import { tutorialInputSignalSchema, tutorialInputSignalTypeSchema, tutorialKartSnapshotSchema, tutorialListenEventOnSchema, tutorialCheckpointTargetSchema, tutorialPhaseIdSchema, tutorialScreenStepSchema, tutorialStatusSchema, tutorialSteeringWheelButtonPressedSchema, tutorialSteeringWheelButtonSchema, tutorialInputButtonSchema, tutorialConfigurationSchema, tutorialParticipantSchema, tutorialSessionSchema, startRaceTutorialSchema, startBattleTutorialSchema } from './Tutorial.schema';
3
3
  export type TutorialScreenStep = z.infer<typeof tutorialScreenStepSchema>;
4
4
  export type TutorialStatus = z.infer<typeof tutorialStatusSchema>;
5
5
  export type TutorialPhaseId = z.infer<typeof tutorialPhaseIdSchema>;
6
6
  export type TutorialListenEventOn = z.infer<typeof tutorialListenEventOnSchema>;
7
7
  export type TutorialSteeringWheelButton = z.infer<typeof tutorialSteeringWheelButtonSchema>;
8
+ export type TutorialInputButton = z.infer<typeof tutorialInputButtonSchema>;
8
9
  export type TutorialCheckpointTarget = z.infer<typeof tutorialCheckpointTargetSchema>;
9
10
  export type TutorialKartSnapshot = z.infer<typeof tutorialKartSnapshotSchema>;
10
11
  export type TutorialInputSignalType = z.infer<typeof tutorialInputSignalTypeSchema>;
@@ -13,4 +14,5 @@ export type TutorialInputSignal = z.infer<typeof tutorialInputSignalSchema>;
13
14
  export type TutorialConfiguration = z.infer<typeof tutorialConfigurationSchema>;
14
15
  export type TutorialParticipant = z.infer<typeof tutorialParticipantSchema>;
15
16
  export type TutorialSession = z.infer<typeof tutorialSessionSchema>;
16
- export type StartOperatorTutorial = z.infer<typeof startOperatorTutorialSchema>;
17
+ export type StartRaceTutorial = z.infer<typeof startRaceTutorialSchema>;
18
+ export type StartBattleTutorial = z.infer<typeof startBattleTutorialSchema>;
@@ -367,8 +367,8 @@ export declare const tutorialStepConfigSchema: z.ZodObject<{
367
367
  module: z.ZodLiteral<"speed">;
368
368
  action: z.ZodLiteral<"configure">;
369
369
  params: z.ZodObject<{
370
- defaultSpeed: z.ZodNumber;
371
- timeDuration: z.ZodNumber;
370
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
371
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
372
372
  }, z.core.$strip>;
373
373
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
374
374
  module: z.ZodLiteral<"leftStarBackLaser">;
@@ -1067,6 +1067,7 @@ export declare const tutorialStepConfigSchema: z.ZodObject<{
1067
1067
  }, z.core.$strip>]>]>, z.ZodObject<{
1068
1068
  params: z.ZodOptional<z.ZodUnknown>;
1069
1069
  }, z.core.$strip>>>;
1070
+ executePowerUpId: z.ZodOptional<z.ZodString>;
1070
1071
  }, z.core.$strip>;
1071
1072
  export declare const tutorialPhaseConfigSchema: z.ZodObject<{
1072
1073
  id: z.ZodEnum<{
@@ -1405,8 +1406,8 @@ export declare const tutorialPhaseConfigSchema: z.ZodObject<{
1405
1406
  module: z.ZodLiteral<"speed">;
1406
1407
  action: z.ZodLiteral<"configure">;
1407
1408
  params: z.ZodObject<{
1408
- defaultSpeed: z.ZodNumber;
1409
- timeDuration: z.ZodNumber;
1409
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
1410
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
1410
1411
  }, z.core.$strip>;
1411
1412
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
1412
1413
  module: z.ZodLiteral<"leftStarBackLaser">;
@@ -2105,6 +2106,7 @@ export declare const tutorialPhaseConfigSchema: z.ZodObject<{
2105
2106
  }, z.core.$strip>]>]>, z.ZodObject<{
2106
2107
  params: z.ZodOptional<z.ZodUnknown>;
2107
2108
  }, z.core.$strip>>>;
2109
+ executePowerUpId: z.ZodOptional<z.ZodString>;
2108
2110
  }, z.core.$strip>>;
2109
2111
  }, z.core.$strip>;
2110
2112
  export declare const tutorialMasterConfigSchema: z.ZodObject<{
@@ -2447,8 +2449,8 @@ export declare const tutorialMasterConfigSchema: z.ZodObject<{
2447
2449
  module: z.ZodLiteral<"speed">;
2448
2450
  action: z.ZodLiteral<"configure">;
2449
2451
  params: z.ZodObject<{
2450
- defaultSpeed: z.ZodNumber;
2451
- timeDuration: z.ZodNumber;
2452
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
2453
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
2452
2454
  }, z.core.$strip>;
2453
2455
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
2454
2456
  module: z.ZodLiteral<"leftStarBackLaser">;
@@ -3147,6 +3149,7 @@ export declare const tutorialMasterConfigSchema: z.ZodObject<{
3147
3149
  }, z.core.$strip>]>]>, z.ZodObject<{
3148
3150
  params: z.ZodOptional<z.ZodUnknown>;
3149
3151
  }, z.core.$strip>>>;
3152
+ executePowerUpId: z.ZodOptional<z.ZodString>;
3150
3153
  }, z.core.$strip>>;
3151
3154
  }, z.core.$strip>>;
3152
3155
  }, z.core.$strip>;
@@ -29,6 +29,7 @@ exports.tutorialStepConfigSchema = zod_1.z.object({
29
29
  screenStep: Tutorial_schema_1.tutorialScreenStepSchema,
30
30
  listenEvent: exports.tutorialListenEventSchema,
31
31
  triggerCommands: zod_1.z.array(Command_schema_1.allCommandsConfigSchema),
32
+ executePowerUpId: zod_1.z.string().optional(),
32
33
  });
33
34
  exports.tutorialPhaseConfigSchema = zod_1.z.object({
34
35
  id: Tutorial_schema_1.tutorialPhaseIdSchema,
@@ -9,6 +9,8 @@ export declare const simpleArithmeticStringSchema: z.ZodString;
9
9
  export declare const kartContextVariableSchema: z.ZodEnum<{
10
10
  "$kart.configuredSpeed": "$kart.configuredSpeed";
11
11
  "$kart.powerUpTime": "$kart.powerUpTime";
12
+ "$kart.tutorialSpeed": "$kart.tutorialSpeed";
13
+ "$kart.tutorialReturnSpeed": "$kart.tutorialReturnSpeed";
12
14
  }>;
13
15
  export declare const contextArithmeticStringSchema: z.ZodString;
14
16
  export declare const arithmeticExpressionSchema: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>;
@@ -5,9 +5,14 @@ const zod_1 = require("zod");
5
5
  exports.arithmeticOperatorSchema = zod_1.z.enum(['+', '-', '*', '/']);
6
6
  // Regex for SimpleArithmeticString: check for operator followed by numbers
7
7
  exports.simpleArithmeticStringSchema = zod_1.z.string().regex(/^[\+\-\*\/]-?\d+(\.\d+)?$/);
8
- // Regex for ContextArithmeticString: $variable operator number
9
- exports.kartContextVariableSchema = zod_1.z.enum(['$kart.configuredSpeed', '$kart.powerUpTime']);
10
- exports.contextArithmeticStringSchema = zod_1.z.string().regex(/^\$[a-zA-Z0-9\.]+\s[\+\-\*\/]\s-?\d+(\.\d+)?$/);
8
+ // Regex for ContextArithmeticString: $variable, optionally followed by operator number
9
+ exports.kartContextVariableSchema = zod_1.z.enum([
10
+ '$kart.configuredSpeed',
11
+ '$kart.powerUpTime',
12
+ '$kart.tutorialSpeed',
13
+ '$kart.tutorialReturnSpeed',
14
+ ]);
15
+ exports.contextArithmeticStringSchema = zod_1.z.string().regex(/^\$[a-zA-Z0-9\.]+(\s[\+\-\*\/]\s-?\d+(\.\d+)?)?$/);
11
16
  exports.arithmeticExpressionSchema = zod_1.z.union([
12
17
  zod_1.z.number(),
13
18
  exports.simpleArithmeticStringSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@battle-racing/br-common-lib",
3
- "version": "6.2.0-rc.8",
3
+ "version": "6.2.0-rc.9",
4
4
  "description": "Common library for all Battle Racing Repositorios",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,4 +1,5 @@
1
1
  import {
2
+ AllCommandsConfig,
2
3
  POWER_UP_NAME,
3
4
  SOUND_NAME,
4
5
  ScreenTutorialHud,
@@ -24,6 +25,26 @@ const nitroTutorialHud: ScreenTutorialHud = {
24
25
  powerUp: POWER_UP_NAME.BATTLE_NITRO,
25
26
  };
26
27
 
28
+ const startDrivingCommands: AllCommandsConfig[] = [
29
+ { module: 'speed', action: 'activate' },
30
+ { module: 'speed', action: 'change', params: { speed: '$kart.tutorialSpeed', forUnlimitedTime: true } },
31
+ ];
32
+
33
+ const stopKartCommands: AllCommandsConfig[] = [
34
+ { module: 'speed', action: 'change', params: { speed: 0, forUnlimitedTime: true } },
35
+ { module: 'speed', action: 'deactivate' },
36
+ ];
37
+
38
+ // The step fires the nitro, after it ends the speed module goes back to its default speed
39
+ const returnToFinishCommands: AllCommandsConfig[] = [
40
+ {
41
+ module: 'speed',
42
+ action: 'configure',
43
+ params: { defaultSpeed: '$kart.tutorialReturnSpeed', timeDuration: '$kart.powerUpTime' },
44
+ },
45
+ { module: 'speed', action: 'activate' },
46
+ ];
47
+
27
48
  export const allTutorialConfig: TutorialMasterConfig = {
28
49
  id: 'tutorial-master-v1',
29
50
  name: 'Standard Circuit Induction Tutorial',
@@ -43,6 +64,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
43
64
  durationMs: 5000,
44
65
  },
45
66
  triggerCommands: [
67
+ ...stopKartCommands,
46
68
  {
47
69
  module: 'screen',
48
70
  action: 'showTutorialView',
@@ -62,6 +84,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
62
84
  durationMs: 6000,
63
85
  },
64
86
  triggerCommands: [
87
+ ...stopKartCommands,
65
88
  {
66
89
  module: 'screen',
67
90
  action: 'showTutorialView',
@@ -88,6 +111,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
88
111
  durationMs: 4000,
89
112
  },
90
113
  triggerCommands: [
114
+ ...stopKartCommands,
91
115
  {
92
116
  module: 'screen',
93
117
  action: 'showTutorialView',
@@ -107,6 +131,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
107
131
  durationMs: 5000,
108
132
  },
109
133
  triggerCommands: [
134
+ ...stopKartCommands,
110
135
  {
111
136
  module: 'screen',
112
137
  action: 'showTutorialView',
@@ -126,6 +151,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
126
151
  durationMs: 6000,
127
152
  },
128
153
  triggerCommands: [
154
+ ...startDrivingCommands,
129
155
  {
130
156
  module: 'screen',
131
157
  action: 'showTutorialView',
@@ -152,6 +178,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
152
178
  target: TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
153
179
  },
154
180
  triggerCommands: [
181
+ ...startDrivingCommands,
155
182
  {
156
183
  module: 'screen',
157
184
  action: 'showTutorialView',
@@ -179,6 +206,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
179
206
  button: TUTORIAL_STEERING_WHEEL_BUTTON.RIGHT,
180
207
  },
181
208
  triggerCommands: [
209
+ ...stopKartCommands,
182
210
  {
183
211
  module: 'screen',
184
212
  action: 'showTutorialView',
@@ -198,6 +226,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
198
226
  button: TUTORIAL_STEERING_WHEEL_BUTTON.LEFT,
199
227
  },
200
228
  triggerCommands: [
229
+ ...stopKartCommands,
201
230
  {
202
231
  module: 'screen',
203
232
  action: 'showTutorialView',
@@ -217,6 +246,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
217
246
  durationMs: 4000,
218
247
  },
219
248
  triggerCommands: [
249
+ ...stopKartCommands,
220
250
  {
221
251
  module: 'screen',
222
252
  action: 'showTutorialView',
@@ -236,6 +266,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
236
266
  target: TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
237
267
  },
238
268
  triggerCommands: [
269
+ ...startDrivingCommands,
239
270
  {
240
271
  module: 'screen',
241
272
  action: 'showTutorialView',
@@ -256,6 +287,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
256
287
  button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
257
288
  },
258
289
  triggerCommands: [
290
+ ...stopKartCommands,
259
291
  {
260
292
  module: 'screen',
261
293
  action: 'showTutorialView',
@@ -276,6 +308,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
276
308
  button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
277
309
  },
278
310
  triggerCommands: [
311
+ ...stopKartCommands,
279
312
  {
280
313
  module: 'screen',
281
314
  action: 'showTutorialView',
@@ -296,6 +329,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
296
329
  button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
297
330
  },
298
331
  triggerCommands: [
332
+ ...stopKartCommands,
299
333
  {
300
334
  module: 'screen',
301
335
  action: 'showTutorialView',
@@ -316,6 +350,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
316
350
  button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
317
351
  },
318
352
  triggerCommands: [
353
+ ...stopKartCommands,
319
354
  {
320
355
  module: 'screen',
321
356
  action: 'showTutorialView',
@@ -343,6 +378,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
343
378
  target: TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
344
379
  },
345
380
  triggerCommands: [
381
+ ...startDrivingCommands,
346
382
  {
347
383
  module: 'screen',
348
384
  action: 'showTutorialView',
@@ -363,6 +399,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
363
399
  button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
364
400
  },
365
401
  triggerCommands: [
402
+ ...stopKartCommands,
366
403
  {
367
404
  module: 'screen',
368
405
  action: 'showTutorialView',
@@ -383,6 +420,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
383
420
  button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
384
421
  },
385
422
  triggerCommands: [
423
+ ...startDrivingCommands,
386
424
  {
387
425
  module: 'screen',
388
426
  action: 'showTutorialView',
@@ -398,11 +436,13 @@ export const allTutorialConfig: TutorialMasterConfig = {
398
436
  index: 3,
399
437
  name: 'Nitro Fired - Return to HUD',
400
438
  screenStep: TUTORIAL_SCREEN_STEP.POWER_UP_RETURN_TO_HUD,
439
+ executePowerUpId: 'battle-nitro',
401
440
  listenEvent: {
402
441
  on: TUTORIAL_LISTEN_EVENT_ON.CHECKPOINT,
403
442
  target: TUTORIAL_CHECKPOINT_TARGET.FINISH,
404
443
  },
405
444
  triggerCommands: [
445
+ ...returnToFinishCommands,
406
446
  {
407
447
  module: 'screen',
408
448
  action: 'showTutorialView',
@@ -430,6 +470,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
430
470
  durationMs: 5000,
431
471
  },
432
472
  triggerCommands: [
473
+ ...stopKartCommands,
433
474
  {
434
475
  module: 'screen',
435
476
  action: 'showTutorialView',
@@ -14,7 +14,6 @@ import {
14
14
  showLightsColorParamsSchema,
15
15
  showLightsEffectParamsSchema,
16
16
  speedChangeOptionsSchema,
17
- speedConfigurationSchema,
18
17
  starLaserConfigureModuleOptionsSchema,
19
18
  starLaserSendActionsOptionsSchema,
20
19
  } from '../hardware';
@@ -28,11 +27,20 @@ export const changeSpeedActionCommandOptionsSchema = speedChangeOptionsSchema.om
28
27
  speed: arithmeticOrNumberSchema,
29
28
  });
30
29
 
30
+ export const configureSpeedActionCommandOptionsSchema = z.object({
31
+ defaultSpeed: arithmeticOrNumberSchema,
32
+ timeDuration: arithmeticOrNumberSchema,
33
+ });
34
+
31
35
  export const speedModuleCommandSchema = z.union([
32
36
  z.object({ module: z.literal('speed'), action: z.literal('activate') }),
33
37
  z.object({ module: z.literal('speed'), action: z.literal('deactivate') }),
34
38
  z.object({ module: z.literal('speed'), action: z.literal('change'), params: changeSpeedActionCommandOptionsSchema }),
35
- z.object({ module: z.literal('speed'), action: z.literal('configure'), params: speedConfigurationSchema }),
39
+ z.object({
40
+ module: z.literal('speed'),
41
+ action: z.literal('configure'),
42
+ params: configureSpeedActionCommandOptionsSchema,
43
+ }),
36
44
  ]);
37
45
 
38
46
  // --- Sound Commands ---
@@ -38,7 +38,7 @@ export const gameSchema = z.object({
38
38
  finishedReason: gameFinishedReasonSchema.optional(),
39
39
  kartsState: z.record(z.string(), gameKartStateSchema),
40
40
  gameRanking: z.array(kartRankingItemSchema),
41
- tutorialConfigId: z.string().optional(),
41
+ tutorialConfigId: z.string().nullable().optional(),
42
42
  });
43
43
 
44
44
  export const assignKartSchema = z.object({
@@ -30,5 +30,4 @@ export const createBattleSchema = z.object({
30
30
  gameTrackId: z.string(),
31
31
  gameTurnId: z.string().optional(),
32
32
  isOfficial: z.boolean().optional(),
33
- tutorialConfigId: z.string().optional(),
34
33
  });
@@ -80,5 +80,4 @@ export const createRaceSchema = startRaceSchema.partial().extend({
80
80
  gameTrackId: z.string(),
81
81
  gameTurnId: z.string().optional(),
82
82
  isOfficial: z.boolean().optional(),
83
- tutorialConfigId: z.string().optional(),
84
83
  });
@@ -20,6 +20,8 @@ export const gameTrackKartsConfigSchema = z.object({
20
20
  diskSensorBallShooter: configDiskSensorBallShooterModuleOptionsSchema,
21
21
  ballSensorDiskThrower: configureBallSensorDiskThrowerModuleOptionsSchema,
22
22
  lowSpeed: z.number().min(0).max(100),
23
+ tutorialSpeed: z.number().min(0).max(100),
24
+ tutorialReturnSpeed: z.number().min(0).max(100),
23
25
  });
24
26
 
25
27
  export const gameTrackKartConfigSchema = z.object({
@@ -3,6 +3,7 @@ import type { GameTrack } from '../../gameTrack';
3
3
  import type { Kart } from '../../kart';
4
4
  import type { CheckpointEvent } from '../../kartTracking';
5
5
  import type { Response } from '../../response';
6
+ import type { TutorialSession } from '../../tutorial';
6
7
  import type { MacAddressGameTrackConnections } from '../inputs';
7
8
  import type { SocketHardwareOnDataEventsParams } from '../SocketHardwareOnDataEventsParams';
8
9
 
@@ -19,6 +20,7 @@ export interface SocketWebAppServerToClientEventsParams {
19
20
  checkpointEvent: CheckpointEvent;
20
21
  };
21
22
  'game:changed': { game: Game };
23
+ 'tutorial:session:changed': { session: TutorialSession };
22
24
  'gameTracks:onGameTrackUpdated': GameTrack[];
23
25
  'gameTracks:connectedRasperries': { macAddress: string }[];
24
26
  'gameTracks:list:response': Response<MacAddressGameTrackConnections>;
@@ -61,19 +61,3 @@ export const TUTORIAL_CHECKPOINT_TARGET = {
61
61
  export const TUTORIAL_INPUT_SIGNAL_TYPE = {
62
62
  STEERING_WHEEL_BUTTON_PRESSED: 'SteeringWheelButtonPressed',
63
63
  } as const;
64
-
65
- export const DRIVING_TUTORIAL_STEPS = [
66
- TUTORIAL_SCREEN_STEP.PEDAL,
67
- TUTORIAL_SCREEN_STEP.DRIVE_TO_CONTROLS,
68
- TUTORIAL_SCREEN_STEP.HUD_OVERVIEW,
69
- TUTORIAL_SCREEN_STEP.POWER_UP_WAITING,
70
- TUTORIAL_SCREEN_STEP.POWER_UP_NITRO_READY,
71
- TUTORIAL_SCREEN_STEP.POWER_UP_RETURN_TO_HUD,
72
- ] as const;
73
-
74
- export const isDrivingTutorialStep = (step?: string | null): boolean => {
75
- if (!step) {
76
- return false;
77
- }
78
- return (DRIVING_TUTORIAL_STEPS as readonly string[]).includes(step);
79
- };
@@ -1,4 +1,7 @@
1
1
  import { z } from 'zod';
2
+ import { startBattleSchema } from '../game/battle/Battle.schema';
3
+ import { gameTypeSchema } from '../game/Game.schema';
4
+ import { startRaceSchema } from '../game/race/Race.schema';
2
5
  import { screenTutorialHudSchema } from '../hardware/screen/ScreenTutorial.schema';
3
6
  import {
4
7
  TUTORIAL_INPUT_SIGNAL_TYPE,
@@ -59,6 +62,11 @@ export const tutorialSteeringWheelButtonSchema = z.enum([
59
62
  TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
60
63
  ]);
61
64
 
65
+ export const tutorialInputButtonSchema = z.enum([
66
+ TUTORIAL_STEERING_WHEEL_BUTTON.RIGHT,
67
+ TUTORIAL_STEERING_WHEEL_BUTTON.LEFT,
68
+ ]);
69
+
62
70
  export const tutorialCheckpointTargetSchema = z.enum([
63
71
  TUTORIAL_CHECKPOINT_TARGET.TRACK,
64
72
  TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
@@ -79,7 +87,7 @@ export const tutorialKartSnapshotSchema = z.object({
79
87
  awaitingCheckpointTarget: tutorialCheckpointTargetSchema.nullable().optional(),
80
88
  latestCheckpointId: z.string().optional(),
81
89
  latestCheckpointProgress: z.number().optional(),
82
- updatedAtISO: z.string().datetime(),
90
+ updatedAtISO: z.iso.datetime(),
83
91
  });
84
92
 
85
93
  export const tutorialInputSignalTypeSchema = z.enum([TUTORIAL_INPUT_SIGNAL_TYPE.STEERING_WHEEL_BUTTON_PRESSED]);
@@ -89,12 +97,12 @@ export const tutorialKartEventBaseSchema = z.object({
89
97
  deviceId: z.string().min(1),
90
98
  revision: z.number().int().nonnegative(),
91
99
  sequence: z.number().int().nonnegative(),
92
- originTimestampISO: z.string().datetime(),
100
+ originTimestampISO: z.iso.datetime(),
93
101
  });
94
102
 
95
103
  export const tutorialSteeringWheelButtonPressedSchema = tutorialKartEventBaseSchema.extend({
96
104
  type: z.literal(TUTORIAL_INPUT_SIGNAL_TYPE.STEERING_WHEEL_BUTTON_PRESSED),
97
- button: tutorialSteeringWheelButtonSchema,
105
+ button: tutorialInputButtonSchema,
98
106
  });
99
107
 
100
108
  export const tutorialInputSignalSchema = z.discriminatedUnion('type', [tutorialSteeringWheelButtonPressedSchema]);
@@ -107,7 +115,7 @@ export const tutorialConfigurationSchema = z.object({
107
115
  });
108
116
 
109
117
  export const tutorialParticipantSchema = z.object({
110
- deviceId: z.string().min(1),
118
+ kartGuid: z.string().min(1),
111
119
  playerId: z.string().optional(),
112
120
  status: tutorialStatusSchema,
113
121
  currentPhaseId: tutorialPhaseIdSchema,
@@ -126,34 +134,26 @@ export const tutorialParticipantSchema = z.object({
126
134
  })
127
135
  .optional(),
128
136
  totalDurationSeconds: z.number().int().default(180),
129
- startedAtISO: z.string().optional(),
130
- updatedAtISO: z.string(),
137
+ startedAtISO: z.iso.datetime().optional(),
138
+ updatedAtISO: z.iso.datetime(),
131
139
  });
132
140
 
133
141
  export const tutorialSessionSchema = z.object({
134
142
  id: z.string().min(1),
135
143
  gameTurnId: z.string().optional(),
136
- gameId: z.union([z.string(), z.number()]).optional(),
144
+ gameId: z.number().int(),
145
+ gameType: gameTypeSchema,
137
146
  status: tutorialStatusSchema,
138
147
  participants: z.array(tutorialParticipantSchema),
139
- createdAtISO: z.string(),
140
- updatedAtISO: z.string(),
148
+ createdAtISO: z.iso.datetime(),
149
+ updatedAtISO: z.iso.datetime(),
141
150
  });
142
151
 
143
- export const startOperatorTutorialSchema = z.object({
144
- gameId: z.number().int(),
145
- gameType: z.enum(['Race', 'Battle']),
152
+ const startTutorialOptionsSchema = z.object({
146
153
  tutorialConfigId: z.string().optional().default('BR_TUTORIAL_DEFAULT'),
147
- params: z.object({
148
- laps: z.number().int().optional(),
149
- lives: z.number().int().optional(),
150
- coins: z.number().int().min(0).max(254),
151
- kartsGuids: z.array(z.string()).min(1),
152
- powerUpsIds: z.array(z.string()).min(1),
153
- time: z.number().int().min(30).max(1200),
154
- speedConfig: z.number().int().min(20).max(100),
155
- playerKartMap: z.record(z.string(), z.string()).optional(),
156
- }),
157
154
  tutorialParams: tutorialConfigurationSchema.optional(),
158
155
  });
159
156
 
157
+ export const startRaceTutorialSchema = startRaceSchema.extend(startTutorialOptionsSchema.shape);
158
+
159
+ export const startBattleTutorialSchema = startBattleSchema.extend(startTutorialOptionsSchema.shape);
@@ -10,10 +10,12 @@ import {
10
10
  tutorialStatusSchema,
11
11
  tutorialSteeringWheelButtonPressedSchema,
12
12
  tutorialSteeringWheelButtonSchema,
13
+ tutorialInputButtonSchema,
13
14
  tutorialConfigurationSchema,
14
15
  tutorialParticipantSchema,
15
16
  tutorialSessionSchema,
16
- startOperatorTutorialSchema,
17
+ startRaceTutorialSchema,
18
+ startBattleTutorialSchema,
17
19
  } from './Tutorial.schema';
18
20
 
19
21
  export type TutorialScreenStep = z.infer<typeof tutorialScreenStepSchema>;
@@ -21,6 +23,7 @@ export type TutorialStatus = z.infer<typeof tutorialStatusSchema>;
21
23
  export type TutorialPhaseId = z.infer<typeof tutorialPhaseIdSchema>;
22
24
  export type TutorialListenEventOn = z.infer<typeof tutorialListenEventOnSchema>;
23
25
  export type TutorialSteeringWheelButton = z.infer<typeof tutorialSteeringWheelButtonSchema>;
26
+ export type TutorialInputButton = z.infer<typeof tutorialInputButtonSchema>;
24
27
  export type TutorialCheckpointTarget = z.infer<typeof tutorialCheckpointTargetSchema>;
25
28
  export type TutorialKartSnapshot = z.infer<typeof tutorialKartSnapshotSchema>;
26
29
  export type TutorialInputSignalType = z.infer<typeof tutorialInputSignalTypeSchema>;
@@ -29,5 +32,5 @@ export type TutorialInputSignal = z.infer<typeof tutorialInputSignalSchema>;
29
32
  export type TutorialConfiguration = z.infer<typeof tutorialConfigurationSchema>;
30
33
  export type TutorialParticipant = z.infer<typeof tutorialParticipantSchema>;
31
34
  export type TutorialSession = z.infer<typeof tutorialSessionSchema>;
32
- export type StartOperatorTutorial = z.infer<typeof startOperatorTutorialSchema>;
33
-
35
+ export type StartRaceTutorial = z.infer<typeof startRaceTutorialSchema>;
36
+ export type StartBattleTutorial = z.infer<typeof startBattleTutorialSchema>;
@@ -36,6 +36,7 @@ export const tutorialStepConfigSchema = z.object({
36
36
  screenStep: tutorialScreenStepSchema,
37
37
  listenEvent: tutorialListenEventSchema,
38
38
  triggerCommands: z.array(allCommandsConfigSchema),
39
+ executePowerUpId: z.string().optional(),
39
40
  });
40
41
 
41
42
  export const tutorialPhaseConfigSchema = z.object({
@@ -5,10 +5,15 @@ export const arithmeticOperatorSchema = z.enum(['+', '-', '*', '/']);
5
5
  // Regex for SimpleArithmeticString: check for operator followed by numbers
6
6
  export const simpleArithmeticStringSchema = z.string().regex(/^[\+\-\*\/]-?\d+(\.\d+)?$/);
7
7
 
8
- // Regex for ContextArithmeticString: $variable operator number
9
- export const kartContextVariableSchema = z.enum(['$kart.configuredSpeed', '$kart.powerUpTime']);
8
+ // Regex for ContextArithmeticString: $variable, optionally followed by operator number
9
+ export const kartContextVariableSchema = z.enum([
10
+ '$kart.configuredSpeed',
11
+ '$kart.powerUpTime',
12
+ '$kart.tutorialSpeed',
13
+ '$kart.tutorialReturnSpeed',
14
+ ]);
10
15
 
11
- export const contextArithmeticStringSchema = z.string().regex(/^\$[a-zA-Z0-9\.]+\s[\+\-\*\/]\s-?\d+(\.\d+)?$/);
16
+ export const contextArithmeticStringSchema = z.string().regex(/^\$[a-zA-Z0-9\.]+(\s[\+\-\*\/]\s-?\d+(\.\d+)?)?$/);
12
17
 
13
18
  export const arithmeticExpressionSchema = z.union([
14
19
  z.number(),