mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-04-27 02:27:41 -05:00
Preact: Support auto-rejoin for battle rooms (#2457)
--------- Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
This commit is contained in:
parent
883e2043af
commit
a6b02147fa
|
|
@ -304,6 +304,13 @@ class PSPrefs extends PSStreamModel<string | null> {
|
||||||
// send even if `rooms` is empty, for server autojoins
|
// send even if `rooms` is empty, for server autojoins
|
||||||
PS.send(cmd);
|
PS.send(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const roomid in PS.rooms) {
|
||||||
|
const room = PS.rooms[roomid]!;
|
||||||
|
if (room.type === 'battle') {
|
||||||
|
room.connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ export class ChatRoom extends PSRoom {
|
||||||
this.connect();
|
this.connect();
|
||||||
}
|
}
|
||||||
override connect() {
|
override connect() {
|
||||||
if (!this.connected) {
|
if (!this.connected || this.connected === 'autoreconnect') {
|
||||||
if (this.pmTarget === null) PS.send(`/join ${this.id}`);
|
if (this.pmTarget === null) PS.send(`/join ${this.id}`);
|
||||||
this.connected = true;
|
this.connected = true;
|
||||||
this.connectWhenLoggedIn = false;
|
this.connectWhenLoggedIn = false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user