This commit is contained in:
walterhiggins 2014-04-25 20:51:15 +01:00
parent 3c7f8ae94e
commit 9d2df863b6
3 changed files with 58 additions and 58 deletions

View file

@ -2006,7 +2006,7 @@ commands in a new script file and load it using /js load()
### 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`.
### Drone.extend() static method

View file

@ -228,7 +228,7 @@ events.on( 'player.PlayerCommandPreprocessEvent', function( evt ) {
var exec = function( cmd ) {
invoker.performCommand(cmd);
};
var isAlias = _intercept( ''+evt.message, ''+invoker.name, exec);
var isAlias = _intercept( (''+evt.message).trim(), ''+invoker.name, exec);
if ( isAlias ) {
evt.cancelled = true;
}
@ -242,7 +242,7 @@ events.on( 'server.ServerCommandEvent', function( evt ) {
var exec = function( 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 ) {
evt.command = 'jsp void';
}

View file

@ -573,7 +573,7 @@ commands in a new script file and load it using /js load()
### 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`.
### Drone.extend() static method
@ -892,7 +892,6 @@ Drone.prototype.times = function( numTimes, commands ) {
var command = commands[i];
var methodName = command[0];
var args = command[1];
print ('command=' + JSON.stringify(command ) + ',methodName=' + methodName );
this[ methodName ].apply( this, args );
}
}
@ -1002,7 +1001,11 @@ Drone.extend( 'sign', function( message, block ) {
block = bm[0];
var meta = bm[1];
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;
}
if ( block == 68 ) {
@ -1169,45 +1172,43 @@ Drone.prototype.cuboid0 = function( block, w, h, d ) {
};
Drone.extend( 'door', function( door ) {
if ( typeof door == 'undefined' ) {
door = 64;
Drone.extend( 'door', function( doorMaterial ) {
if ( typeof doorMaterial == 'undefined' ) {
doorMaterial = 64; // wood
} else {
door = 71;
doorMaterial = 71; // iron
}
this.cuboidX( door, this.dir )
this.cuboidX( doorMaterial, this.dir )
.up( )
.cuboidX( door, 8 )
.cuboidX( doorMaterial, 8 )
.down( );
} );
Drone.extend( 'door_iron', function( ) {
var door = 71;
this.cuboidX( door, this.dir )
this.cuboidX( 71, this.dir )
.up( )
.cuboidX( door, 8 )
.cuboidX( 71, 8 )
.down( );
} );
Drone.extend( 'door2' , function( door ) {
if ( typeof door == 'undefined' ) {
door = 64;
Drone.extend( 'door2' , function( doorMaterial ) {
if ( typeof doorMaterial == 'undefined' ) {
doorMaterial = 64;
} else {
door = 71;
doorMaterial = 71;
}
this
.cuboidX( door, this.dir ).up( )
.cuboidX( door, 8 ).right( )
.cuboidX( door, 9 ).down( )
.cuboidX( door, this.dir ).left( );
.cuboidX( doorMaterial, this.dir ).up( )
.cuboidX( doorMaterial, 8 ).right( )
.cuboidX( doorMaterial, 9 ).down( )
.cuboidX( doorMaterial, this.dir ).left( );
} );
Drone.extend( 'door2_iron' , function( door ) {
var door = 71;
Drone.extend( 'door2_iron' , function( ) {
this
.cuboidX( door, this.dir ).up( )
.cuboidX( door, 8 ).right( )
.cuboidX( door, 9 ).down( )
.cuboidX( door, this.dir ).left( );
.cuboidX( 71, this.dir ).up( )
.cuboidX( 71, 8 ).right( )
.cuboidX( 71, 9 ).down( )
.cuboidX( 71, this.dir ).left( );
} );
// 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];
};
Drone.prototype.debug = function( ) {
print(this.toString( ) );
console.log(this.toString( ) );
return this;
};
/*
@ -1433,8 +1434,7 @@ var _arc2 = function( params ) {
}else{
if ( strokeWidth == 1 ) {
gotoxy(x,y )
.cuboidX(params.blockType,
params.meta,
.cuboidX( params.blockType, params.meta,
1, // width
stack, // height
strokeWidth // depth