@battle-racing/br-common-lib 1.5.1 → 2.0.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.
- package/dist/constants/hardware/damage.d.ts +9 -0
- package/dist/constants/hardware/damage.js +12 -0
- package/dist/constants/kart-status.d.ts +4 -0
- package/dist/constants/kart-status.js +5 -1
- package/dist/types/damage/DamageName.d.ts +3 -1
- package/dist/types/hardware/screen/ScreenBattleViewConfig.d.ts +2 -2
- package/dist/types/hardware/screen/ScreenFinishViewInput.d.ts +7 -4
- package/dist/types/hardware/screen/ScreenHomeViewInput.d.ts +3 -0
- package/dist/types/hardware/screen/ScreenHomeViewInput.js +2 -0
- package/dist/types/hardware/screen/ScreenRaceViewConfig.d.ts +2 -3
- package/dist/types/hardware/screen/ScreenViewBaseConfig.d.ts +8 -3
- package/dist/types/hardware/screen/index.d.ts +1 -2
- package/dist/types/hardware/screen/index.js +1 -2
- package/dist/types/socket/SocketHardwareModulesEventsParams.d.ts +2 -2
- package/dist/types/socket/serverToClient/SocketKartServerToClientEventsParams.d.ts +5 -1
- package/package.json +14 -2
- package/src/constants/hardware/damage.ts +9 -0
- package/src/constants/kart-status.ts +5 -0
- package/src/types/damage/DamageName.ts +4 -1
- package/src/types/hardware/screen/ScreenBattleViewConfig.ts +2 -2
- package/src/types/hardware/screen/ScreenFinishViewInput.ts +9 -4
- package/src/types/hardware/screen/ScreenHomeViewInput.ts +3 -0
- package/src/types/hardware/screen/ScreenRaceViewConfig.ts +2 -3
- package/src/types/hardware/screen/ScreenViewBaseConfig.ts +9 -3
- package/src/types/hardware/screen/index.ts +1 -2
- package/src/types/socket/SocketHardwareModulesEventsParams.ts +2 -1
- package/src/types/socket/serverToClient/SocketKartServerToClientEventsParams.ts +3 -1
- package/src/types/hardware/screen/ScreenKartPosition.ts +0 -4
- package/src/types/hardware/screen/ScreenRaceLaps.ts +0 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const DAMAGE_EFFECT: {
|
|
2
|
+
readonly GENERIC: "Generic";
|
|
3
|
+
readonly TRAP_HIT: "Trap Hit";
|
|
4
|
+
readonly PULSE_HIT: "Pulse Hit";
|
|
5
|
+
readonly STAR_HIT_LEFT: "Star Hit Left";
|
|
6
|
+
readonly STAR_HIT_RIGHT: "Star Hit Right";
|
|
7
|
+
readonly SHOT_HIT: "Shot Hit";
|
|
8
|
+
readonly SHORTCUT: "Shortcut";
|
|
9
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DAMAGE_EFFECT = void 0;
|
|
4
|
+
exports.DAMAGE_EFFECT = {
|
|
5
|
+
GENERIC: 'Generic',
|
|
6
|
+
TRAP_HIT: 'Trap Hit',
|
|
7
|
+
PULSE_HIT: 'Pulse Hit',
|
|
8
|
+
STAR_HIT_LEFT: 'Star Hit Left',
|
|
9
|
+
STAR_HIT_RIGHT: 'Star Hit Right',
|
|
10
|
+
SHOT_HIT: 'Shot Hit',
|
|
11
|
+
SHORTCUT: 'Shortcut',
|
|
12
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KART_STATUS = void 0;
|
|
3
|
+
exports.KART_FINAL_STATE = exports.KART_STATUS = void 0;
|
|
4
4
|
exports.KART_STATUS = {
|
|
5
5
|
STAND_BY: 'standBy',
|
|
6
6
|
IN_GAME: 'in-game',
|
|
@@ -9,3 +9,7 @@ exports.KART_STATUS = {
|
|
|
9
9
|
PITS: 'pits',
|
|
10
10
|
ELIMINATED: 'eliminated',
|
|
11
11
|
};
|
|
12
|
+
exports.KART_FINAL_STATE = {
|
|
13
|
+
VICTORY: 'Victory',
|
|
14
|
+
DEFEAT: 'Defeat',
|
|
15
|
+
};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { DAMAGE_EFFECT } from '../../constants/hardware/damage';
|
|
2
|
+
import { ObjectValues } from '../utils';
|
|
3
|
+
export type DamageEffectName = ObjectValues<typeof DAMAGE_EFFECT>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ScreenViewBaseConfig } from './ScreenViewBaseConfig';
|
|
1
|
+
import type { ScreenViewBaseConfig, ScreenCurrentTotal } from './ScreenViewBaseConfig';
|
|
2
2
|
export type ScreenBattleViewConfig = ScreenViewBaseConfig & {
|
|
3
|
-
lives?:
|
|
3
|
+
lives?: ScreenCurrentTotal;
|
|
4
4
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { KART_FINAL_STATE } from '../../../constants';
|
|
2
|
+
import { ObjectValues } from '../../utils';
|
|
3
|
+
import { ScreenCurrentTotal } from './ScreenViewBaseConfig';
|
|
4
|
+
export type KartFinalState = ObjectValues<typeof KART_FINAL_STATE>;
|
|
1
5
|
export type ScreenFinishViewInput = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
totalKarts: number;
|
|
5
|
-
};
|
|
6
|
+
kartNumber?: number;
|
|
7
|
+
kartPosition: ScreenCurrentTotal;
|
|
6
8
|
coins: number;
|
|
9
|
+
finalState?: KartFinalState;
|
|
7
10
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ScreenViewBaseConfig } from './ScreenViewBaseConfig';
|
|
1
|
+
import type { ScreenViewBaseConfig, ScreenCurrentTotal } from './ScreenViewBaseConfig';
|
|
3
2
|
export type ScreenRaceViewConfig = ScreenViewBaseConfig & {
|
|
4
|
-
laps?:
|
|
3
|
+
laps?: ScreenCurrentTotal;
|
|
5
4
|
};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { DamageEffectName } from '../../damage';
|
|
2
2
|
import type { PowerUpName } from '../../powerUp';
|
|
3
3
|
import type { ScreenGameTimeLeft } from './ScreenGameTimeLeft';
|
|
4
|
-
|
|
4
|
+
export type ScreenCurrentTotal = {
|
|
5
|
+
current: number | null;
|
|
6
|
+
total: number | null;
|
|
7
|
+
};
|
|
5
8
|
export type ScreenViewBaseConfig = {
|
|
6
|
-
position?:
|
|
9
|
+
position?: ScreenCurrentTotal;
|
|
7
10
|
coins?: number | null;
|
|
8
11
|
gameTimeLeft?: ScreenGameTimeLeft;
|
|
9
12
|
powerUp?: PowerUpName | 'Clear PowerUp' | null;
|
|
10
|
-
|
|
13
|
+
powerUpAnimationTimeSeconds?: number | null;
|
|
14
|
+
damageEffect?: DamageEffectName | 'Yellow Flag' | 'Red Flag' | null;
|
|
15
|
+
damageAnimationTimeSeconds?: 'Infinite' | number | null;
|
|
11
16
|
};
|
|
@@ -2,8 +2,7 @@ export * from './ScreenBattleViewConfig';
|
|
|
2
2
|
export * from './ScreenCountdownParams';
|
|
3
3
|
export * from './ScreenFinishViewInput';
|
|
4
4
|
export * from './ScreenGameTimeLeft';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './ScreenRaceLaps';
|
|
5
|
+
export * from './ScreenHomeViewInput';
|
|
7
6
|
export * from './ScreenRaceViewConfig';
|
|
8
7
|
export * from './ScreenUpdateGameViewInput';
|
|
9
8
|
export * from './ScreenView';
|
|
@@ -18,8 +18,7 @@ __exportStar(require("./ScreenBattleViewConfig"), exports);
|
|
|
18
18
|
__exportStar(require("./ScreenCountdownParams"), exports);
|
|
19
19
|
__exportStar(require("./ScreenFinishViewInput"), exports);
|
|
20
20
|
__exportStar(require("./ScreenGameTimeLeft"), exports);
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./ScreenRaceLaps"), exports);
|
|
21
|
+
__exportStar(require("./ScreenHomeViewInput"), exports);
|
|
23
22
|
__exportStar(require("./ScreenRaceViewConfig"), exports);
|
|
24
23
|
__exportStar(require("./ScreenUpdateGameViewInput"), exports);
|
|
25
24
|
__exportStar(require("./ScreenView"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConfigDiskSensorBallShooterModuleOptions, ConfigureBallSensorDiskThrowerModuleOptions, FlagConfigurationOptions, FlagShowMediaOptions, PlaySoundOptions, RGBConfigurationOptions, RGBShowEffectOptions, ScreenCountdownParams, ScreenFinishViewInput, ScreenUpdateGameViewInput, SpeedChangeOptions, SpeedConfiguration, StarLaserConfigureModuleOptions, StarLaserSendActionsOptions } from '../hardware';
|
|
1
|
+
import type { ConfigDiskSensorBallShooterModuleOptions, ConfigureBallSensorDiskThrowerModuleOptions, FlagConfigurationOptions, FlagShowMediaOptions, PlaySoundOptions, RGBConfigurationOptions, RGBShowEffectOptions, ScreenCountdownParams, ScreenFinishViewInput, ScreenHomeViewInput, ScreenUpdateGameViewInput, SpeedChangeOptions, SpeedConfiguration, StarLaserConfigureModuleOptions, StarLaserSendActionsOptions } from '../hardware';
|
|
2
2
|
export type SocketHardwareDataSubscriptionEventsParams = {
|
|
3
3
|
'hardware:data:subscribe': undefined;
|
|
4
4
|
'hardware:data:unsubscribe': undefined;
|
|
@@ -45,7 +45,7 @@ export type SocketHardwareRightStarFrontLaserModuleEventsParams = {
|
|
|
45
45
|
'hardware:right-star-front-laser:configure': StarLaserConfigureModuleOptions;
|
|
46
46
|
};
|
|
47
47
|
export type SocketHardwareScreenModuleEventsParams = {
|
|
48
|
-
'hardware:screen:showHomeView':
|
|
48
|
+
'hardware:screen:showHomeView': ScreenHomeViewInput;
|
|
49
49
|
'hardware:screen:showCountdownView': ScreenCountdownParams;
|
|
50
50
|
'hardware:screen:updateGameView': ScreenUpdateGameViewInput;
|
|
51
51
|
'hardware:screen:showScreenVictoryView': ScreenFinishViewInput;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Game, GameType } from '../../game';
|
|
2
2
|
import type { GameTrack } from '../../gameTrack';
|
|
3
|
-
import type { Kart } from '../../kart';
|
|
3
|
+
import type { Kart, KartStatus } from '../../kart';
|
|
4
4
|
import type { Response } from '../../response';
|
|
5
5
|
import type { SocketPowerUpEventsParams } from '../SocketPowerUpEventsParams';
|
|
6
6
|
interface BaseGameEventParams {
|
|
@@ -23,6 +23,10 @@ export interface SocketKartEventsParams {
|
|
|
23
23
|
'kart:gameTrack:emergency:started': undefined;
|
|
24
24
|
/** When the physical button of the game track is released */
|
|
25
25
|
'kart:gameTrack:emergency:stopped': undefined;
|
|
26
|
+
/** Force kart to change status */
|
|
27
|
+
'kart:status:change': {
|
|
28
|
+
status: KartStatus;
|
|
29
|
+
};
|
|
26
30
|
}
|
|
27
31
|
export interface SocketGameEventParams {
|
|
28
32
|
/** Kart is selected for a game */
|
package/package.json
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@battle-racing/br-common-lib",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Common library for all Battle Racing Repositorios",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
7
15
|
"scripts": {
|
|
8
16
|
"build": "tsc",
|
|
9
|
-
"release": "
|
|
17
|
+
"release": "npm run build && npm publish --access public",
|
|
18
|
+
"release:patch": "npm version patch && npm run release",
|
|
19
|
+
"release:minor": "npm version minor && npm run release",
|
|
20
|
+
"release:major": "npm version major && npm run release",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
10
22
|
},
|
|
11
23
|
"keywords": [
|
|
12
24
|
"Battle",
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { DAMAGE_EFFECT } from '../../constants/hardware/damage';
|
|
2
|
+
import { ObjectValues } from '../utils';
|
|
3
|
+
|
|
4
|
+
export type DamageEffectName = ObjectValues<typeof DAMAGE_EFFECT>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ScreenViewBaseConfig } from './ScreenViewBaseConfig';
|
|
1
|
+
import type { ScreenViewBaseConfig, ScreenCurrentTotal } from './ScreenViewBaseConfig';
|
|
2
2
|
|
|
3
3
|
export type ScreenBattleViewConfig = ScreenViewBaseConfig & {
|
|
4
|
-
lives?:
|
|
4
|
+
lives?: ScreenCurrentTotal;
|
|
5
5
|
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { KART_FINAL_STATE } from '../../../constants';
|
|
2
|
+
import { ObjectValues } from '../../utils';
|
|
3
|
+
import { ScreenCurrentTotal } from './ScreenViewBaseConfig';
|
|
4
|
+
|
|
5
|
+
export type KartFinalState = ObjectValues<typeof KART_FINAL_STATE>;
|
|
6
|
+
|
|
1
7
|
export type ScreenFinishViewInput = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
totalKarts: number;
|
|
5
|
-
};
|
|
8
|
+
kartNumber?: number;
|
|
9
|
+
kartPosition: ScreenCurrentTotal;
|
|
6
10
|
coins: number;
|
|
11
|
+
finalState?: KartFinalState;
|
|
7
12
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ScreenViewBaseConfig } from './ScreenViewBaseConfig';
|
|
1
|
+
import type { ScreenViewBaseConfig, ScreenCurrentTotal } from './ScreenViewBaseConfig';
|
|
3
2
|
|
|
4
3
|
export type ScreenRaceViewConfig = ScreenViewBaseConfig & {
|
|
5
|
-
laps?:
|
|
4
|
+
laps?: ScreenCurrentTotal;
|
|
6
5
|
};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { DamageEffectName } from '../../damage';
|
|
2
2
|
import type { PowerUpName } from '../../powerUp';
|
|
3
3
|
import type { ScreenGameTimeLeft } from './ScreenGameTimeLeft';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
export type ScreenCurrentTotal = {
|
|
6
|
+
current: number | null;
|
|
7
|
+
total: number | null;
|
|
8
|
+
};
|
|
5
9
|
|
|
6
10
|
export type ScreenViewBaseConfig = {
|
|
7
|
-
position?:
|
|
11
|
+
position?: ScreenCurrentTotal;
|
|
8
12
|
coins?: number | null;
|
|
9
13
|
gameTimeLeft?: ScreenGameTimeLeft;
|
|
10
14
|
powerUp?: PowerUpName | 'Clear PowerUp' | null;
|
|
11
|
-
|
|
15
|
+
powerUpAnimationTimeSeconds?: number | null;
|
|
16
|
+
damageEffect?: DamageEffectName | 'Yellow Flag' | 'Red Flag' | null;
|
|
17
|
+
damageAnimationTimeSeconds?: 'Infinite' | number | null;
|
|
12
18
|
};
|
|
@@ -2,8 +2,7 @@ export * from './ScreenBattleViewConfig';
|
|
|
2
2
|
export * from './ScreenCountdownParams';
|
|
3
3
|
export * from './ScreenFinishViewInput';
|
|
4
4
|
export * from './ScreenGameTimeLeft';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './ScreenRaceLaps';
|
|
5
|
+
export * from './ScreenHomeViewInput';
|
|
7
6
|
export * from './ScreenRaceViewConfig';
|
|
8
7
|
export * from './ScreenUpdateGameViewInput';
|
|
9
8
|
export * from './ScreenView';
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
RGBShowEffectOptions,
|
|
9
9
|
ScreenCountdownParams,
|
|
10
10
|
ScreenFinishViewInput,
|
|
11
|
+
ScreenHomeViewInput,
|
|
11
12
|
ScreenUpdateGameViewInput,
|
|
12
13
|
SpeedChangeOptions,
|
|
13
14
|
SpeedConfiguration,
|
|
@@ -69,7 +70,7 @@ export type SocketHardwareRightStarFrontLaserModuleEventsParams = {
|
|
|
69
70
|
};
|
|
70
71
|
|
|
71
72
|
export type SocketHardwareScreenModuleEventsParams = {
|
|
72
|
-
'hardware:screen:showHomeView':
|
|
73
|
+
'hardware:screen:showHomeView': ScreenHomeViewInput;
|
|
73
74
|
'hardware:screen:showCountdownView': ScreenCountdownParams;
|
|
74
75
|
'hardware:screen:updateGameView': ScreenUpdateGameViewInput;
|
|
75
76
|
'hardware:screen:showScreenVictoryView': ScreenFinishViewInput;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Game, GameType } from '../../game';
|
|
2
2
|
import type { GameTrack } from '../../gameTrack';
|
|
3
|
-
import type { Kart } from '../../kart';
|
|
3
|
+
import type { Kart, KartStatus } from '../../kart';
|
|
4
4
|
import type { Response } from '../../response';
|
|
5
5
|
import type { SocketPowerUpEventsParams } from '../SocketPowerUpEventsParams';
|
|
6
6
|
|
|
@@ -24,6 +24,8 @@ export interface SocketKartEventsParams {
|
|
|
24
24
|
'kart:gameTrack:emergency:started': undefined;
|
|
25
25
|
/** When the physical button of the game track is released */
|
|
26
26
|
'kart:gameTrack:emergency:stopped': undefined;
|
|
27
|
+
/** Force kart to change status */
|
|
28
|
+
'kart:status:change': { status: KartStatus };
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
export interface SocketGameEventParams {
|