Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    voxel-reachpublic

    voxel-reach

    A simple module for voxel-engine to listen for fire/firealt events, raycast the voxel within reach, and send mining/interact events for the hit voxel.

    Used by:

    Installation

    npm install voxel-reach
    

    Example

    var createReach = require('voxel-reach');
    
    reach = createReach(game, {reachDistance: 8});
    
    reach.on('use', function(target) { 
      if (target)
        game.createBlock(target.adjacent, 1);
    });
    
    reach.on('mining', function(target) { 
      if (target)
        game.setBlock(target.voxel, 0);
    });
    

    License

    MIT

    install

    npm i voxel-reach

    Downloadsweekly downloads

    1

    version

    0.2.2

    license

    MIT

    homepage

    github.com

    last publish

    collaborators

    • avatar