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
scripts/system/controllers

View file

@ -142,7 +142,10 @@ Script.include("/~/system/libraries/controllers.js");
};
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);
return makeRunningValues(true, [], []);
} 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) {
var otherModuleRunning = this.getOtherModule().running;
if ((this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)) &&
!otherModuleRunning) {
return makeRunningValues(true, [], []);
this.updateAllwaysOn();
if (this.parameters.handLaser.allwaysOn || controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE) {
return makeRunningValues(true, [], []);
}
}
return makeRunningValues(false, [], []);
};
this.run = function (controllerData, deltaTime) {
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;
return makeRunningValues(true, [], []);
}

View file

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