How to use flying-squid - 10 common examples

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 / src / lib / plugins / login.js View on Github external
serv._server.on('login', async (client) => {
    if (client.socket.listeners('end').length === 0) return // TODO: should be fixed properly in nmp instead
    try {
      const player = serv.initEntity('player', null, serv.overworld, new Vec3(0, 0, 0))
      player._client = client

      player.profileProperties = player._client.profile ? player._client.profile.properties : []
      player.commands = new Command({})
      Object.keys(plugins)
        .filter(pluginName => plugins[pluginName].player !== undefined)
        .forEach(pluginName => plugins[pluginName].player(player, serv, options))

      serv.emit('newPlayer', player)
      player.emit('asap')
      await player.login()
    } catch (err) {
      setTimeout(() => { throw err }, 0)
    }
  })
}
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
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
it("generate a line",() => {
    assert.deepEqual(generateLine(new Vec3(3,1,1),new Vec3(1,0,0),2),[new Vec3(3, 1, 1), new Vec3(4, 1, 1)])
  });
  it("generate a portal", () => {
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
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
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
it("find borders from left", async function () {
          const border = await findBorder(world, {
            "direction": new Vec3(0, 1, 0),
            "line": left
          },direction);
          assert.deepEqual(border, expectedBorder)
        });
        it("find borders from right", async function () {
github PrismarineJS / flying-squid / test / portal_detector.js View on Github external
it("find borders from bottom", async function () {
          const border = await findBorder(world, {
            "direction": direction,
            "line": bottom
          }, new Vec3(0, 1, 0));
          assert.deepEqual(border, expectedBorder)
        });
github PrismarineJS / flying-squid / test / portal_detector.js View on Github external
it("find borders from right", async function () {
          const border = await findBorder(world, {
            "direction": new Vec3(0, 1, 0),
            "line": right
          }, direction.scaled(-1));
          assert.deepEqual(border, expectedBorder)
        });
      });