Fixing issue if group was deleted when out of bounds.
This commit is contained in:
parent
fefe7c8aa5
commit
d6e8bd522f
@ -312,7 +312,6 @@ export class GameRoom {
|
|||||||
}
|
}
|
||||||
group.leave(user);
|
group.leave(user);
|
||||||
if (group.isEmpty()) {
|
if (group.isEmpty()) {
|
||||||
this.positionNotifier.leave(group);
|
|
||||||
group.destroy();
|
group.destroy();
|
||||||
if (!this.groups.has(group)) {
|
if (!this.groups.has(group)) {
|
||||||
throw new Error(`Could not find group ${group.getId()} referenced by user ${user.id} in World.`);
|
throw new Error(`Could not find group ${group.getId()} referenced by user ${user.id} in World.`);
|
||||||
|
@ -141,6 +141,10 @@ export class Group implements Movable {
|
|||||||
* Usually used when there is only one user left.
|
* Usually used when there is only one user left.
|
||||||
*/
|
*/
|
||||||
destroy(): void {
|
destroy(): void {
|
||||||
|
if (!this.outOfBounds) {
|
||||||
|
this.positionNotifier.leave(this);
|
||||||
|
}
|
||||||
|
|
||||||
for (const user of this.users) {
|
for (const user of this.users) {
|
||||||
this.leave(user);
|
this.leave(user);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user