Fix error mapping refresh in back & the end of this feature development

This commit is contained in:
gparant 2020-05-10 23:49:08 +02:00
parent 8b9c36e3be
commit f4af824cf9
21 changed files with 17 additions and 1840 deletions

View file

@ -49,7 +49,7 @@
{
"name":"exitSceneUrl",
"type":"string",
"value":"\/map\/files\/Floor1\/floor1.json"
"value":"\/Floor1\/floor1.json"
}],
"type":"tilelayer",
"visible":true,

View file

@ -43,7 +43,7 @@
{
"name":"exitSceneUrl",
"type":"string",
"value":"\/map\/files\/Floor0\/floor0.json"
"value":"\/Floor0\/floor0.json"
}],
"type":"tilelayer",
"visible":true,

View file

@ -305,7 +305,7 @@ export class IoSocketController {
if (!rooms.refreshUserPosition) {
rooms.refreshUserPosition = RefreshUserPositionFunction;
}
rooms.refreshUserPosition(rooms, this.Io);
rooms.refreshUserPosition(rooms, this.Io, this.Worlds);
}
//Hydrate and manage error

View file

@ -1,5 +1,5 @@
const SECRET_KEY = process.env.SECRET_KEY || "THECODINGMACHINE_SECRET_KEY";
const URL_ROOM_STARTED = "/map/files/Floor0/floor0.json";
const URL_ROOM_STARTED = "/Floor0/floor0.json";
const MINIMUM_DISTANCE = process.env.MINIMUM_DISTANCE ? Number(process.env.MINIMUM_DISTANCE) : 64;
const GROUP_RADIUS = process.env.GROUP_RADIUS ? Number(process.env.GROUP_RADIUS) : 48;

View file

@ -40,12 +40,16 @@ let RefreshUserPositionFunction = function(rooms : ExtRooms, Io: socketIO.Server
mapPositionUserByRoom.set(data.roomId, dataArray);
// update position in the worl
if (!Worlds) {
return;
}
let messageUserPosition = new MessageUserPosition(data);
let world = Worlds.get(messageUserPosition.roomId);
if(world) {
world.updatePosition(messageUserPosition);
Worlds.set(messageUserPosition.roomId, world);
if (!world) {
return;
}
world.updatePosition(messageUserPosition);
Worlds.set(messageUserPosition.roomId, world);
}
rooms.userPositionMapByRoom = Array.from(mapPositionUserByRoom);
}