mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-12 02:51:22 +00:00
only wait between each chunk after the initial map was sent
This commit is contained in:
parent
591a4ed8df
commit
12620716e7
1 changed files with 8 additions and 7 deletions
|
|
@ -40,7 +40,7 @@ function inject(serv, player) {
|
|||
return t;
|
||||
}
|
||||
|
||||
player.sendNearbyChunks = view =>
|
||||
player.sendNearbyChunks = (view,group) =>
|
||||
{
|
||||
player.lastPositionChunkUpdated=player.entity.position;
|
||||
var playerChunkX=Math.floor(player.entity.position.x/16/32);
|
||||
|
|
@ -57,11 +57,12 @@ function inject(serv, player) {
|
|||
if(!loaded) player.loadedChunks[key]=1;
|
||||
return !loaded;
|
||||
})
|
||||
.reduce((acc,{chunkX,chunkZ})=>
|
||||
acc
|
||||
.then(() => player.world.getColumn(chunkX,chunkZ))
|
||||
.then((column) => player.sendChunk(chunkX,chunkZ,column))
|
||||
.then(() => sleep(5))
|
||||
.reduce((acc,{chunkX,chunkZ},i)=> {
|
||||
var p=acc
|
||||
.then(() => player.world.getColumn(chunkX, chunkZ))
|
||||
.then((column) => player.sendChunk(chunkX, chunkZ, column));
|
||||
return group ? p.then(() => sleep(5)) : p;
|
||||
}
|
||||
,Promise.resolve());
|
||||
};
|
||||
|
||||
|
|
@ -78,7 +79,7 @@ function inject(serv, player) {
|
|||
player.sendRestMap = () =>
|
||||
{
|
||||
player.sendingChunks=true;
|
||||
player.sendNearbyChunks(player.view)
|
||||
player.sendNearbyChunks(player.view,true)
|
||||
.then(() => player.sendingChunks=false)
|
||||
.catch((err)=> setTimeout(() => {throw err;},0));
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue