mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-20 06:51:42 +00:00
fix an async problem with portal generation, check huge portals work
This commit is contained in:
parent
067128e8c9
commit
a999bbdda1
3 changed files with 14 additions and 6 deletions
|
|
@ -65,8 +65,8 @@ module.exports.player=function(player,serv) {
|
|||
},
|
||||
async action({bottomLeft,direction,width,height}) {
|
||||
var portal=generatePortal(bottomLeft,direction,width,height);
|
||||
await addPortalToWorld(player.world,portal,[],[],(pos,type) => {
|
||||
serv.setBlock(player.world,pos,type,0);
|
||||
await addPortalToWorld(player.world,portal,[],[],async (pos,type) => {
|
||||
await serv.setBlock(player.world,pos,type,0);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -145,10 +145,7 @@ function addPortalToWorld(world,portal,additionalAir,additionalObsidian,setBlock
|
|||
|
||||
async function makeWorldWithPortal(portal,additionalAir,additionalObsidian)
|
||||
{
|
||||
|
||||
var world=new World();
|
||||
var chunk=new Chunk();
|
||||
await world.setColumn(0,0,chunk);
|
||||
var world=new World(() => new Chunk());
|
||||
await addPortalToWorld(world,portal,additionalAir,additionalObsidian);
|
||||
|
||||
return world;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,17 @@ describe("Detect portal", function() {
|
|||
});
|
||||
|
||||
|
||||
portalData.push({
|
||||
name:"huge simple portal frame z",
|
||||
bottomLeft:new Vec3(2,1,1),
|
||||
direction:new Vec3(0,0,1),
|
||||
width:50,
|
||||
height:50,
|
||||
additionalAir:[],
|
||||
additionalObsidian:[]
|
||||
});
|
||||
|
||||
|
||||
portalData.forEach(({name,bottomLeft,direction,width,height,additionalAir,additionalObsidian}) => {
|
||||
var portal=generatePortal(bottomLeft,direction,width,height);
|
||||
var {bottom,left,right,top,air}=portal;
|
||||
|
|
|
|||
Loading…
Reference in a new issue