From b7f52ea542ac3f456dab3f9a8877c15e0a76100b Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 8 Oct 2015 10:11:21 -0700 Subject: [PATCH] Moved entity reset switch, fixed some style issues --- unpublishedScripts/hiddenEntityReset.js | 24 +++++++++------------- unpublishedScripts/immediateClientReset.js | 21 +++++-------------- 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/unpublishedScripts/hiddenEntityReset.js b/unpublishedScripts/hiddenEntityReset.js index 90e4bc1bf8..a9e97db518 100644 --- a/unpublishedScripts/hiddenEntityReset.js +++ b/unpublishedScripts/hiddenEntityReset.js @@ -10,7 +10,7 @@ // -(function () { +(function() { var _this; @@ -22,13 +22,13 @@ var dollScriptURL = Script.resolvePath("../examples/toys/doll/doll.js"); var lightsScriptURL = Script.resolvePath("../examples/toys/lightSwitch.js"); - ResetSwitch = function () { + ResetSwitch = function() { _this = this; }; ResetSwitch.prototype = { - clickReleaseOnEntity: function (entityId, mouseEvent) { + clickReleaseOnEntity: function(entityId, mouseEvent) { if (!mouseEvent.isLeftButton) { return; } @@ -36,26 +36,22 @@ }, - startNearGrabNonColliding: function () { + startNearGrabNonColliding: function() { this.triggerReset(); }, - startFarGrabNonColliding: function () { - this.triggerReset(); - }, - - triggerReset: function () { + triggerReset: function() { MasterReset(); }, - preload: function (entityID) { + preload: function(entityID) { this.entityID = entityID; } }; - MasterReset = function () { + MasterReset = function() { var resetKey = "resetMe"; var GRABBABLE_DATA_KEY = "grabbableKey"; @@ -145,7 +141,7 @@ function deleteAllToys() { var entities = Entities.findEntities(MyAvatar.position, 100); - entities.forEach(function (entity) { + entities.forEach(function(entity) { //params: customKey, id, defaultValue var shouldReset = getEntityCustomData(resetKey, entity, {}).resetMe; if (shouldReset === true) { @@ -330,14 +326,14 @@ function testBallDistanceFromStart() { var resetCount = 0; - collidingBalls.forEach(function (ball, index) { + collidingBalls.forEach(function(ball, index) { var currentPosition = Entities.getEntityProperties(ball, "position").position; var originalPosition = originalBallPositions[index]; var distance = Vec3.subtract(originalPosition, currentPosition); var length = Vec3.length(distance); if (length > RESET_DISTANCE) { - Script.setTimeout(function () { + Script.setTimeout(function() { var newPosition = Entities.getEntityProperties(ball, "position").position; var moving = Vec3.length(Vec3.subtract(currentPosition, newPosition)); if (moving < MINIMUM_MOVE_LENGTH) { diff --git a/unpublishedScripts/immediateClientReset.js b/unpublishedScripts/immediateClientReset.js index 89464b8c6b..0a2e9383a2 100644 --- a/unpublishedScripts/immediateClientReset.js +++ b/unpublishedScripts/immediateClientReset.js @@ -24,28 +24,17 @@ function createHiddenMasterSwitch() { type: "Box", name: "Master Switch", script: hiddenEntityScriptURL, - dimensions: { - x: 0.2, - y: 0.2, - z: 0.2 - }, - color: { - red: 42, - green: 36, - blue: 30 - }, - position: { - x: 554, - y: 495.5, - z: 503.2 - } + dimensions: {x: 0.7, y: 0.2, z: 0.1}, + position: {x: 543.9, y: 496.05, z: 502.43}, + rotation: Quat.fromPitchYawRollDegrees(0, 33, 0), + visible: false }); } var entities = Entities.findEntities(MyAvatar.position, 100); -entities.forEach(function (entity) { +entities.forEach(function(entity) { //params: customKey, id, defaultValue var name = Entities.getEntityProperties(entity, "name").name if (name === "Master Switch") {