This commit is contained in:
James B. Pollack 2016-08-02 15:40:19 -07:00
parent f6984aaff8
commit d00c1f62fc
2 changed files with 21 additions and 54 deletions

View file

@ -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);

View file

@ -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;
// });
}