From 7fae7e9c77e0a39f41bec7ad05d9e33b7f9283c7 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Tue, 2 Aug 2016 12:26:37 -0700 Subject: [PATCH] cleanup --- interface/resources/controllers/hydra.json | 4 +- scripts/system/controllers/teleport.js | 62 +++++++++++----------- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/interface/resources/controllers/hydra.json b/interface/resources/controllers/hydra.json index 8fffe3a922..8eb33fef3b 100644 --- a/interface/resources/controllers/hydra.json +++ b/interface/resources/controllers/hydra.json @@ -26,8 +26,8 @@ { "from": [ "Hydra.L1", "Hydra.L3" ], "to": "Standard.LeftPrimaryThumb" }, { "from": [ "Hydra.R1", "Hydra.R3" ], "to": "Standard.RightPrimaryThumb" }, - - + { "from": [ "Hydra.R2", "Hydra.R4" ], "to": "Standard.RightSecondaryThumb" }, + { "from": [ "Hydra.L2", "Hydra.L4" ], "to": "Standard.LeftSecondaryThumb" }, { "from": "Hydra.LeftHand", "to": "Standard.LeftHand" }, { "from": "Hydra.RightHand", "to": "Standard.RightHand" } ] diff --git a/scripts/system/controllers/teleport.js b/scripts/system/controllers/teleport.js index 33ec226c94..433bca9379 100644 --- a/scripts/system/controllers/teleport.js +++ b/scripts/system/controllers/teleport.js @@ -246,7 +246,7 @@ function Teleporter() { if (teleporter.teleportHand === 'left') { teleporter.leftRay(); //|| leftTrigger.buttonValue === 0 - if ((leftPad.buttonValue === 0 ) && inTeleportMode === true) { + if ((leftPad.buttonValue === 0) && inTeleportMode === true) { _this.teleport(); return; } @@ -254,7 +254,7 @@ function Teleporter() { } else { teleporter.rightRay(); //|| rightTrigger.buttonValue === 0 - if ((rightPad.buttonValue === 0 ) && inTeleportMode === true) { + if ((rightPad.buttonValue === 0) && inTeleportMode === true) { _this.teleport(); return; } @@ -586,37 +586,37 @@ function registerMappings() { teleportMapping.from(Controller.Standard.LeftPrimaryThumb).peek().to(leftPad.buttonPress); teleportMapping.from(Controller.Standard.LeftPrimaryThumb) - // .when(leftTrigger.down) - .to(function(value) { - if (isDisabled === true) { + // .when(leftTrigger.down) + .to(function(value) { + if (isDisabled === true) { + return; + } + if (activationTimeout !== null) { + return + } + activationTimeout = Script.setTimeout(function() { + teleporter.enterTeleportMode('left') + Script.clearTimeout(activationTimeout); + activationTimeout = null; + }, TELEPORT_DELAY) return; - } - if (activationTimeout !== null) { - return - } - activationTimeout = Script.setTimeout(function() { - teleporter.enterTeleportMode('left') - Script.clearTimeout(activationTimeout); - activationTimeout = null; - }, TELEPORT_DELAY) - return; - }); + }); teleportMapping.from(Controller.Standard.RightPrimaryThumb) - // .when(rightTrigger.down) - .to(function(value) { - if (isDisabled === true) { + // .when(rightTrigger.down) + .to(function(value) { + if (isDisabled === true) { + return; + } + if (activationTimeout !== null) { + return + } + activationTimeout = Script.setTimeout(function() { + teleporter.enterTeleportMode('right') + Script.clearTimeout(activationTimeout); + activationTimeout = null; + }, TELEPORT_DELAY) return; - } - if (activationTimeout !== null) { - return - } - activationTimeout = Script.setTimeout(function() { - teleporter.enterTeleportMode('right') - Script.clearTimeout(activationTimeout); - activationTimeout = null; - }, TELEPORT_DELAY) - return; - }); + }); // teleportMapping.from(Controller.Standard.RT).when(Controller.Standard.RightPrimaryThumb).to(function(value) { // if (isDisabled === true) { // return; @@ -667,10 +667,8 @@ function cleanup() { var isDisabled = false; var handleHandMessages = function(channel, message, sender) { var data; - print('its a message') if (sender === MyAvatar.sessionUUID) { if (channel === 'Hifi-Teleport-Disabler') { - print('got teleport disabler message' + message) if (message === 'disable') { isDisabled = true; }