Skip to content

Commit c47ca4b

Browse files
committed
lobbyid -> lobby_id
1 parent 61cb5ba commit c47ca4b

File tree

18 files changed

+108
-75
lines changed

18 files changed

+108
-75
lines changed

Client/objects/oLobbiesDemo/Draw_0.gml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ draw_set_valign(fa_middle)
66
for(var i = 0; i < array_length(global.lobbies); i++) {
77
var lobby = global.lobbies[i]
88
var lobby_string = string(i+1) + ")" + string({
9-
lobbyid: lobby.lobbyid,
9+
lobby_id: lobby.lobby_id,
1010
//level: lobby.level.name,
1111
//mode: lobby.level.mode,
1212
//room_name: lobby.level.room_name,
@@ -21,11 +21,11 @@ for(var i = 0; i < array_length(global.lobbies); i++) {
2121
draw_text(room_width/2, room_height/2+100, "Press buttons 1-9 to join lobbies\nL to leave\nR to refresh")
2222

2323
if (global.lobby) {
24-
draw_text(room_width/2, room_height-150, "joined lobbyid: " + global.lobby.lobbyid + "\n"
24+
draw_text(room_width/2, room_height-150, "joined lobby_id: " + global.lobby.lobby_id + "\n"
2525
+ "players: " + string(global.lobby.player_count) + "/"
2626
+ string(global.lobby.max_players))
2727
//draw_text(room_width/2, room_height-150,
28-
// str_format("joined lobbyid: %\n players: %/%", global.lobby.lobbyid,
28+
// str_format("joined lobby_id: %\n players: %/%", global.lobby.lobby_id,
2929
// global.lobby.player_count, global.lobby.max_players))
3030
}
3131
else {

Client/objects/oLobbiesDemo/Step_0.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ for(var i = 1; i <= 9; i++) {
55
if (keyboard_check_pressed(ord(string(i)))) {
66
trace("pressed %", i)
77
if (i-1 < array_length(global.lobbies)) {
8-
sendLobbyJoin(global.lobbies[i-1].lobbyid)
8+
sendLobbyJoin(global.lobbies[i-1].lobby_id)
99
}
1010
}
1111
}

Client/scripts/gameplaySenders/gameplaySenders.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function sendPlayerControls(inputs) {
44
var input_names = variable_struct_get_names(inputs)
55
for(var i = 0; i < variable_struct_names_count(inputs); i++) {
66
var input_name = input_names[i]
7-
data[$ input_name] = self.inputs[input_name]
7+
data[$ input_name] = self.inputs[$ input_name]
88
}
99

1010

Client/scripts/lobbyHandlers/lobbyHandlers.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ addHandler("lobby info", function(data) {
99
var lobby = data.lobby
1010
for(var i = 0; i < array_length(global.lobbies); i++) {
1111
var _lobby = global.lobbies[i]
12-
if (_lobby.lobbyid == lobby.lobbyid) {
12+
if (_lobby.lobby_id == lobby.lobby_id) {
1313
global.lobbies[i] = lobby
1414
}
1515
}

Client/scripts/lobbySenders/lobbySenders.gml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
function sendLobbyJoin(lobbyid) {
2-
send({cmd: "lobby join", lobbyid: lobbyid})
1+
function sendLobbyJoin(lobby_id) {
2+
send({cmd: "lobby join", lobby_id: lobby_id})
33
}
44

55
function sendLobbyLeave() {
66
send({cmd: "lobby leave"})
77
}
88

9-
function sendLobbyRequestInfo(lobbyid) {
10-
send({cmd: "lobby info", lobbyid: lobbyid})
9+
function sendLobbyRequestInfo(lobby_id) {
10+
send({cmd: "lobby info", lobby_id: lobby_id})
1111
}
1212

1313
function sendLobbyRequestList() {

TypescriptServer/src/cmd/handlers/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ addHandler('session create', async (c, data) => {
2020

2121
await c.register(c.account);
2222

23-
c.send({ cmd: 'session create', success: true, session: c.session.token });
23+
c.sendSessionCreate(true, '', c.session.token);
2424
c.sendLogin(true);
2525
}
2626
catch (reason) {
27-
c.send({ cmd: 'session create', success: false, reason: reason.toString() });
27+
c.sendSessionCreate(false, reason.toString());
2828
}
2929
});
3030

TypescriptServer/src/cmd/handlers/custom.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { addHandler } from "#cmd/handlePacket";
2+
import { PlayerInputs } from "#entities/player";
23
import Point from "#types/point";
34
import { clamp } from "#util/maths";
45

TypescriptServer/src/cmd/handlers/lobby.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ addHandler('lobby list', (c) => {
77
});
88

99
addHandler('lobby info', (c, data) => {
10-
const lobbyid = data.lobbyid;
11-
if (lobbyExists(lobbyid))
12-
c.sendLobbyInfo(lobbyid);
10+
const lobby_id = data.lobby_id;
11+
if (lobbyExists(lobby_id))
12+
c.sendLobbyInfo(lobby_id);
1313
});
1414

1515
addHandler('lobby join', (c, data) => {
1616
if (!global.config.lobby.allow_join_by_id)
1717
return;
1818

19-
const lobbyid = data.lobbyid;
20-
if (lobbyExists(lobbyid))
21-
c.lobbyJoin(lobbyid);
19+
const lobby_id = data.lobby_id;
20+
if (lobbyExists(lobby_id))
21+
c.lobbyJoin(lobby_id);
2222
});
2323

2424
addHandler('lobby leave', (c, data) => {

TypescriptServer/src/cmd/senders/auth.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ declare module "#cmd/sendStuff" {
99
sendRegister(success:boolean, reason?:string)
1010
sendLogin(success:boolean, reason?:string)
1111
sendSession(success:boolean, reason?:string, session_token?:string)
12+
sendSessionCreate(success:boolean, reason?:string, session_token?:string)
1213
}
1314
}
1415

@@ -37,4 +38,11 @@ SendStuff.prototype.sendSession = function(success, reason:string = '', token =
3738
token = this.session.token;
3839
}
3940
this.send({ cmd: 'session login', success, reason, session: token });
41+
}
42+
43+
SendStuff.prototype.sendSessionCreate = function(success, reason:string = '', token = undefined) {
44+
if (token === undefined && success) {
45+
token = this.session.token;
46+
}
47+
this.send({ cmd: 'session create', success: true, reason, session: token });
4048
}

TypescriptServer/src/cmd/senders/chat.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import { IMessage } from "#schemas/chat";
44
declare module '#cmd/sendStuff' {
55
interface SendStuff {
66
sendChatMessage(chat_id:string, message:IMessage):void
7-
// sendSomething():void
7+
sendChatHistory(chat_id:string, messages:IMessage[]):void
88
}
99
}
1010

11-
/**
12-
* @param {}
13-
*/
14-
// SendStuff.prototype.sendSomething = function() {
15-
// this.send({ cmd: '', })
16-
// }
11+
SendStuff.prototype.sendChatMessage = function(chat_id:string, message:IMessage) {
12+
this.send({ cmd: 'chat msg', chat_id, message });
13+
}
14+
15+
SendStuff.prototype.sendChatHistory = function(chat_id:string, messages:IMessage[]) {
16+
this.send({ cmd: 'chat history', chat_id, history: messages });
17+
}

0 commit comments

Comments
 (0)