@battle-racing/br-common-lib 1.3.0 → 1.4.1
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/types/command/CommandConfig.d.ts +3 -0
- package/dist/types/hardware/sound/PlaySoundOptions.d.ts +7 -0
- package/dist/types/socket/inputs/MacAddressGameTrackConnection.d.ts +2 -3
- package/dist/types/socket/serverToClient/SocketWebAppServerToClientEventsParams.d.ts +5 -1
- package/dist/types/utils/ArithmeticString.d.ts +1 -1
- package/package.json +1 -1
- package/src/types/command/CommandConfig.ts +4 -0
- package/src/types/hardware/sound/PlaySoundOptions.ts +7 -0
- package/src/types/socket/inputs/MacAddressGameTrackConnection.ts +3 -1
- package/src/types/socket/serverToClient/SocketWebAppServerToClientEventsParams.ts +3 -1
- package/src/types/utils/ArithmeticString.ts +1 -1
|
@@ -3,6 +3,9 @@ import type { ArithmeticExpression } from '../utils';
|
|
|
3
3
|
export interface ChangeSpeedActionCommandOptions extends Omit<SpeedChangeOptions, 'speed'> {
|
|
4
4
|
speed: number | ArithmeticExpression;
|
|
5
5
|
}
|
|
6
|
+
export interface PlaySoundActionCommandOptions extends Omit<PlaySoundOptions, 'durationMs'> {
|
|
7
|
+
durationMs?: number | ArithmeticExpression;
|
|
8
|
+
}
|
|
6
9
|
export type BallSensorDiskThrowerModuleCommands = {
|
|
7
10
|
module: 'ballSensorDiskThrower';
|
|
8
11
|
action: 'activateSensor';
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { SoundName } from '../../sounds';
|
|
2
2
|
export interface PlaySoundOptions {
|
|
3
3
|
soundName: SoundName;
|
|
4
|
+
/**
|
|
5
|
+
* The amount of time in milliseconds to play the sound for.
|
|
6
|
+
* If not provided, the sound will play for the duration of the sound file.
|
|
7
|
+
* If the time is longer than the duration of the sound file, the sound will play in a loop.
|
|
8
|
+
* If the time is shorter than the duration of the sound file, the sound will stop playing after the duration.
|
|
9
|
+
*/
|
|
10
|
+
durationMs?: number | 'infinite';
|
|
4
11
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Game } from '../../game';
|
|
2
|
+
import type { GameTrack } from '../../gameTrack';
|
|
2
3
|
import type { Kart } from '../../kart';
|
|
3
4
|
import type { CheckpointEvent } from '../../kartTracking';
|
|
4
5
|
import type { Response } from '../../response';
|
|
@@ -19,6 +20,9 @@ export interface SocketWebAppServerToClientEventsParams {
|
|
|
19
20
|
'game:changed': {
|
|
20
21
|
game: Game;
|
|
21
22
|
};
|
|
22
|
-
'gameTracks:onGameTrackUpdated':
|
|
23
|
+
'gameTracks:onGameTrackUpdated': GameTrack[];
|
|
24
|
+
'gameTracks:connectedRasperries': {
|
|
25
|
+
macAddress: string;
|
|
26
|
+
}[];
|
|
23
27
|
'gameTracks:list:response': Response<MacAddressGameTrackConnections>;
|
|
24
28
|
}
|
|
@@ -3,7 +3,7 @@ export type ArithmeticOperator = '+' | '-' | '*' | '/';
|
|
|
3
3
|
* The Value is determined by an arithmetic operator followed by a number.
|
|
4
4
|
*/
|
|
5
5
|
export type SimpleArithmeticString = `${ArithmeticOperator}${number}`;
|
|
6
|
-
export type KartContextVariable = '$kart.configuredSpeed';
|
|
6
|
+
export type KartContextVariable = '$kart.configuredSpeed' | '$kart.powerUpTime';
|
|
7
7
|
export type ContextVariable = KartContextVariable;
|
|
8
8
|
export type ContextArithmeticString = `${ContextVariable} ${ArithmeticOperator} ${number}`;
|
|
9
9
|
export type ArithmeticExpression = number | SimpleArithmeticString | ContextArithmeticString;
|
package/package.json
CHANGED
|
@@ -20,6 +20,10 @@ export interface ChangeSpeedActionCommandOptions extends Omit<SpeedChangeOptions
|
|
|
20
20
|
speed: number | ArithmeticExpression;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
export interface PlaySoundActionCommandOptions extends Omit<PlaySoundOptions, 'durationMs'> {
|
|
24
|
+
durationMs?: number | ArithmeticExpression;
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
export type BallSensorDiskThrowerModuleCommands =
|
|
24
28
|
| { module: 'ballSensorDiskThrower'; action: 'activateSensor'; params?: undefined }
|
|
25
29
|
| { module: 'ballSensorDiskThrower'; action: 'deactivateSensor'; params?: undefined }
|
|
@@ -2,4 +2,11 @@ import type { SoundName } from '../../sounds';
|
|
|
2
2
|
|
|
3
3
|
export interface PlaySoundOptions {
|
|
4
4
|
soundName: SoundName;
|
|
5
|
+
/**
|
|
6
|
+
* The amount of time in milliseconds to play the sound for.
|
|
7
|
+
* If not provided, the sound will play for the duration of the sound file.
|
|
8
|
+
* If the time is longer than the duration of the sound file, the sound will play in a loop.
|
|
9
|
+
* If the time is shorter than the duration of the sound file, the sound will stop playing after the duration.
|
|
10
|
+
*/
|
|
11
|
+
durationMs?: number | 'infinite';
|
|
5
12
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Game } from '../../game';
|
|
2
|
+
import type { GameTrack } from '../../gameTrack';
|
|
2
3
|
import type { Kart } from '../../kart';
|
|
3
4
|
import type { CheckpointEvent } from '../../kartTracking';
|
|
4
5
|
import type { Response } from '../../response';
|
|
@@ -18,6 +19,7 @@ export interface SocketWebAppServerToClientEventsParams {
|
|
|
18
19
|
checkpointEvent: CheckpointEvent;
|
|
19
20
|
};
|
|
20
21
|
'game:changed': { game: Game };
|
|
21
|
-
'gameTracks:onGameTrackUpdated':
|
|
22
|
+
'gameTracks:onGameTrackUpdated': GameTrack[];
|
|
23
|
+
'gameTracks:connectedRasperries': { macAddress: string }[];
|
|
22
24
|
'gameTracks:list:response': Response<MacAddressGameTrackConnections>;
|
|
23
25
|
}
|
|
@@ -5,7 +5,7 @@ export type ArithmeticOperator = '+' | '-' | '*' | '/';
|
|
|
5
5
|
*/
|
|
6
6
|
export type SimpleArithmeticString = `${ArithmeticOperator}${number}`;
|
|
7
7
|
|
|
8
|
-
export type KartContextVariable = '$kart.configuredSpeed';
|
|
8
|
+
export type KartContextVariable = '$kart.configuredSpeed' | '$kart.powerUpTime';
|
|
9
9
|
|
|
10
10
|
export type ContextVariable = KartContextVariable;
|
|
11
11
|
|