Merge pull request #362 from thecodingmachine/movenospeak
When a user moves, do not trigger group creation
This commit is contained in:
commit
8d0b78072e
2 changed files with 11 additions and 5 deletions
|
@ -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) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ function createMockUser(userId: number): ExSocketInterface {
|
||||||
} as ExSocketInterface;
|
} as ExSocketInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("World", () => {
|
describe("GameRoom", () => {
|
||||||
it("should connect user1 and user2", () => {
|
it("should connect user1 and user2", () => {
|
||||||
let connectCalledNumber: number = 0;
|
let connectCalledNumber: number = 0;
|
||||||
const connect: ConnectCallback = (user: User, group: Group): void => {
|
const connect: ConnectCallback = (user: User, group: Group): void => {
|
Loading…
Add table
Add a link
Reference in a new issue