@battle-racing/br-common-lib 2.5.0 → 3.1.0

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.
@@ -1,6 +1,9 @@
1
1
  import type { ColorName } from '../color';
2
+ import type { DamageEffectName } from '../damage';
2
3
  import type { GameType } from '../game';
3
4
  import type { GameTrack } from '../gameTrack';
5
+ import type { KartHardwareState } from '../hardware';
6
+ import type { PowerUpName } from '../powerUp';
4
7
  import type { KartShield } from './KartShield';
5
8
  import type { KartStatus } from './KartStatus';
6
9
  interface KartGame {
@@ -26,5 +29,8 @@ export interface Kart {
26
29
  * In testing Mode, the kart should be listening to the hardware status
27
30
  */
28
31
  isSubscribedToHardwareStatus: boolean;
32
+ hardwareState?: KartHardwareState | null;
33
+ currentPowerUp?: PowerUpName | null;
34
+ currentDamage?: DamageEffectName | null;
29
35
  }
30
36
  export {};
@@ -1,3 +1,3 @@
1
1
  import type { ErrorResponse } from './ErrorResponse';
2
- import type { SuccesResponse } from './SuccesResponse';
3
- export type Response<T> = SuccesResponse<T> | ErrorResponse;
2
+ import type { SuccessResponse } from './SuccessResponse';
3
+ export type Response<T> = SuccessResponse<T> | ErrorResponse;
@@ -1,4 +1,4 @@
1
- export interface SuccesResponse<T> {
1
+ export interface SuccessResponse<T> {
2
2
  status: 'success';
3
3
  code: 200;
4
4
  data?: T;
@@ -0,0 +1,5 @@
1
+ export interface SuccessResponse<T> {
2
+ status: 'success';
3
+ code: 200;
4
+ data?: T;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,3 @@
1
1
  export type { ErrorResponse } from './ErrorResponse';
2
- export type { SuccesResponse } from './SuccesResponse';
2
+ export type { SuccessResponse } from './SuccessResponse';
3
3
  export type { Response } from './Response';
@@ -14,7 +14,10 @@ export interface SocketKartEventsParams {
14
14
  'kart:updated': {
15
15
  kart: Kart;
16
16
  };
17
- 'kart:init:response': Response<Kart>;
17
+ 'kart:init:response': Response<{
18
+ kart: Kart;
19
+ gameTrack: GameTrack;
20
+ }>;
18
21
  /** Whenever the Game Track config changed */
19
22
  'kart:gameTrack:updated': {
20
23
  gameTrack: GameTrack;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@battle-racing/br-common-lib",
3
- "version": "2.5.0",
3
+ "version": "3.1.0",
4
4
  "description": "Common library for all Battle Racing Repositorios",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,6 +1,9 @@
1
1
  import type { ColorName } from '../color';
2
+ import type { DamageEffectName } from '../damage';
2
3
  import type { GameType } from '../game';
3
4
  import type { GameTrack } from '../gameTrack';
5
+ import type { KartHardwareState } from '../hardware';
6
+ import type { PowerUpName } from '../powerUp';
4
7
  import type { KartShield } from './KartShield';
5
8
  import type { KartStatus } from './KartStatus';
6
9
 
@@ -19,7 +22,7 @@ export interface Kart {
19
22
  isConnected: boolean;
20
23
  status: KartStatus;
21
24
  shield: KartShield;
22
- // If a Kart is not assigned to a game, the default gane track should be "TEST"
25
+ // If a Kart is not assigned to a game, the default game track should be "TEST"
23
26
  gameTrackId: GameTrack['id'];
24
27
  color: ColorName;
25
28
  number: number;
@@ -29,4 +32,7 @@ export interface Kart {
29
32
  * In testing Mode, the kart should be listening to the hardware status
30
33
  */
31
34
  isSubscribedToHardwareStatus: boolean;
35
+ hardwareState?: KartHardwareState | null;
36
+ currentPowerUp?: PowerUpName | null;
37
+ currentDamage?: DamageEffectName | null;
32
38
  }
@@ -1,4 +1,4 @@
1
1
  import type { ErrorResponse } from './ErrorResponse';
2
- import type { SuccesResponse } from './SuccesResponse';
2
+ import type { SuccessResponse } from './SuccessResponse';
3
3
 
4
- export type Response<T> = SuccesResponse<T> | ErrorResponse;
4
+ export type Response<T> = SuccessResponse<T> | ErrorResponse;
@@ -1,4 +1,4 @@
1
- export interface SuccesResponse<T> {
1
+ export interface SuccessResponse<T> {
2
2
  status: 'success';
3
3
  code: 200;
4
4
  data?: T;
@@ -1,3 +1,3 @@
1
1
  export type { ErrorResponse } from './ErrorResponse';
2
- export type { SuccesResponse } from './SuccesResponse';
2
+ export type { SuccessResponse } from './SuccessResponse';
3
3
  export type { Response } from './Response';
@@ -17,7 +17,7 @@ export type SocketKartPowerUpEventsParams = {
17
17
  export interface SocketKartEventsParams {
18
18
  'kart:updated': { kart: Kart };
19
19
  // Response from server
20
- 'kart:init:response': Response<Kart>;
20
+ 'kart:init:response': Response<{ kart: Kart; gameTrack: GameTrack }>;
21
21
  /** Whenever the Game Track config changed */
22
22
  'kart:gameTrack:updated': { gameTrack: GameTrack };
23
23
  /** When the physical button of the game track is pressed */