Skip to content

voxel/voxel-mine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

mining blocks with damage overlay and variable hardness (addon for voxel.js)

Resources

Stars

Watchers

Forks

Packages

No packages published