Modified drone.js to work with new MCP and Bukkit implementations.

This commit is contained in:
walterhiggins 2013-01-05 08:36:19 +00:00
parent f02aa891c3
commit 499cff9e42

View file

@ -16,9 +16,11 @@ var Drone = {
// //
// ... creates a single wooden block at the cross-hairs or player location // ... creates a single wooden block at the cross-hairs or player location
// //
// /js box(5).right(2).box('35:15',3,7,2) // /js box(5).right(2).box('35:15',4,9,1)
//
// ... creates a single wooden block and a 2001 black obelisk that is
// 4 wide x 9 tall x 1 long in size.
// //
// ... creates a single wooden block and a 2001 black obelisk 3x7x2 in size.
// If you want to see what else ScriptCraft's Drone can do, read on... // If you want to see what else ScriptCraft's Drone can do, read on...
// //
// creating a new drone // creating a new drone
@ -256,15 +258,22 @@ var Drone = {
if (typeof x == "undefined"){ if (typeof x == "undefined"){
var mp = getMousePos(); var mp = getMousePos();
if (mp){ if (mp){
this.x = mp.x; this.x = mp[0];
this.y = mp.y; this.y = mp[1];
this.z = mp.z; this.z = mp[2];
}else{ }else{
// base it on the player's current location // base it on the player's current location
usePlayerCoords = true; usePlayerCoords = true;
this.x = playerPos.x; //
this.y = playerPos.y; // it's possible that drone.js could be loaded by a non-playing op
this.z = playerPos.z; // (from the server console)
//
if (!playerPos){
return null;
}
this.x = playerPos[0];
this.y = playerPos[1];
this.z = playerPos[2];
} }
}else{ }else{
this.x = x; this.x = x;
@ -272,12 +281,12 @@ var Drone = {
this.z = z; this.z = z;
} }
if (typeof dir == "undefined"){ if (typeof dir == "undefined"){
this.dir = _getDirFromRotation(playerPos.rotationYaw); this.dir = _getDirFromRotation(playerPos[3]);
}else{ }else{
this.dir = dir%4; this.dir = dir%4;
} }
if (usePlayerCoords){ if (usePlayerCoords){
this.fwd(2); this.fwd(3);
} }
this.chkpt('start'); this.chkpt('start');