fix lobby settings resetting on join

This commit is contained in:
Hri7566 2022-06-17 00:12:55 -04:00
parent 98753b5c83
commit 0c9e730f9b
1 changed files with 7 additions and 4 deletions

View File

@ -63,7 +63,10 @@ class Channel extends EventEmitter {
cl.participantId = participantId; cl.participantId = participantId;
cl.initParticipantQuotas(); cl.initParticipantQuotas();
if (((this.connections.length == 0 && Array.from(this.ppl.values()).length == 0) && this.isLobby(this._id) == false) || this.crown && (this.crown.userId == cl.user._id)) { //user that created the room, give them the crown. // if there are no users or the user with the crown entered the room, crown the user
if (((this.connections.length == 0 && Array.from(this.ppl.values()).length == 0) && this.isLobby(this._id) == false) || this.crown && (this.crown.userId == cl.user._id)) {
// user owns the room
// we need to switch the crown to them
//cl.quotas.a.setParams(Quota.PARAMS_A_CROWNED); //cl.quotas.a.setParams(Quota.PARAMS_A_CROWNED);
this.crown = new Crown(cl.participantId, cl.user._id); this.crown = new Crown(cl.participantId, cl.user._id);
@ -72,7 +75,7 @@ class Channel extends EventEmitter {
} else { } else {
//cl.quotas.a.setParams(Quota.PARAMS_A_NORMAL); //cl.quotas.a.setParams(Quota.PARAMS_A_NORMAL);
if (this.isLobby(this._id)) { if (this.isLobby(this._id) && this.settings.lobby !== true) {
this.settings = new RoomSettings(this.server.lobbySettings, 'user'); this.settings = new RoomSettings(this.server.lobbySettings, 'user');
this.settings.visible = true; this.settings.visible = true;
this.settings.crownsolo = false; this.settings.crownsolo = false;
@ -336,7 +339,7 @@ class Channel extends EventEmitter {
message.m = "a"; message.m = "a";
message.t = Date.now(); message.t = Date.now();
message.a = msg.message; message.a = msg.message.test;
message.p = { message.p = {
color: "#ffffff", color: "#ffffff",