forked from Hri7566/mpp-server-dev2
fix lobby settings resetting on join
This commit is contained in:
parent
98753b5c83
commit
0c9e730f9b
|
@ -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",
|
||||||
|
|
Loading…
Reference in New Issue