From dad20186d7d85e50cd25c23b4c2f68dc290912d5 Mon Sep 17 00:00:00 2001 From: walterhiggins Date: Sat, 3 Jan 2015 11:08:40 +0000 Subject: [PATCH] removed delay for ladder and lcdclock. --- src/main/js/plugins/drone/blocktype.js | 6 ++-- .../js/plugins/drone/contrib/lcd-clock.js | 33 +++++++++++++------ src/main/js/plugins/drone/drone.js | 29 ++++++++-------- src/main/js/plugins/drone/ladder.js | 4 +-- 4 files changed, 42 insertions(+), 30 deletions(-) diff --git a/src/main/js/plugins/drone/blocktype.js b/src/main/js/plugins/drone/blocktype.js index 1a2c21e..7710381 100644 --- a/src/main/js/plugins/drone/blocktype.js +++ b/src/main/js/plugins/drone/blocktype.js @@ -326,7 +326,7 @@ for ( c in bitmaps.raw ) { } } } -function blocktype( message, fg, bg ) { +function blocktype( message, fg, bg, immediate ) { var bmfg, bmbg, @@ -373,7 +373,7 @@ function blocktype( message, fg, bg ) { charWidth = bits.width; if ( typeof bg != 'undefined' ) { - this.cuboidX( bmbg[0], bmbg[1], charWidth, 7, 1 ); + this.cuboidX( bmbg[0], bmbg[1], charWidth, 7, 1 , immediate); } for ( j = 0; j < bits.pixels.length; j++ ) { @@ -381,7 +381,7 @@ function blocktype( message, fg, bg ) { this.chkpt( 'btbl' ); x = bits.pixels[ j ][ 0 ]; y = bits.pixels[ j ][ 1] ; - this.up( 6 - y ).right( x ).cuboidX( bmfg[ 0 ], bmfg[ 1 ] ); + this.up( 6 - y ).right( x ).cuboidX( bmfg[ 0 ], bmfg[ 1 ], 1, 1, 1, immediate); this.move( 'btbl' ); } diff --git a/src/main/js/plugins/drone/contrib/lcd-clock.js b/src/main/js/plugins/drone/contrib/lcd-clock.js index 34baa9e..0cfd769 100644 --- a/src/main/js/plugins/drone/contrib/lcd-clock.js +++ b/src/main/js/plugins/drone/contrib/lcd-clock.js @@ -33,15 +33,28 @@ exports.LCDClock = function(drone, fgColor,bgColor,border) { // updating all 4 digits each time is expensive // only update digits which have changed (in most cases - just 1) // - if (digits[3] != lastSecs[3]) - drone.right(14).blocktype(''+digits[3],fgColor,bgColor).left(14); - if (digits[2] != lastSecs[2]) - drone.right(10).blocktype(''+digits[2],fgColor,bgColor).left(10); - if (digits[1] != lastSecs[1]) - drone.right(4).blocktype(''+digits[1], fgColor, bgColor).left(4); - if (digits[0] != lastSecs[0]) - drone.blocktype(''+digits[0], fgColor, bgColor); - + if (digits[3] != lastSecs[3]){ + drone + .right(14) + .blocktype(''+digits[3],fgColor,bgColor, true) + .left(14); + } + if (digits[2] != lastSecs[2]){ + drone + .right(10) + .blocktype(''+digits[2],fgColor,bgColor, true) + .left(10); + } + if (digits[1] != lastSecs[1]){ + drone + .right(4) + .blocktype(''+digits[1], fgColor, bgColor, true) + .left(4); + } + if (digits[0] != lastSecs[0]){ + drone + .blocktype(''+digits[0], fgColor, bgColor, true); + } lastSecs[0] = digits[0]; lastSecs[1] = digits[1]; lastSecs[2] = digits[2]; @@ -58,7 +71,7 @@ exports.LCDClock = function(drone, fgColor,bgColor,border) { drone.box(border,21,9,1); drone.up().right(); } - drone.blocktype('00:00', fgColor, bgColor); + drone.blocktype('00:00', fgColor, bgColor, true); return { start24: function( ) { function tick() { diff --git a/src/main/js/plugins/drone/drone.js b/src/main/js/plugins/drone/drone.js index d66c7e8..5ceb569 100644 --- a/src/main/js/plugins/drone/drone.js +++ b/src/main/js/plugins/drone/drone.js @@ -711,24 +711,23 @@ Drone.prototype.cuboidX = function( blockType, meta, w, h, d, immediate ) { Drone.prototype.then = function( next ){ getQueue(this).push( next.bind( Drone.clone(this) ) ); }; -Drone.prototype.cuboid = function( block, w, h, d ) { +Drone.prototype.cuboid = function( block, w, h, d, immediate ) { var bm = this._getBlockIdAndMeta( block ); - return this.cuboidX( bm[0], bm[1], w, h, d ); + return this.cuboidX( bm[0], bm[1], w, h, d, immediate); }; -Drone.prototype.cuboid0 = function( block, w, h, d ) { - this.chkpt( 'start_point' ); - - // Front wall - this.cuboid( block, w, h, 1 ); - // Left wall - this.cuboid( block, 1, h, d ); - // Right wall - this.right( w - 1 ).cuboid( block, 1, h, d ).left( w - 1 ); - // Back wall - this.fwd( d - 1 ).cuboid( block, w, h, 1 ); - - return this.move( 'start_point' ); +Drone.prototype.cuboid0 = function( block, w, h, d, immediate ) { + var start = 'cuboid0' + w + h + d + immediate; + this + .chkpt( start ) + .cuboid( block, w, h, 1, immediate ) // Front wall + .cuboid( block, 1, h, d, immediate ) // Left wall + .right( w - 1 ) + .cuboid( block, 1, h, d, immediate ) // Right wall + .left( w - 1 ) + .fwd( d - 1 ) + .cuboid( block, w, h, 1, immediate ) // Back wall + .move( start ); }; diff --git a/src/main/js/plugins/drone/ladder.js b/src/main/js/plugins/drone/ladder.js index 78ef5e0..6e29116 100644 --- a/src/main/js/plugins/drone/ladder.js +++ b/src/main/js/plugins/drone/ladder.js @@ -31,11 +31,11 @@ function ladder( height ){ this.then(function ladderLater(){ var block = this.getBlock(); if (block.typeId == blocks.air || block.typeId == blocks.ladder){ - this.box(blocks.ladder, 1, height, 1); + this.box(blocks.ladder, 1, height, 1, true); } else { this .back() - .box(blocks.ladder, 1, height, 1) + .box(blocks.ladder, 1, height, 1, true) .fwd(); } });