diff --git a/JavascriptServer/cmd/senders/types/auth.d.ts b/JavascriptServer/cmd/senders/types/auth.d.ts new file mode 100644 index 0000000..6ff735d --- /dev/null +++ b/JavascriptServer/cmd/senders/types/auth.d.ts @@ -0,0 +1,7 @@ +declare module "#cmd/sendStuff" { + interface SendStuff { + sendRegister(status: string, reason?: string): any; + sendLogin(status: string, reason?: string): any; + } +} +export {}; diff --git a/JavascriptServer/cmd/senders/types/custom.d.ts b/JavascriptServer/cmd/senders/types/custom.d.ts new file mode 100644 index 0000000..28e17d2 --- /dev/null +++ b/JavascriptServer/cmd/senders/types/custom.d.ts @@ -0,0 +1,6 @@ +import { IPlayerInputs } from "#entity/player"; +declare module "#cmd/sendStuff" { + interface SendStuff { + sendPlayerControls(data: IPlayerInputs): any; + } +} diff --git a/JavascriptServer/cmd/senders/types/friends.d.ts b/JavascriptServer/cmd/senders/types/friends.d.ts new file mode 100644 index 0000000..cc68477 --- /dev/null +++ b/JavascriptServer/cmd/senders/types/friends.d.ts @@ -0,0 +1,7 @@ +import { IProfile, ProfileInfo } from "#schemas/profile"; +declare module '#cmd/sendStuff' { + interface SendStuff { + sendFriends(friends: IProfile[]): any; + sendIncomingFriendRequests(from_profiles: ProfileInfo[]): any; + } +} diff --git a/JavascriptServer/cmd/senders/types/game_loop.d.ts b/JavascriptServer/cmd/senders/types/game_loop.d.ts new file mode 100644 index 0000000..cbcaec6 --- /dev/null +++ b/JavascriptServer/cmd/senders/types/game_loop.d.ts @@ -0,0 +1,10 @@ +import Lobby from "#concepts/lobby"; +import Room from "#concepts/room"; +import Point from '#types/point'; +declare module '#cmd/sendStuff' { + interface SendStuff { + sendPlay(lobby: Lobby, room?: Room, start_pos?: Point, uuid?: string): void; + sendRoomTransition(room_to: Room, start_pos?: Point, uuid?: string): void; + sendGameOver(outcome: string, reason?: string): void; + } +} diff --git a/JavascriptServer/cmd/senders/types/lobby.d.ts b/JavascriptServer/cmd/senders/types/lobby.d.ts new file mode 100644 index 0000000..78b70b7 --- /dev/null +++ b/JavascriptServer/cmd/senders/types/lobby.d.ts @@ -0,0 +1,11 @@ +import Lobby from '#concepts/lobby'; +declare module '#cmd/sendStuff' { + interface SendStuff { + sendLobbyJoin(lobby: Lobby): void; + sendLobbyReject(lobby: Lobby, reason?: string): void; + sendLobbyLeave(lobby: Lobby, reason?: string, forced?: boolean): void; + sendLobbyUpdate(lobby: Lobby): void; + sendLobbyInfo(lobbyid: string): void; + sendLobbyList(): void; + } +} diff --git a/JavascriptServer/cmd/senders/types/party.d.ts b/JavascriptServer/cmd/senders/types/party.d.ts new file mode 100644 index 0000000..d4cf45e --- /dev/null +++ b/JavascriptServer/cmd/senders/types/party.d.ts @@ -0,0 +1,10 @@ +import Party from "#concepts/party"; +declare module '#cmd/sendStuff' { + interface SendStuff { + sendPartyInvite(party: Party): any; + sendPartyLeave(party: Party, reason: string, forced: boolean): any; + sendPartyJoin(party: Party): any; + sendPartyReject(party?: Party, reason?: string): any; + sendPartyInviteSent(): any; + } +} diff --git a/JavascriptServer/cmd/senders/types/system.d.ts b/JavascriptServer/cmd/senders/types/system.d.ts new file mode 100644 index 0000000..94f7185 --- /dev/null +++ b/JavascriptServer/cmd/senders/types/system.d.ts @@ -0,0 +1,10 @@ +import { ValidationError } from "fastest-validator"; +declare module '#cmd/sendStuff' { + interface SendStuff { + sendServerInfo(compatible: boolean): any; + sendPing(): any; + sendPong(T: number): any; + sendServerTime(client_t: number): any; + sendInvalidInput(from_cmd: string, errors: ValidationError[]): any; + } +} diff --git a/JavascriptServer/concepts/client.js b/JavascriptServer/concepts/client.js index 5589488..de14a60 100644 --- a/JavascriptServer/concepts/client.js +++ b/JavascriptServer/concepts/client.js @@ -1,6 +1,6 @@ import trace from '#util/logging'; import chalk from 'chalk'; -import SendStuff from '#cmd/sendStuff'; +import { SendStuff } from '#cmd/sendStuff'; import mongoose from 'mongoose'; const ObjectId = mongoose.Types.ObjectId; diff --git a/JavascriptServer/initializers/10_cmd.js b/JavascriptServer/initializers/10_cmd.js index a349ff7..6a76005 100644 --- a/JavascriptServer/initializers/10_cmd.js +++ b/JavascriptServer/initializers/10_cmd.js @@ -9,11 +9,15 @@ const __dirname = dirname(fileURLToPath(import.meta.url)); async function loadFolder(type) { - let files = fs.readdirSync(__dirname + `/../cmd/${type}s`, 'utf8'); + let dir = __dirname + `/../cmd/${type}s`; + let files = fs.readdirSync(dir, 'utf8'); trace(chalk.blueBright(`Loading ${type}s...`)); // load everything asynchronously await Promise.all(files.map(file => { + if (fs.statSync(dir + '/' + file).isDirectory()) + return; + trace(chalk.blueBright(`> loading ${type}:`, file)); return import(`file://${__dirname}/../cmd/${type}s/${file}`); })); diff --git a/Release/GMClient.zip b/Release/GMClient.zip index 0ddb4d2..1691ee7 100644 Binary files a/Release/GMClient.zip and b/Release/GMClient.zip differ diff --git a/Release/JSServer.zip b/Release/JSServer.zip index 6016234..a26c175 100644 Binary files a/Release/JSServer.zip and b/Release/JSServer.zip differ diff --git a/Release/TSServer.zip b/Release/TSServer.zip index 06feba3..8e1730f 100644 Binary files a/Release/TSServer.zip and b/Release/TSServer.zip differ diff --git a/Release/Warp.yymps b/Release/Warp.yymps index 0ddb4d2..1691ee7 100644 Binary files a/Release/Warp.yymps and b/Release/Warp.yymps differ diff --git a/TypescriptServer/src/cmd/sendStuff.ts b/TypescriptServer/src/cmd/sendStuff.ts index 866fea3..544814c 100644 --- a/TypescriptServer/src/cmd/sendStuff.ts +++ b/TypescriptServer/src/cmd/sendStuff.ts @@ -1,12 +1,10 @@ import trace from '#util/logging'; import packet from '#packet'; -import { Socket } from 'net'; -import Lobby, { lobbyList } from '#concepts/lobby'; -import { Account, getAccountInfo, IAccount } from '#schemas/account'; -import { Profile, IProfile, getProfileInfo, ProfileInfo } from '#schemas/profile' +import Lobby from '#concepts/lobby'; +import { IAccount } from '#schemas/account'; +import { IProfile } from '#schemas/profile' import Room from '#concepts/room'; -import Client from '#concepts/client'; -import PlayerEntity, { IPlayerInputs } from '#entity/player'; +import PlayerEntity from '#entity/player'; import { SockType, Sock } from '#types/socktype'; import * as net from 'net'; import * as ws from 'ws'; diff --git a/TypescriptServer/src/cmd/senders/auth.ts b/TypescriptServer/src/cmd/senders/auth.ts index 616d4f6..630a48e 100644 --- a/TypescriptServer/src/cmd/senders/auth.ts +++ b/TypescriptServer/src/cmd/senders/auth.ts @@ -11,7 +11,7 @@ declare module "#cmd/sendStuff" { } /** - * @param {string} status + * @param {string} status * @param {string} [reason=''] */ SendStuff.prototype.sendRegister = function(status:string, reason:string = ''):void { diff --git a/TypescriptServer/src/cmd/senders/custom.ts b/TypescriptServer/src/cmd/senders/custom.ts index 6e528a7..45064ff 100644 --- a/TypescriptServer/src/cmd/senders/custom.ts +++ b/TypescriptServer/src/cmd/senders/custom.ts @@ -1,6 +1,6 @@ import SendStuff from "#cmd/sendStuff" -import Client from "#concepts/client"; -import { IPlayerInputs } from "#entity/player"; +import Client from "#concepts/client" +import { IPlayerInputs } from "#entity/player" declare module "#cmd/sendStuff" { interface SendStuff { diff --git a/TypescriptServer/src/concepts/client.ts b/TypescriptServer/src/concepts/client.ts index 3e26dbc..d4675f7 100644 --- a/TypescriptServer/src/concepts/client.ts +++ b/TypescriptServer/src/concepts/client.ts @@ -1,6 +1,6 @@ import trace from '#util/logging'; import chalk from 'chalk'; -import SendStuff from '#cmd/sendStuff'; +import { SendStuff } from '#cmd/sendStuff'; import mongoose from 'mongoose'; const ObjectId = mongoose.Types.ObjectId; diff --git a/TypescriptServer/src/initializers/10_cmd.ts b/TypescriptServer/src/initializers/10_cmd.ts index e19a8cf..9d8f6c5 100644 --- a/TypescriptServer/src/initializers/10_cmd.ts +++ b/TypescriptServer/src/initializers/10_cmd.ts @@ -9,11 +9,14 @@ const __dirname = dirname(fileURLToPath(import.meta.url)); async function loadFolder(type) { - let files = fs.readdirSync(__dirname + `/../cmd/${type}s`, 'utf8'); + let dir = __dirname + `/../cmd/${type}s`; + let files = fs.readdirSync(dir, 'utf8'); trace(chalk.blueBright(`Loading ${type}s...`)); // load everything asynchronously await Promise.all(files.map(file => { + if (fs.statSync(dir + '/' + file).isDirectory()) return; + trace(chalk.blueBright(`> loading ${type}:`, file)); return import(`file://${__dirname}/../cmd/${type}s/${file}`); })); diff --git a/TypescriptServer/tsconfig.json b/TypescriptServer/tsconfig.json index b26031a..1a91330 100644 --- a/TypescriptServer/tsconfig.json +++ b/TypescriptServer/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "allowJs": true, + "removeComments": false, "moduleResolution": "Node", "baseUrl": "src", "outDir": "out/", @@ -9,6 +10,7 @@ "target": "ESNext", "allowSyntheticDefaultImports": true, "resolveJsonModule": true, + // "declaration": true, "paths": { "#schemas/*": ["schemas/*"], "#entity/*": ["entities/entity_types/*"],