diff --git a/src/client/RPCClient.ts b/src/client/RPCClient.ts index 4a71365..80b3315 100644 --- a/src/client/RPCClient.ts +++ b/src/client/RPCClient.ts @@ -138,8 +138,8 @@ export default class RPCClient implements Disposable { else return this._activity.changePartyId(); }); liveshare.onDidChangePeers(({ added, removed }: { added: vsls.Peer[], removed: vsls.Peer[] }) => { - if (added.length) return this._activity.increasePartySize(); - else if (removed.length) return this._activity.decreasePartySize(); + if (added.length) return this._activity.increasePartySize(added.length); + else if (removed.length) return this._activity.decreasePartySize(removed.length); }); }); diff --git a/src/structures/Activity.ts b/src/structures/Activity.ts index 9c90d90..01da4f4 100644 --- a/src/structures/Activity.ts +++ b/src/structures/Activity.ts @@ -164,23 +164,23 @@ export default class Activity implements Disposable { return this._state; } - public increasePartySize() { - if (!this._state || !this._state.partySize) return; + public increasePartySize(size?: number) { + if (!this._state) return; if (this.state && this._state.partySize === 5) return; this._state = { ...this._state, - partySize: this._state.partySize + 1 + partySize: this._state.partySize ? this._state.partySize + 1 : size }; return this._state; } - public decreasePartySize() { - if (!this._state || !this._state.partySize) return; + public decreasePartySize(size?: number) { + if (!this._state) return; if (this.state && this._state.partySize === 1) return; this._state = { ...this._state, - partySize: this._state.partySize - 1 + partySize: this._state.partySize ? this._state.partySize - 1 : size }; return this._state;