Use "Prefer Stylus Over Laser" setting

This commit is contained in:
David Rowe 2018-01-04 15:00:17 +13:00
parent 901af8896f
commit efa6f1f02f
3 changed files with 17 additions and 4 deletions

View file

@ -142,7 +142,10 @@ Script.include("/~/system/libraries/controllers.js");
}; };
this.isReady = function (controllerData) { this.isReady = function (controllerData) {
if (this.processStylus(controllerData)) { var PREFER_STYLUS_OVER_LASER = "preferStylusOverLaser";
var isUsingStylus = Settings.getValue(PREFER_STYLUS_OVER_LASER, false);
if (isUsingStylus && this.processStylus(controllerData)) {
Pointers.enablePointer(this.pointer); Pointers.enablePointer(this.pointer);
return makeRunningValues(true, [], []); return makeRunningValues(true, [], []);
} else { } else {

View file

@ -76,18 +76,28 @@ Script.include("/~/system/libraries/controllers.js");
} }
}; };
this.updateAllwaysOn = function () {
var PREFER_STYLUS_OVER_LASER = "preferStylusOverLaser";
this.parameters.handLaser.allwaysOn = !Settings.getValue(PREFER_STYLUS_OVER_LASER, false);
};
this.isReady = function (controllerData) { this.isReady = function (controllerData) {
var otherModuleRunning = this.getOtherModule().running; var otherModuleRunning = this.getOtherModule().running;
if ((this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)) && if ((this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)) &&
!otherModuleRunning) { !otherModuleRunning) {
return makeRunningValues(true, [], []); this.updateAllwaysOn();
if (this.parameters.handLaser.allwaysOn || controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE) {
return makeRunningValues(true, [], []);
}
} }
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
}; };
this.run = function (controllerData, deltaTime) { this.run = function (controllerData, deltaTime) {
var grabModuleNeedsToRun = this.grabModuleWantsNearbyOverlay(controllerData); var grabModuleNeedsToRun = this.grabModuleWantsNearbyOverlay(controllerData);
if ((controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE || (this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData))) && !grabModuleNeedsToRun) { if (!grabModuleNeedsToRun && (controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE
|| this.parameters.handLaser.allwaysOn
&& (this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)))) {
this.running = true; this.running = true;
return makeRunningValues(true, [], []); return makeRunningValues(true, [], []);
} }

View file

@ -19,7 +19,7 @@ var CONTOLLER_SCRIPTS = [
"controllerModules/nearParentGrabOverlay.js", "controllerModules/nearParentGrabOverlay.js",
"controllerModules/nearActionGrabEntity.js", "controllerModules/nearActionGrabEntity.js",
"controllerModules/farActionGrabEntity.js", "controllerModules/farActionGrabEntity.js",
//"controllerModules/stylusInput.js", "controllerModules/stylusInput.js",
"controllerModules/equipEntity.js", "controllerModules/equipEntity.js",
"controllerModules/nearTrigger.js", "controllerModules/nearTrigger.js",
"controllerModules/webSurfaceLaserInput.js", "controllerModules/webSurfaceLaserInput.js",