Browse Source

work

1993-leagues
Shaun 11 months ago
parent
commit
b00467c809
4 changed files with 23 additions and 14 deletions
  1. +9
    -5
      src/server/components/portal/sendObjToZone.js
  2. +7
    -3
      src/server/security/connections.js
  3. +5
    -4
      src/server/world/rezoneManager.js
  4. +2
    -2
      src/server/world/threadManager.js

+ 9
- 5
src/server/components/portal/sendObjToZone.js View File

@@ -50,11 +50,15 @@ const sendObjToZone = async ({ obj, invokingObj, zoneName, toPos, toRelativePos
// So physics will carry on and allow the obj to move onto the next tile (changing the position while we save above)
fixPosition(obj, toPos, toRelativePos, invokingObj);

const simpleObj = obj.getSimple(true, false, true);
simpleObj.destroyed = false;
simpleObj.forceDestroy = false;

rezoneManager.stageRezone(simpleObj, zoneName);
const simplifiedObj = obj.getSimple(true, false, true);
simplifiedObj.destroyed = false;
simplifiedObj.forceDestroy = false;

rezoneManager.stageRezone({
simplifiedObj,
targetZone: zoneName,
keepPos: !!toPos
});

process.send({
method: 'events',


+ 7
- 3
src/server/security/connections.js View File

@@ -44,9 +44,13 @@ module.exports = {
}]
});

await new Promise(res => {
atlas.removeObject(player, false, res);
});
//If the player doesn't have a 'social' component, they are no longer in a threat
// Likely due to unzoning (character select screen)
if (player.components.some(c => c.type === 'social')) {
await new Promise(res => {
atlas.removeObject(player, false, res);
});
}
}

if (player.name) {


+ 5
- 4
src/server/world/rezoneManager.js View File

@@ -12,23 +12,24 @@ const unstageRezone = msg => {
stagedRezones.spliceWhere(s => s.simplifiedObj.serverId === msg.obj.id);
};

const stageRezone = (simplifiedObj, targetZone) => {
const stageRezone = ({ simplifiedObj, targetZone, keepPos = false }) => {
const { serverId } = simplifiedObj;

stagedRezones.spliceWhere(o => o.simplifiedObj.serverId === serverId);

stagedRezones.push({ simplifiedObj, targetZone });
stagedRezones.push({ simplifiedObj, targetZone, keepPos });
};

const doRezone = stagedRezone => {
const { simplifiedObj, targetZone } = stagedRezone;
const { simplifiedObj, targetZone, keepPos } = stagedRezone;

process.send({
method: 'rezone',
id: simplifiedObj.serverId,
args: {
obj: simplifiedObj,
newZone: targetZone
newZone: targetZone,
keepPos
}
});
};


+ 2
- 2
src/server/world/threadManager.js View File

@@ -292,8 +292,8 @@ const returnWhenThreadsIdle = async () => {

const spawnMapThreads = async () => {
const promises = mapList
.filter(m => !m.disabled && !m.instanced && m.autoSpawn !== false)
.map(m => spawnThread(m));
.filter(m => m.autoSpawn === true)
.map(m => spawnThread({ map: m }));

await Promise.all(promises);
};


Loading…
Cancel
Save