stairs are queued

This commit is contained in:
walterhiggins 2015-01-03 13:12:51 +00:00
parent 62821db815
commit dd693af91d

View file

@ -30,15 +30,20 @@ To build an oak staircase 3 blocks wide and 5 blocks tall:
Staircases do not have any blocks beneath them. Staircases do not have any blocks beneath them.
***/ ***/
var Drone = require('./drone').Drone; var Drone = require('./drone').Drone,
blocks = require('blocks');
/*global require*/ /*global require*/
function stairs(blockType, width, height){ function stairs(blockType, width, height){
if (typeof width === 'undefined') if (typeof width === 'undefined')
width = 1; width = 1;
if (typeof height === 'undefined') if (typeof height === 'undefined')
height = 1; height = 1;
this.chkpt('_stairs'); if (typeof blockType === 'undefined'){
blockType = blocks.stairs.oak;
}
this.then(function(){
var bm = this._getBlockIdAndMeta(blockType); var bm = this._getBlockIdAndMeta(blockType);
this.chkpt('_stairs');
while (height > 0) { while (height > 0) {
this.traverseWidth(width, function(){ this.traverseWidth(width, function(){
this.setBlock(bm[0], bm[1]); this.setBlock(bm[0], bm[1]);
@ -48,5 +53,7 @@ function stairs(blockType, width, height){
height -= 1; height -= 1;
} }
this.move('_stairs'); this.move('_stairs');
});
} }
Drone.extend(stairs); Drone.extend(stairs);