Browse Source

bug #1995

tags/v0.12.0.21^2
Shaun 11 months ago
parent
commit
2e2749bdb7
1 changed files with 26 additions and 32 deletions
  1. +26
    -32
      src/server/world/instancer.js

+ 26
- 32
src/server/world/instancer.js View File

@@ -319,15 +319,7 @@ module.exports = {
if (this.regenBusy) {
this.unqueueMessage(msg);

if (msg.callbackId) {
process.send({
module: 'atlas',
method: 'resolveCallback',
msg: {
id: msg.callbackId
}
});
}
this.resolveCallback(msg);

return;
}
@@ -339,7 +331,9 @@ module.exports = {
let obj = msg.obj;
obj = objects.find(o => o.serverId === obj.id);
if (!obj) {
//We should probably never reach this
//We could reach this if a player dc's while zoning in
this.resolveCallback(msg);

return;
}

@@ -354,15 +348,7 @@ module.exports = {

obj.destroyed = true;

if (msg.callbackId) {
process.send({
module: 'atlas',
method: 'resolveCallback',
msg: {
id: msg.callbackId
}
});
}
this.resolveCallback(msg);
},

notifyOnceIdle: async function () {
@@ -373,7 +359,8 @@ module.exports = {
});
},

forceSavePlayer: async function ({ playerId, callbackId }) {
forceSavePlayer: async function (msg) {
const { playerId } = msg;
const player = objects.objects.find(o => o.serverId === playerId);

if (!player?.auth) {
@@ -388,25 +375,32 @@ module.exports = {

await player.auth.doSave();

process.send({
module: 'atlas',
method: 'resolveCallback',
msg: {
id: callbackId
this.resolveCallback(msg);
},

getPlayerCount: function (msg) {
this.resolveCallback(msg, {
result: {
playerCount: objects.objects.filter(o => o.player !== undefined).length
}
});
},

getPlayerCount: function ({ callbackId }) {
process.send({
resolveCallback: function ({ callbackId }, data) {
if (!callbackId)
return;

const payload = {
module: 'atlas',
method: 'resolveCallback',
msg: {
id: callbackId,
result: {
playerCount: objects.objects.filter(o => o.player !== undefined).length
}
id: callbackId
}
});
};

if (data)
Object.assign(payload.msg, data);

process.send(payload);
}
};

Loading…
Cancel
Save