fixes issue #139

This commit is contained in:
walterhiggins 2014-05-28 22:40:38 +01:00
parent fa64f07c38
commit a2b0cda399

View file

@ -654,6 +654,7 @@ var putBlock = function( x, y, z, blockId, metadata, world ) {
var block = world.getBlockAt( x, y, z );
if ( block.typeId != blockId || block.data != metadata ) {
block.setTypeIdAndData( blockId, metadata, false );
block.data = metadata;
}
};
@ -1580,12 +1581,18 @@ var _cylinder1 = function( block,radius,height,exactParams ) {
};
var _paste = function( name, immediate )
{
if ( !immediate ) {
getQueue(this).push(function(){ _paste(name, true);});
/* if ( !immediate ) {
var clone = Drone.clone(this);
getQueue(this).push(this.paste.bind(clone, name, true) );
return;
}
*/
var ccContent = Drone.clipBoard[name];
if (ccContent == undefined){
console.warn('Nothing called ' + name + ' in clipboard!');
return;
}
var srcBlocks = ccContent.blocks;
var srcDir = ccContent.dir; // direction player was facing when copied.
var dirOffset = (4 + (this.dir - srcDir ) ) %4;
@ -1597,9 +1604,8 @@ var _paste = function( name, immediate )
var d = srcBlocks[ww][hh].length;
_traverse[that.dir].depth(that,d,function( dd ) {
var b = srcBlocks[ww][hh][dd];
var bm = that._getBlockIdAndMeta(b );
var cb = bm[0];
var md = bm[1];
var cb = b.type
var md = b.data;
//
// need to adjust blocks which face a direction
//
@ -1809,7 +1815,7 @@ var _copy = function( name, w, h, d ) {
ccContent[ww].push([] );
_traverse[that.dir].depth(that,d,function( dd ) {
var b = that.world.getBlockAt(that.x,that.y,that.z );
ccContent[ww][hh][dd] = b;
ccContent[ww][hh][dd] = {type:b.getTypeId(), data:b.data};
} );
} );
} );