spacing
This commit is contained in:
parent
3c7f8ae94e
commit
9d2df863b6
3 changed files with 58 additions and 58 deletions
|
@ -2006,7 +2006,7 @@ commands in a new script file and load it using /js load()
|
||||||
|
|
||||||
### Extending Drone
|
### Extending Drone
|
||||||
|
|
||||||
The Drone object can be easily extended - new buidling recipes/blue-prints can be added and can
|
The Drone object can be easily extended - new buidling recipes/blueprints can be added and can
|
||||||
become part of a Drone's chain using the *static* method `Drone.extend`.
|
become part of a Drone's chain using the *static* method `Drone.extend`.
|
||||||
|
|
||||||
### Drone.extend() static method
|
### Drone.extend() static method
|
||||||
|
|
|
@ -228,7 +228,7 @@ events.on( 'player.PlayerCommandPreprocessEvent', function( evt ) {
|
||||||
var exec = function( cmd ) {
|
var exec = function( cmd ) {
|
||||||
invoker.performCommand(cmd);
|
invoker.performCommand(cmd);
|
||||||
};
|
};
|
||||||
var isAlias = _intercept( ''+evt.message, ''+invoker.name, exec);
|
var isAlias = _intercept( (''+evt.message).trim(), ''+invoker.name, exec);
|
||||||
if ( isAlias ) {
|
if ( isAlias ) {
|
||||||
evt.cancelled = true;
|
evt.cancelled = true;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ events.on( 'server.ServerCommandEvent', function( evt ) {
|
||||||
var exec = function( cmd ) {
|
var exec = function( cmd ) {
|
||||||
invoker.server.dispatchCommand( invoker, cmd);
|
invoker.server.dispatchCommand( invoker, cmd);
|
||||||
};
|
};
|
||||||
var isAlias = _intercept( ''+evt.command, ''+ invoker.name, exec );
|
var isAlias = _intercept( (''+evt.command).trim(), ''+ invoker.name, exec );
|
||||||
if ( isAlias ) {
|
if ( isAlias ) {
|
||||||
evt.command = 'jsp void';
|
evt.command = 'jsp void';
|
||||||
}
|
}
|
||||||
|
|
|
@ -573,7 +573,7 @@ commands in a new script file and load it using /js load()
|
||||||
|
|
||||||
### Extending Drone
|
### Extending Drone
|
||||||
|
|
||||||
The Drone object can be easily extended - new buidling recipes/blue-prints can be added and can
|
The Drone object can be easily extended - new buidling recipes/blueprints can be added and can
|
||||||
become part of a Drone's chain using the *static* method `Drone.extend`.
|
become part of a Drone's chain using the *static* method `Drone.extend`.
|
||||||
|
|
||||||
### Drone.extend() static method
|
### Drone.extend() static method
|
||||||
|
@ -892,7 +892,6 @@ Drone.prototype.times = function( numTimes, commands ) {
|
||||||
var command = commands[i];
|
var command = commands[i];
|
||||||
var methodName = command[0];
|
var methodName = command[0];
|
||||||
var args = command[1];
|
var args = command[1];
|
||||||
print ('command=' + JSON.stringify(command ) + ',methodName=' + methodName );
|
|
||||||
this[ methodName ].apply( this, args );
|
this[ methodName ].apply( this, args );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1002,7 +1001,11 @@ Drone.extend( 'sign', function( message, block ) {
|
||||||
block = bm[0];
|
block = bm[0];
|
||||||
var meta = bm[1];
|
var meta = bm[1];
|
||||||
if ( block != 63 && block != 68 ) {
|
if ( block != 63 && block != 68 ) {
|
||||||
print('ERROR: Invalid block id for use in signs');
|
var usage = 'Usage: sign("message", "63:1") or sign("message","68:1")';
|
||||||
|
if ( this.player ) {
|
||||||
|
this.player.sendMessage(usage);
|
||||||
|
}
|
||||||
|
console.error(usage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( block == 68 ) {
|
if ( block == 68 ) {
|
||||||
|
@ -1169,45 +1172,43 @@ Drone.prototype.cuboid0 = function( block, w, h, d ) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Drone.extend( 'door', function( door ) {
|
Drone.extend( 'door', function( doorMaterial ) {
|
||||||
if ( typeof door == 'undefined' ) {
|
if ( typeof doorMaterial == 'undefined' ) {
|
||||||
door = 64;
|
doorMaterial = 64; // wood
|
||||||
} else {
|
} else {
|
||||||
door = 71;
|
doorMaterial = 71; // iron
|
||||||
}
|
}
|
||||||
this.cuboidX( door, this.dir )
|
this.cuboidX( doorMaterial, this.dir )
|
||||||
.up( )
|
.up( )
|
||||||
.cuboidX( door, 8 )
|
.cuboidX( doorMaterial, 8 )
|
||||||
.down( );
|
.down( );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
Drone.extend( 'door_iron', function( ) {
|
Drone.extend( 'door_iron', function( ) {
|
||||||
var door = 71;
|
this.cuboidX( 71, this.dir )
|
||||||
this.cuboidX( door, this.dir )
|
|
||||||
.up( )
|
.up( )
|
||||||
.cuboidX( door, 8 )
|
.cuboidX( 71, 8 )
|
||||||
.down( );
|
.down( );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
Drone.extend( 'door2' , function( door ) {
|
Drone.extend( 'door2' , function( doorMaterial ) {
|
||||||
if ( typeof door == 'undefined' ) {
|
if ( typeof doorMaterial == 'undefined' ) {
|
||||||
door = 64;
|
doorMaterial = 64;
|
||||||
} else {
|
} else {
|
||||||
door = 71;
|
doorMaterial = 71;
|
||||||
}
|
}
|
||||||
this
|
this
|
||||||
.cuboidX( door, this.dir ).up( )
|
.cuboidX( doorMaterial, this.dir ).up( )
|
||||||
.cuboidX( door, 8 ).right( )
|
.cuboidX( doorMaterial, 8 ).right( )
|
||||||
.cuboidX( door, 9 ).down( )
|
.cuboidX( doorMaterial, 9 ).down( )
|
||||||
.cuboidX( door, this.dir ).left( );
|
.cuboidX( doorMaterial, this.dir ).left( );
|
||||||
} );
|
} );
|
||||||
Drone.extend( 'door2_iron' , function( door ) {
|
Drone.extend( 'door2_iron' , function( ) {
|
||||||
var door = 71;
|
|
||||||
this
|
this
|
||||||
.cuboidX( door, this.dir ).up( )
|
.cuboidX( 71, this.dir ).up( )
|
||||||
.cuboidX( door, 8 ).right( )
|
.cuboidX( 71, 8 ).right( )
|
||||||
.cuboidX( door, 9 ).down( )
|
.cuboidX( 71, 9 ).down( )
|
||||||
.cuboidX( door, this.dir ).left( );
|
.cuboidX( 71, this.dir ).left( );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// player dirs: 0 = east, 1 = south, 2 = west, 3 = north
|
// player dirs: 0 = east, 1 = south, 2 = west, 3 = north
|
||||||
|
@ -1312,7 +1313,7 @@ Drone.prototype.toString = function( ) {
|
||||||
return 'x: ' + this.x + ' y: '+this.y + ' z: ' + this.z + ' dir: ' + this.dir + ' '+dirs[this.dir];
|
return 'x: ' + this.x + ' y: '+this.y + ' z: ' + this.z + ' dir: ' + this.dir + ' '+dirs[this.dir];
|
||||||
};
|
};
|
||||||
Drone.prototype.debug = function( ) {
|
Drone.prototype.debug = function( ) {
|
||||||
print(this.toString( ) );
|
console.log(this.toString( ) );
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
|
@ -1419,33 +1420,32 @@ var _arc2 = function( params ) {
|
||||||
x0 = drone.x;
|
x0 = drone.x;
|
||||||
y0 = drone.z;
|
y0 = drone.z;
|
||||||
}
|
}
|
||||||
setPixel = function( x,y ) {
|
setPixel = function( x, y ) {
|
||||||
x = (x-x0 );
|
x = ( x-x0 );
|
||||||
y = (y-y0 );
|
y = ( y-y0 );
|
||||||
if ( params.fill ) {
|
if ( params.fill ) {
|
||||||
// wph 20130114 more efficient esp. for large cylinders/spheres
|
// wph 20130114 more efficient esp. for large cylinders/spheres
|
||||||
if ( y < 0 ) {
|
if ( y < 0 ) {
|
||||||
drone
|
drone
|
||||||
.fwd(y ).right(x )
|
.fwd( y ).right( x )
|
||||||
.cuboidX(params.blockType,params.meta,1,stack,Math.abs(y*2 )+1 )
|
.cuboidX( params.blockType, params.meta, 1, stack, Math.abs( y * 2 ) + 1 )
|
||||||
.back(y ).left(x );
|
.back( y ).left( x );
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if ( strokeWidth == 1 ) {
|
if ( strokeWidth == 1 ) {
|
||||||
gotoxy(x,y )
|
gotoxy(x,y )
|
||||||
.cuboidX(params.blockType,
|
.cuboidX( params.blockType, params.meta,
|
||||||
params.meta,
|
|
||||||
1, // width
|
1, // width
|
||||||
stack, // height
|
stack, // height
|
||||||
strokeWidth // depth
|
strokeWidth // depth
|
||||||
)
|
)
|
||||||
.move('center' );
|
.move('center' );
|
||||||
} else {
|
} else {
|
||||||
var strokeDir = _getStrokeDir(x,y );
|
var strokeDir = _getStrokeDir( x, y );
|
||||||
var width = 1, depth = 1;
|
var width = 1, depth = 1;
|
||||||
switch ( strokeDir ) {
|
switch ( strokeDir ) {
|
||||||
case 0: // down
|
case 0: // down
|
||||||
y = y-(strokeWidth-1 );
|
y = y-( strokeWidth - 1 );
|
||||||
depth = strokeWidth;
|
depth = strokeWidth;
|
||||||
break;
|
break;
|
||||||
case 1: // up
|
case 1: // up
|
||||||
|
@ -1459,9 +1459,9 @@ var _arc2 = function( params ) {
|
||||||
width = strokeWidth;
|
width = strokeWidth;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gotoxy(x,y )
|
gotoxy( x, y )
|
||||||
.cuboidX(params.blockType, params.meta, width, stack, depth )
|
.cuboidX( params.blockType, params.meta, width, stack, depth )
|
||||||
.move('center' );
|
.move( 'center' );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1481,28 +1481,28 @@ var _arc2 = function( params ) {
|
||||||
x0 = drone.x;
|
x0 = drone.x;
|
||||||
y0 = drone.y;
|
y0 = drone.y;
|
||||||
}
|
}
|
||||||
setPixel = function( x,y ) {
|
setPixel = function( x, y ) {
|
||||||
x = (x-x0 );
|
x = ( x - x0 );
|
||||||
y = (y-y0 );
|
y = ( y - y0 );
|
||||||
if ( params.fill ) {
|
if ( params.fill ) {
|
||||||
// wph 20130114 more efficient esp. for large cylinders/spheres
|
// wph 20130114 more efficient esp. for large cylinders/spheres
|
||||||
if ( y < 0 ) {
|
if ( y < 0 ) {
|
||||||
drone
|
drone
|
||||||
.up(y ).right(x )
|
.up( y ).right( x )
|
||||||
.cuboidX(params.blockType,params.meta,1,Math.abs(y*2 )+1,stack )
|
.cuboidX( params.blockType, params.meta, 1, Math.abs( y * 2 ) + 1, stack )
|
||||||
.down(y ).left(x );
|
.down( y ).left( x );
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if ( strokeWidth == 1 ) {
|
if ( strokeWidth == 1 ) {
|
||||||
gotoxy(x,y )
|
gotoxy( x, y )
|
||||||
.cuboidX(params.blockType,params.meta,strokeWidth,1,stack )
|
.cuboidX( params.blockType, params.meta, strokeWidth, 1, stack )
|
||||||
.move('center' );
|
.move( 'center' );
|
||||||
}else{
|
}else{
|
||||||
var strokeDir = _getStrokeDir(x,y );
|
var strokeDir = _getStrokeDir( x,y );
|
||||||
var width = 1, height = 1;
|
var width = 1, height = 1;
|
||||||
switch ( strokeDir ) {
|
switch ( strokeDir ) {
|
||||||
case 0: // down
|
case 0: // down
|
||||||
y = y-(strokeWidth-1 );
|
y = y - ( strokeWidth - 1 );
|
||||||
height = strokeWidth;
|
height = strokeWidth;
|
||||||
break;
|
break;
|
||||||
case 1: // up
|
case 1: // up
|
||||||
|
@ -1510,7 +1510,7 @@ var _arc2 = function( params ) {
|
||||||
break;
|
break;
|
||||||
case 2: // left
|
case 2: // left
|
||||||
width = strokeWidth;
|
width = strokeWidth;
|
||||||
x = x-(strokeWidth-1 );
|
x = x - ( strokeWidth - 1 );
|
||||||
break;
|
break;
|
||||||
case 3: // right
|
case 3: // right
|
||||||
width = strokeWidth;
|
width = strokeWidth;
|
||||||
|
|
Reference in a new issue