Fix typo.

This commit is contained in:
r3tk0n 2019-03-11 09:58:20 -07:00
parent 1b628bc8e5
commit ec0cf3ee3a

View file

@ -11,65 +11,66 @@
Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Script.include("/~/system/libraries/controllerDispatcherUtils.js");
Script.include("/~/system/libraries/controllers.js"); Script.include("/~/system/libraries/controllers.js");
(function() { // BEGIN LOCAL_SCOPE (function () { // BEGIN LOCAL_SCOPE
function PushToTalkHandler() { function PushToTalkHandler() {
var _this = this; var _this = this;
this.active = false; this.active = false;
//var pttMapping, mappingName; //var pttMapping, mappingName;
this.setup = function() { this.setup = function () {
//mappingName = 'Hifi-PTT-Dev-' + Math.random(); //mappingName = 'Hifi-PTT-Dev-' + Math.random();
//pttMapping = Controller.newMapping(mappingName); //pttMapping = Controller.newMapping(mappingName);
//pttMapping.enable(); //pttMapping.enable();
}; };
this.shouldTalk = function (controllerData) { this.shouldTalk = function (controllerData) {
// Set up test against controllerData here... // Set up test against controllerData here...
var gripVal = controllerData.secondaryValues[LEFT_HAND] && controllerData.secondaryValues[RIGHT_HAND]; var gripVal = controllerData.secondaryValues[LEFT_HAND] && controllerData.secondaryValues[RIGHT_HAND];
return (gripVal) ? true : false; return (gripVal) ? true : false;
}; };
this.shouldStopTalking = function (controllerData) { this.shouldStopTalking = function (controllerData) {
var gripVal = controllerData.secondaryValues[LEFT_HAND] && controllerData.secondaryValues[RIGHT_HAND]; var gripVal = controllerData.secondaryValues[LEFT_HAND] && controllerData.secondaryValues[RIGHT_HAND];
return (gripVal) ? false : true; return (gripVal) ? false : true;
}; };
this.isReady = function (controllerData, deltaTime) { this.isReady = function (controllerData, deltaTime) {
if (HMD.active && Audio.pushToTalk && this.shouldTalk(controllerData)) { if (HMD.active && Audio.pushToTalk && this.shouldTalk(controllerData)) {
Audio.pushingToTalk = true; Audio.pushingToTalk = true;
returnMakeRunningValues(true, [], []); return makeRunningValues(true, [], []);
} }
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
}; };
this.run = function (controllerData, deltaTime) { this.run = function (controllerData, deltaTime) {
if (this.shouldStopTalking(controllerData) || !Audio.pushToTalk) { if (this.shouldStopTalking(controllerData) || !Audio.pushToTalk) {
Audio.pushingToTalk = false; Audio.pushingToTalk = false;
return makeRunningValues(false, [], []); print("Stop pushing to talk.");
} return makeRunningValues(false, [], []);
}
return makeRunningValues(true, [], []);
}; return makeRunningValues(true, [], []);
};
this.cleanup = function () {
//pttMapping.disable(); this.cleanup = function () {
}; //pttMapping.disable();
};
this.parameters = makeDispatcherModuleParameters(
950, this.parameters = makeDispatcherModuleParameters(
["head"], 950,
[], ["head"],
100); [],
} 100);
}
var pushToTalk = new PushToTalkHandler();
enableDispatcherModule("PushToTalk", pushToTalk); var pushToTalk = new PushToTalkHandler();
enableDispatcherModule("PushToTalk", pushToTalk);
function cleanup () {
pushToTalk.cleanup(); function cleanup() {
disableDispatcherModule("PushToTalk"); pushToTalk.cleanup();
}; disableDispatcherModule("PushToTalk");
};
Script.scriptEnding.connect(cleanup);
Script.scriptEnding.connect(cleanup);
}()); // END LOCAL_SCOPE }()); // END LOCAL_SCOPE