voxel-mine

1.0.0 • Public • Published

voxel-mine

An addon for voxel.js to mine blocks of variable hardness. Hold down the left mouse button to mine:

screenshot

Hardness can be set for each block type (controls how long it takes to mine). As the mining progresses, damage overlay textures (not included, example is from ProgrammerArt) are shown:

screenshot

The 'break' event is sent when the mining completes. You can listen to this event and setBlock to 0 to remove the block, or use voxel-harvest to do this for you and add an item representing the block to a (player's) inventory, therefore "harvesting" the mined block. voxel-mine doesn't harvest the blocks automatically, it merely sends an event when the mining process is complete, to be handled appropriately by other code.

Usage

var createMine = require('voxel-mine');
var mine = createMine(game, opts);

mine.on('break', function(target) {
  // do something to this voxel (remove it, etc.)
});

or with voxel-plugins:

plugins.load('mine', opts);

see source for supported/required options

Requires voxel-reach

License

MIT

Dependents (0)

Package Sidebar

Install

npm i voxel-mine

Weekly Downloads

5

Version

1.0.0

License

MIT

Last publish

Collaborators

  • deathcap