When a user moves, do not trigger group creation
In order to avoid triggering group creation when walking next to someone we should avoid creating a group unless the user stops next to the other members of the group.
This commit is contained in:
parent
c8434dfd4c
commit
b7854dfb90
@ -56,7 +56,7 @@ export class GameRoom {
|
|||||||
this.anonymous = isRoomAnonymous(roomId);
|
this.anonymous = isRoomAnonymous(roomId);
|
||||||
this.tags = [];
|
this.tags = [];
|
||||||
this.policyType = GameRoomPolicyTypes.ANONYMUS_POLICY;
|
this.policyType = GameRoomPolicyTypes.ANONYMUS_POLICY;
|
||||||
|
|
||||||
if (this.anonymous) {
|
if (this.anonymous) {
|
||||||
this.roomSlug = extractRoomSlugPublicRoomId(this.roomId);
|
this.roomSlug = extractRoomSlugPublicRoomId(this.roomId);
|
||||||
} else {
|
} else {
|
||||||
@ -65,8 +65,8 @@ export class GameRoom {
|
|||||||
this.organizationSlug = organizationSlug;
|
this.organizationSlug = organizationSlug;
|
||||||
this.worldSlug = worldSlug;
|
this.worldSlug = worldSlug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.users = new Map<number, User>();
|
this.users = new Map<number, User>();
|
||||||
this.groups = new Set<Group>();
|
this.groups = new Set<Group>();
|
||||||
this.connectCallback = connectCallback;
|
this.connectCallback = connectCallback;
|
||||||
@ -138,6 +138,12 @@ export class GameRoom {
|
|||||||
if (user.group === undefined) {
|
if (user.group === undefined) {
|
||||||
// If the user is not part of a group:
|
// If the user is not part of a group:
|
||||||
// should he join a group?
|
// should he join a group?
|
||||||
|
|
||||||
|
// If the user is moving, don't try to join
|
||||||
|
if (user.getPosition().moving) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const closestItem: User|Group|null = this.searchClosestAvailableUserOrGroup(user);
|
const closestItem: User|Group|null = this.searchClosestAvailableUserOrGroup(user);
|
||||||
|
|
||||||
if (closestItem !== null) {
|
if (closestItem !== null) {
|
||||||
@ -275,7 +281,7 @@ export class GameRoom {
|
|||||||
return this.itemsState;
|
return this.itemsState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
setViewport(socket : Identificable, viewport: ViewportInterface): Movable[] {
|
setViewport(socket : Identificable, viewport: ViewportInterface): Movable[] {
|
||||||
const user = this.users.get(socket.userId);
|
const user = this.users.get(socket.userId);
|
||||||
if(typeof user === 'undefined') {
|
if(typeof user === 'undefined') {
|
||||||
|
Loading…
Reference in New Issue
Block a user