From d00c1f62fcecca4385f45e624cf3d1f3d43af7be Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Tue, 2 Aug 2016 15:40:19 -0700 Subject: [PATCH] fixes --- .../controllers/handControllerPointer.js | 25 ---------- scripts/system/controllers/teleport.js | 50 ++++++++----------- 2 files changed, 21 insertions(+), 54 deletions(-) diff --git a/scripts/system/controllers/handControllerPointer.js b/scripts/system/controllers/handControllerPointer.js index 3f1fbb27de..4d6e9d7f60 100644 --- a/scripts/system/controllers/handControllerPointer.js +++ b/scripts/system/controllers/handControllerPointer.js @@ -508,28 +508,3 @@ Script.scriptEnding.connect(function () { Script.clearInterval(settingsChecker); OffscreenFlags.navigationFocusDisabled = false; }); - -var isDisabled = false; -var handleHandMessages = function(channel, message, sender) { - var data; - if (sender === MyAvatar.sessionUUID) { - if (channel === 'Hifi-Hand-Pointer-Disabler') { - if (message === 'both') { - isDisabled = 'both'; - } - if (message === 'left') { - isDisabled = 'left'; - } - if (message === 'right') { - isDisabled = 'right' - } - if (message === 'none') { - isDisabled = false; - } - - } - } -} - -Messages.subscribe('Hifi-Hand-Pointer-Disabler'); -Messages.messageReceived.connect(handleHandMessages); \ No newline at end of file diff --git a/scripts/system/controllers/teleport.js b/scripts/system/controllers/teleport.js index d8c56b36ca..84ef8fe815 100644 --- a/scripts/system/controllers/teleport.js +++ b/scripts/system/controllers/teleport.js @@ -64,6 +64,10 @@ function ThumbPad(hand) { this.buttonPress = function(value) { _thisPad.buttonValue = value; + if (value === 0) { + Script.clearTimeout(activationTimeout); + activationTimeout = null; + } }; } @@ -128,6 +132,9 @@ function Teleporter() { if (inTeleportMode === true) { return; } + if (isDisabled === 'both') { + return; + } inTeleportMode = true; if (this.smoothArrivalInterval !== null) { Script.clearInterval(this.smoothArrivalInterval); @@ -135,6 +142,9 @@ function Teleporter() { if (fadeSphereInterval !== null) { Script.clearInterval(fadeSphereInterval); } + if (activationTimeout !== null) { + Script.clearInterval(activationTimeout); + } this.teleportHand = hand; this.initialize(); Script.update.connect(this.update); @@ -221,8 +231,9 @@ function Teleporter() { } this.exitTeleportMode = function(value) { - if(activationTimeout!==null){ + if (activationTimeout !== null) { Script.clearTimeout(activationTimeout); + activationTimeout = null; } if (this.updateConnected === true) { Script.update.disconnect(this.update); @@ -230,6 +241,7 @@ function Teleporter() { this.disableMappings(); this.turnOffOverlayBeams(); + this.updateConnected = null; Script.setTimeout(function() { @@ -594,7 +606,6 @@ function registerMappings() { teleportMapping.from(Controller.Standard.LeftPrimaryThumb).peek().to(leftPad.buttonPress); teleportMapping.from(Controller.Standard.LeftPrimaryThumb) - // .when(leftTrigger.down) .to(function(value) { if (isDisabled === 'left' || isDisabled === 'both') { return; @@ -602,15 +613,18 @@ function registerMappings() { if (activationTimeout !== null) { return } + if (leftTrigger.down()) { + return; + } activationTimeout = Script.setTimeout(function() { - teleporter.enterTeleportMode('left') + Script.clearTimeout(activationTimeout); activationTimeout = null; + teleporter.enterTeleportMode('left') }, TELEPORT_DELAY) return; }); teleportMapping.from(Controller.Standard.RightPrimaryThumb) - // .when(rightTrigger.down) .to(function(value) { if (isDisabled === 'right' || isDisabled === 'both') { return; @@ -618,6 +632,9 @@ function registerMappings() { if (activationTimeout !== null) { return } + if (rightTrigger.down()) { + return; + } activationTimeout = Script.setTimeout(function() { teleporter.enterTeleportMode('right') Script.clearTimeout(activationTimeout); @@ -625,31 +642,6 @@ function registerMappings() { }, TELEPORT_DELAY) return; }); - // teleportMapping.from(Controller.Standard.RT).when(Controller.Standard.RightPrimaryThumb).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; - // }); - // teleportMapping.from(Controller.Standard.LT).when(Controller.Standard.LeftPrimaryThumb).to(function(value) { - // if (isDisabled === true) { - // return; - // } - // activationTimeout = Script.setTimeout(function() { - // teleporter.enterTeleportMode('left') - // Script.clearTimeout(activationTimeout); - // activationTimeout = null; - // }, TELEPORT_DELAY) - // return; - // }); }