stairs are queued
This commit is contained in:
parent
62821db815
commit
dd693af91d
1 changed files with 18 additions and 11 deletions
|
@ -30,23 +30,30 @@ 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'){
|
||||||
var bm = this._getBlockIdAndMeta(blockType);
|
blockType = blocks.stairs.oak;
|
||||||
while (height > 0) {
|
|
||||||
this.traverseWidth(width, function(){
|
|
||||||
this.setBlock(bm[0], bm[1]);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.fwd().up();
|
|
||||||
height -= 1;
|
|
||||||
}
|
}
|
||||||
this.move('_stairs');
|
this.then(function(){
|
||||||
|
var bm = this._getBlockIdAndMeta(blockType);
|
||||||
|
this.chkpt('_stairs');
|
||||||
|
while (height > 0) {
|
||||||
|
this.traverseWidth(width, function(){
|
||||||
|
this.setBlock(bm[0], bm[1]);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.fwd().up();
|
||||||
|
height -= 1;
|
||||||
|
}
|
||||||
|
this.move('_stairs');
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
Drone.extend(stairs);
|
Drone.extend(stairs);
|
||||||
|
|
Reference in a new issue