From dd693af91dedba2a6588a0c4aa4e2a6b429a3c02 Mon Sep 17 00:00:00 2001 From: walterhiggins Date: Sat, 3 Jan 2015 13:12:51 +0000 Subject: [PATCH] stairs are queued --- src/main/js/plugins/drone/stairs.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/main/js/plugins/drone/stairs.js b/src/main/js/plugins/drone/stairs.js index 7aa9fd4..f0e61d7 100644 --- a/src/main/js/plugins/drone/stairs.js +++ b/src/main/js/plugins/drone/stairs.js @@ -30,23 +30,30 @@ To build an oak staircase 3 blocks wide and 5 blocks tall: Staircases do not have any blocks beneath them. ***/ -var Drone = require('./drone').Drone; +var Drone = require('./drone').Drone, + blocks = require('blocks'); /*global require*/ function stairs(blockType, width, height){ if (typeof width === 'undefined') width = 1; if (typeof height === 'undefined') height = 1; - this.chkpt('_stairs'); - var bm = this._getBlockIdAndMeta(blockType); - while (height > 0) { - this.traverseWidth(width, function(){ - this.setBlock(bm[0], bm[1]); - }); - - this.fwd().up(); - height -= 1; + if (typeof blockType === 'undefined'){ + blockType = blocks.stairs.oak; } - 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);