Browse Source

bug #1915: Fixed player position resetting when joining random maps

tags/v0.11.0
Shaun 2 years ago
parent
commit
9439ab95f3
2 changed files with 7 additions and 3 deletions
  1. +2
    -1
      src/server/components/player.js
  2. +5
    -2
      src/server/world/instancer.js

+ 2
- 1
src/server/components/player.js View File

@@ -35,7 +35,8 @@ module.exports = {
hidden: character.dead || null,
account: character.account,
zoneName: character.zoneName || clientConfig.config.defaultZone,
zoneId: character.zoneId || null
zoneId: character.zoneId || null,
zoneMapSeed: character.zoneMapSeed
});

character.components = character.components || [];


+ 5
- 2
src/server/world/instancer.js View File

@@ -212,12 +212,15 @@ module.exports = {
if (msg.keepPos && (!physics.isValid(obj.x, obj.y) || !map.canPathFromPos(obj)))
msg.keepPos = false;

if (!msg.keepPos || !obj.has('x') || (map.mapFile.properties.isRandom && obj.instanceId !== map.seed)) {
if (!msg.keepPos || !obj.has('x') || (map.mapFile.properties.isRandom && obj.zoneMapSeed !== map.seed)) {
obj.x = spawnPos.x;
obj.y = spawnPos.y;
}

obj.instanceId = map.seed || null;
if (map.seed)
obj.zoneMapSeed = map.seed;
else
delete obj.zoneMapSeed;

obj.spawn = map.spawn;



Loading…
Cancel
Save