From 859d3ccadc8cd4d45085d73f6989be7d155c1c3b Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 18 Aug 2016 14:36:52 -0700 Subject: [PATCH] tweaks --- scripts/system/controllers/teleport.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/system/controllers/teleport.js b/scripts/system/controllers/teleport.js index 1511d1c2fc..4e5f6e8fef 100644 --- a/scripts/system/controllers/teleport.js +++ b/scripts/system/controllers/teleport.js @@ -72,6 +72,8 @@ function Trigger(hand) { }; } +var coolInTimeout = null; + function Teleporter() { var _this = this; this.intersection = null; @@ -85,6 +87,7 @@ function Teleporter() { this.tooClose = false; this.inCoolIn = false; + this.initialize = function() { this.createMappings(); this.disableGrab(); @@ -113,7 +116,11 @@ function Teleporter() { inTeleportMode = true; this.inCoolIn = true; print('setting cool in timeout') - this.coolInTimeout = Script.setTimeout(function() { + if (coolInTimeout !== null) { + Script.clearTimeout(coolInTimeout); + + } + coolInTimeout = Script.setTimeout(function() { print('should exit cool in mode now' + COOL_IN_DURATION) _this.inCoolIn = false; }, COOL_IN_DURATION) @@ -208,9 +215,9 @@ function Teleporter() { this.updateConnected = null; this.inCoolIn = false; + inTeleportMode = false; Script.setTimeout(function() { - inTeleportMode = false; _this.enableGrab(); }, 200); };