Browse Source

work

tags/v0.11.0
Shaun 2 years ago
parent
commit
012809dffd
1 changed files with 22 additions and 5 deletions
  1. +22
    -5
      src/server/world/atlas.js

+ 22
- 5
src/server/world/atlas.js View File

@@ -58,6 +58,27 @@ module.exports = {
}
});
},

removeObjectFromInstancedZone: async function (thread, obj, callback) {
await new Promise(res => {
const cb = this.registerCallback(res);

thread.worker.send({
method: 'forceSavePlayer',
args: {
playerName: obj.name,
callbackId: cb
}
});
});

thread.worker.kill();
this.threads.spliceWhere(t => t === thread);

if (callback)
callback();
},

removeObject: function (obj, skipLocal, callback) {
if (!skipLocal)
objects.removeObject(obj);
@@ -67,11 +88,7 @@ module.exports = {
return;

if (thread.instanced) {
thread.worker.kill();
this.threads.spliceWhere(t => t === thread);

if (callback)
callback();
this.removeObjectFromInstancedZone(thread, obj, callback);

return;
}


Loading…
Cancel
Save