removed delay for ladder and lcdclock.

This commit is contained in:
walterhiggins 2015-01-03 11:08:40 +00:00
parent c7e2eeed85
commit dad20186d7
4 changed files with 42 additions and 30 deletions

View File

@ -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' );
}

View File

@ -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() {

View File

@ -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 );
};

View File

@ -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();
}
});