Update types to be in-line with the events

This commit is contained in:
Oliver Akins 2022-03-07 17:58:23 -06:00
parent c760b0f36d
commit 1ccc3b6c33
No known key found for this signature in database
GPG key ID: 3C2014AF9457AF99
7 changed files with 63 additions and 8 deletions

View 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;
}

View 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 {}

View 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[];
}

View 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;
}

View 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;
}

View 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;
};
}

View file

@ -1,15 +1,7 @@
import { IColour } from "../Colour";
import { ISpaceship } from "../Spaceship";
import { ServerResponse } from "../ServerResponse"; import { ServerResponse } from "../ServerResponse";
/** The data sent as a response to `server.info`. */ /** The data sent as a response to `server.info`. */
export interface IServerInfo extends ServerResponse { export interface IServerInfo extends ServerResponse {
/** The version that the server is currently running. */ /** The version that the server is currently running. */
version?: string; version?: string;
/** The ship colours that are supported by the server. */
colours?: IColour[];
/** The ship icons that are supported by the server. */
shipIcons?: ISpaceship[];
} }