mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-03-21 17:50:29 -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
|
||||
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();
|
||||
}
|
||||
override connect() {
|
||||
if (!this.connected) {
|
||||
if (!this.connected || this.connected === 'autoreconnect') {
|
||||
if (this.pmTarget === null) PS.send(`/join ${this.id}`);
|
||||
this.connected = true;
|
||||
this.connectWhenLoggedIn = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user