How to use the flying-squid.generatePortal function in flying-squid

To help you get started, we’ve selected a few flying-squid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PrismarineJS / flying-squid / test / portal_detector.js View on Github external
it("generate a portal", () => {
    assert.deepEqual(generatePortal(new Vec3(2,1,1),new Vec3(1,0,0),4,5),{
      bottom:generateLine(new Vec3(3,1,1),new Vec3(1,0,0),2),
      left:generateLine(new Vec3(2,2,1),new Vec3(0,1,0),3),
      right:generateLine(new Vec3(5,2,1),new Vec3(0,1,0),3),
      top:generateLine(new Vec3(3,5,1),new Vec3(1,0,0),2),
      air:generateLine(new Vec3(3,2,1),new Vec3(0,1,0),3).concat(generateLine(new Vec3(4,2,1),new Vec3(0,1,0),3))
    })
  });
});
github PrismarineJS / flying-squid / test / portal_detector.js View on Github external
portalData.forEach(({name,bottomLeft,direction,width,height,additionalAir,additionalObsidian}) => {
    const portal = generatePortal(bottomLeft, direction, width, height);
    const {bottom,left,right,top}=portal;
    describe("Doesn't detect detect " + name, () => {
      let world;
      before(async function () {
        world=await makeWorldWithPortal(portal, additionalAir, additionalObsidian);
      });

      describe("doesn't detect portals",function(){
        it("doesn't detect portals from bottom left",async function() {
          const portals=await detectFrame(world,bottom[0],new Vec3(0,1,0));
          assert.deepEqual(portals,[])
        });
        it("doesn't detect portals from top left",async function() {
          const portals=await detectFrame(world,top[0],new Vec3(0,-1,0));
          assert.deepEqual(portals,[])
        });
github PrismarineJS / flying-squid / test / portal_detector.js View on Github external
direction:new Vec3(1,0,0),
    width:10,
    height:10,
    additionalAir:[],
    additionalObsidian:[]
  });
  portalData.push({
    name:"simple portal frame x with borders",
    bottomLeft:new Vec3(2,1,1),
    direction:new Vec3(1,0,0),
    width:4,
    height:5,
    additionalAir:[],
    additionalObsidian:[new Vec3(2,1,1),new Vec3(5,1,1),new Vec3(2,6,1),new Vec3(5,6,1)]
  });
  const {bottom,left,right,top,air}=generatePortal(new Vec3(2,1,2),new Vec3(1,0,0),4,5);

  portalData.push({
    name:"2 portals",
    bottomLeft:new Vec3(2,1,1),
    direction:new Vec3(1,0,0),
    width:4,
    height:5,
    additionalAir:air,
    additionalObsidian:[].concat.apply([], [bottom, left, right,top])
  });


  portalData.push({
    name:"huge simple portal frame z",
    bottomLeft:new Vec3(2,1,1),
    direction:new Vec3(0,0,1),