removed delay for ladder and lcdclock.
This commit is contained in:
parent
c7e2eeed85
commit
dad20186d7
4 changed files with 42 additions and 30 deletions
|
@ -326,7 +326,7 @@ for ( c in bitmaps.raw ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function blocktype( message, fg, bg ) {
|
function blocktype( message, fg, bg, immediate ) {
|
||||||
|
|
||||||
var bmfg,
|
var bmfg,
|
||||||
bmbg,
|
bmbg,
|
||||||
|
@ -373,7 +373,7 @@ function blocktype( message, fg, bg ) {
|
||||||
charWidth = bits.width;
|
charWidth = bits.width;
|
||||||
|
|
||||||
if ( typeof bg != 'undefined' ) {
|
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++ ) {
|
for ( j = 0; j < bits.pixels.length; j++ ) {
|
||||||
|
@ -381,7 +381,7 @@ function blocktype( message, fg, bg ) {
|
||||||
this.chkpt( 'btbl' );
|
this.chkpt( 'btbl' );
|
||||||
x = bits.pixels[ j ][ 0 ];
|
x = bits.pixels[ j ][ 0 ];
|
||||||
y = bits.pixels[ j ][ 1] ;
|
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' );
|
this.move( 'btbl' );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,15 +33,28 @@ exports.LCDClock = function(drone, fgColor,bgColor,border) {
|
||||||
// updating all 4 digits each time is expensive
|
// updating all 4 digits each time is expensive
|
||||||
// only update digits which have changed (in most cases - just 1)
|
// only update digits which have changed (in most cases - just 1)
|
||||||
//
|
//
|
||||||
if (digits[3] != lastSecs[3])
|
if (digits[3] != lastSecs[3]){
|
||||||
drone.right(14).blocktype(''+digits[3],fgColor,bgColor).left(14);
|
drone
|
||||||
if (digits[2] != lastSecs[2])
|
.right(14)
|
||||||
drone.right(10).blocktype(''+digits[2],fgColor,bgColor).left(10);
|
.blocktype(''+digits[3],fgColor,bgColor, true)
|
||||||
if (digits[1] != lastSecs[1])
|
.left(14);
|
||||||
drone.right(4).blocktype(''+digits[1], fgColor, bgColor).left(4);
|
}
|
||||||
if (digits[0] != lastSecs[0])
|
if (digits[2] != lastSecs[2]){
|
||||||
drone.blocktype(''+digits[0], fgColor, bgColor);
|
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[0] = digits[0];
|
||||||
lastSecs[1] = digits[1];
|
lastSecs[1] = digits[1];
|
||||||
lastSecs[2] = digits[2];
|
lastSecs[2] = digits[2];
|
||||||
|
@ -58,7 +71,7 @@ exports.LCDClock = function(drone, fgColor,bgColor,border) {
|
||||||
drone.box(border,21,9,1);
|
drone.box(border,21,9,1);
|
||||||
drone.up().right();
|
drone.up().right();
|
||||||
}
|
}
|
||||||
drone.blocktype('00:00', fgColor, bgColor);
|
drone.blocktype('00:00', fgColor, bgColor, true);
|
||||||
return {
|
return {
|
||||||
start24: function( ) {
|
start24: function( ) {
|
||||||
function tick() {
|
function tick() {
|
||||||
|
|
|
@ -711,24 +711,23 @@ Drone.prototype.cuboidX = function( blockType, meta, w, h, d, immediate ) {
|
||||||
Drone.prototype.then = function( next ){
|
Drone.prototype.then = function( next ){
|
||||||
getQueue(this).push( next.bind( Drone.clone(this) ) );
|
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 );
|
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 ) {
|
Drone.prototype.cuboid0 = function( block, w, h, d, immediate ) {
|
||||||
this.chkpt( 'start_point' );
|
var start = 'cuboid0' + w + h + d + immediate;
|
||||||
|
this
|
||||||
// Front wall
|
.chkpt( start )
|
||||||
this.cuboid( block, w, h, 1 );
|
.cuboid( block, w, h, 1, immediate ) // Front wall
|
||||||
// Left wall
|
.cuboid( block, 1, h, d, immediate ) // Left wall
|
||||||
this.cuboid( block, 1, h, d );
|
.right( w - 1 )
|
||||||
// Right wall
|
.cuboid( block, 1, h, d, immediate ) // Right wall
|
||||||
this.right( w - 1 ).cuboid( block, 1, h, d ).left( w - 1 );
|
.left( w - 1 )
|
||||||
// Back wall
|
.fwd( d - 1 )
|
||||||
this.fwd( d - 1 ).cuboid( block, w, h, 1 );
|
.cuboid( block, w, h, 1, immediate ) // Back wall
|
||||||
|
.move( start );
|
||||||
return this.move( 'start_point' );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,11 @@ function ladder( height ){
|
||||||
this.then(function ladderLater(){
|
this.then(function ladderLater(){
|
||||||
var block = this.getBlock();
|
var block = this.getBlock();
|
||||||
if (block.typeId == blocks.air || block.typeId == blocks.ladder){
|
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 {
|
} else {
|
||||||
this
|
this
|
||||||
.back()
|
.back()
|
||||||
.box(blocks.ladder, 1, height, 1)
|
.box(blocks.ladder, 1, height, 1, true)
|
||||||
.fwd();
|
.fwd();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue