mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-24 17:21:43 +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;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendNearbyChunks = view =>
|
player.sendNearbyChunks = (view,group) =>
|
||||||
{
|
{
|
||||||
player.lastPositionChunkUpdated=player.entity.position;
|
player.lastPositionChunkUpdated=player.entity.position;
|
||||||
var playerChunkX=Math.floor(player.entity.position.x/16/32);
|
var playerChunkX=Math.floor(player.entity.position.x/16/32);
|
||||||
|
|
@ -57,11 +57,12 @@ function inject(serv, player) {
|
||||||
if(!loaded) player.loadedChunks[key]=1;
|
if(!loaded) player.loadedChunks[key]=1;
|
||||||
return !loaded;
|
return !loaded;
|
||||||
})
|
})
|
||||||
.reduce((acc,{chunkX,chunkZ})=>
|
.reduce((acc,{chunkX,chunkZ},i)=> {
|
||||||
acc
|
var p=acc
|
||||||
.then(() => player.world.getColumn(chunkX,chunkZ))
|
.then(() => player.world.getColumn(chunkX, chunkZ))
|
||||||
.then((column) => player.sendChunk(chunkX,chunkZ,column))
|
.then((column) => player.sendChunk(chunkX, chunkZ, column));
|
||||||
.then(() => sleep(5))
|
return group ? p.then(() => sleep(5)) : p;
|
||||||
|
}
|
||||||
,Promise.resolve());
|
,Promise.resolve());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -78,7 +79,7 @@ function inject(serv, player) {
|
||||||
player.sendRestMap = () =>
|
player.sendRestMap = () =>
|
||||||
{
|
{
|
||||||
player.sendingChunks=true;
|
player.sendingChunks=true;
|
||||||
player.sendNearbyChunks(player.view)
|
player.sendNearbyChunks(player.view,true)
|
||||||
.then(() => player.sendingChunks=false)
|
.then(() => player.sendingChunks=false)
|
||||||
.catch((err)=> setTimeout(() => {throw err;},0));
|
.catch((err)=> setTimeout(() => {throw err;},0));
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue