Update types to be in-line with the events
This commit is contained in:
parent
c760b0f36d
commit
1ccc3b6c33
7 changed files with 63 additions and 8 deletions
5
common/src/types/events/lobby/create.ts
Normal file
5
common/src/types/events/lobby/create.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/** The data required for the `lobby.create` event to function correctly. */
|
||||
export interface ICreateLobby {
|
||||
/** The name of the user who is creating the lobby */
|
||||
name: string;
|
||||
}
|
||||
4
common/src/types/events/lobby/delete.ts
Normal file
4
common/src/types/events/lobby/delete.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import { ServerRequest } from "../../ServerRequest";
|
||||
|
||||
/** The data required by the server in order to delete the lobby */
|
||||
export interface IDeleteLobby extends ServerRequest {}
|
||||
13
common/src/types/events/lobby/info.ts
Normal file
13
common/src/types/events/lobby/info.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { PlayerData } from "../../PlayerData";
|
||||
import { ServerResponse } from "../../ServerResponse";
|
||||
|
||||
/** The data sent as a response to `lobby.info`. */
|
||||
export interface ILobbyInfo extends ServerResponse {
|
||||
/**
|
||||
* The lobby ID that can be used by clients to connect to the server with.
|
||||
*/
|
||||
game_code?: string;
|
||||
|
||||
/** The data associated with each player in the game. */
|
||||
players?: PlayerData[];
|
||||
}
|
||||
8
common/src/types/events/lobby/players/join.ts
Normal file
8
common/src/types/events/lobby/players/join.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { ServerRequest } from "../../../ServerRequest";
|
||||
|
||||
/** The data required for a player to join a game lobby */
|
||||
export interface IJoinLobby extends ServerRequest {
|
||||
|
||||
/** The name that the user wants to go by in the game */
|
||||
name: string;
|
||||
}
|
||||
8
common/src/types/events/lobby/players/leave.ts
Normal file
8
common/src/types/events/lobby/players/leave.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { ServerRequest } from "../../../ServerRequest";
|
||||
|
||||
/** The required data for leaving a game, or kicking a player from a game. */
|
||||
export interface ILeaveLobby extends ServerRequest {
|
||||
|
||||
/** The name of the player being removed from the lobby */
|
||||
name: string;
|
||||
}
|
||||
25
common/src/types/events/lobby/players/update.ts
Normal file
25
common/src/types/events/lobby/players/update.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { IColour } from "../../../Colour";
|
||||
import { ServerRequest } from "../../../ServerRequest";
|
||||
import { ISpaceship } from "../../../Spaceship";
|
||||
|
||||
/** The required data for updating a player's information */
|
||||
export interface IUpdatePlayer extends ServerRequest {
|
||||
|
||||
/** The name of the player that is being updated. */
|
||||
name: string;
|
||||
|
||||
/** The player's spaceship design */
|
||||
design: {
|
||||
/**
|
||||
* The icon used for the player's space ship. This can be the same for
|
||||
* multiple players.
|
||||
*/
|
||||
ship: ISpaceship;
|
||||
|
||||
/**
|
||||
* The colour of the user's ship. This is unique across all players,
|
||||
* meaning all players must have a different colour.
|
||||
*/
|
||||
colour: IColour;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,15 +1,7 @@
|
|||
import { IColour } from "../Colour";
|
||||
import { ISpaceship } from "../Spaceship";
|
||||
import { ServerResponse } from "../ServerResponse";
|
||||
|
||||
/** The data sent as a response to `server.info`. */
|
||||
export interface IServerInfo extends ServerResponse {
|
||||
/** The version that the server is currently running. */
|
||||
version?: string;
|
||||
|
||||
/** The ship colours that are supported by the server. */
|
||||
colours?: IColour[];
|
||||
|
||||
/** The ship icons that are supported by the server. */
|
||||
shipIcons?: ISpaceship[];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue