From 5a415d9838b1f56d0b185c8f92af17bba95e83bb Mon Sep 17 00:00:00 2001 From: walterhiggins Date: Thu, 8 Aug 2013 08:02:27 +0100 Subject: [PATCH] fix issue #90 --- docs/api.md | 3 ++- src/main/javascript/drone/drone.js | 10 +++++++--- src/main/javascript/utils/utils.js | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/api.md b/docs/api.md index bd7383d..51d4caa 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1389,10 +1389,11 @@ Example To warn players when night is approaching... utils.at( "19:00", function() { - /* it's 7 in the evening so warn all players that night is coming ! */ + utils.foreach( server.onlinePlayers, function(player){ player.chat("The night is dark and full of terrors!"); }); + }, self.world); String class extensions diff --git a/src/main/javascript/drone/drone.js b/src/main/javascript/drone/drone.js index 771a0eb..590ec11 100644 --- a/src/main/javascript/drone/drone.js +++ b/src/main/javascript/drone/drone.js @@ -700,12 +700,15 @@ Used when placing torches so that they face towards the drone. this.record = false; var usePlayerCoords = false; var playerPos = getPlayerPos(); - if (typeof x == "undefined"){ + if (typeof x == "undefined") + { var mp = getMousePos(); if (mp){ this.x = mp.x; this.y = mp.y; this.z = mp.z; + if (playerPos) + this.dir = _getDirFromRotation(playerPos.yaw); this.world = mp.world; }else{ // base it on the player's current location @@ -720,6 +723,7 @@ Used when placing torches so that they face towards the drone. this.x = playerPos.x; this.y = playerPos.y; this.z = playerPos.z; + this.dir = _getDirFromRotation(playerPos.yaw); this.world = playerPos.world; } }else{ @@ -746,14 +750,14 @@ Used when placing torches so that they face towards the drone. } } - // for debugging - //self.sendMessage("New Drone " + this.toString()); if (usePlayerCoords){ this.fwd(3); } this.chkpt('start'); this.record = true; this.history = []; + // for debugging + // self.sendMessage("New Drone " + this.toString()); return this; }; // diff --git a/src/main/javascript/utils/utils.js b/src/main/javascript/utils/utils.js index 8a73907..f2165fe 100644 --- a/src/main/javascript/utils/utils.js +++ b/src/main/javascript/utils/utils.js @@ -178,10 +178,11 @@ Example To warn players when night is approaching... utils.at( "19:00", function() { - /* it's 7 in the evening so warn all players that night is coming ! */ + utils.foreach( server.onlinePlayers, function(player){ player.chat("The night is dark and full of terrors!"); }); + }, self.world); ***/