@@ -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) | // 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); | 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({ | process.send({ | ||||
method: 'events', | method: 'events', | ||||
@@ -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) { | if (player.name) { | ||||
@@ -12,23 +12,24 @@ const unstageRezone = msg => { | |||||
stagedRezones.spliceWhere(s => s.simplifiedObj.serverId === msg.obj.id); | stagedRezones.spliceWhere(s => s.simplifiedObj.serverId === msg.obj.id); | ||||
}; | }; | ||||
const stageRezone = (simplifiedObj, targetZone) => { | |||||
const stageRezone = ({ simplifiedObj, targetZone, keepPos = false }) => { | |||||
const { serverId } = simplifiedObj; | const { serverId } = simplifiedObj; | ||||
stagedRezones.spliceWhere(o => o.simplifiedObj.serverId === serverId); | stagedRezones.spliceWhere(o => o.simplifiedObj.serverId === serverId); | ||||
stagedRezones.push({ simplifiedObj, targetZone }); | |||||
stagedRezones.push({ simplifiedObj, targetZone, keepPos }); | |||||
}; | }; | ||||
const doRezone = stagedRezone => { | const doRezone = stagedRezone => { | ||||
const { simplifiedObj, targetZone } = stagedRezone; | |||||
const { simplifiedObj, targetZone, keepPos } = stagedRezone; | |||||
process.send({ | process.send({ | ||||
method: 'rezone', | method: 'rezone', | ||||
id: simplifiedObj.serverId, | id: simplifiedObj.serverId, | ||||
args: { | args: { | ||||
obj: simplifiedObj, | obj: simplifiedObj, | ||||
newZone: targetZone | |||||
newZone: targetZone, | |||||
keepPos | |||||
} | } | ||||
}); | }); | ||||
}; | }; | ||||
@@ -292,8 +292,8 @@ const returnWhenThreadsIdle = async () => { | |||||
const spawnMapThreads = async () => { | const spawnMapThreads = async () => { | ||||
const promises = mapList | 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); | await Promise.all(promises); | ||||
}; | }; | ||||