Prevent HUD and Web Surface lasers from interrupting FarGrab.

This commit is contained in:
r3tk0n 2019-03-02 13:55:06 -08:00
parent e4958b3b0f
commit 12ffa41984
2 changed files with 35 additions and 2 deletions

View file

@ -30,6 +30,20 @@
100,
makeLaserParams((this.hand + HUD_LASER_OFFSET), false));
this.getFarGrab = function () {
return getEnabledModuleByName(this.hand === RIGHT_HAND ? ("RightFarGrabEntity") : ("LeftFarGrabEntity"));
}
this.farGrabActive = function () {
var farGrab = this.getFarGrab();
// farGrab will be null if module isn't loaded.
if (farGrab) {
return farGrab.targetIsNull();
} else {
return false;
}
};
this.getOtherHandController = function() {
return (this.hand === RIGHT_HAND) ? Controller.Standard.LeftHand : Controller.Standard.RightHand;
};
@ -79,7 +93,7 @@
this.isReady = function (controllerData) {
var otherModuleRunning = this.getOtherModule().running;
if (!otherModuleRunning && HMD.active) {
if (!otherModuleRunning && HMD.active && !this.farGrabActive()) {
if (this.processLaser(controllerData)) {
this.running = true;
return ControllerDispatcherUtils.makeRunningValues(true, [], []);

View file

@ -37,6 +37,20 @@ Script.include("/~/system/libraries/controllers.js");
100,
makeLaserParams(hand, true));
this.getFarGrab = function () {
return getEnabledModuleByName(this.hand === RIGHT_HAND ? ("RightFarGrabEntity") : ("LeftFarGrabEntity"));
};
this.farGrabActive = function () {
var farGrab = this.getFarGrab();
// farGrab will be null if module isn't loaded.
if (farGrab) {
return farGrab.targetIsNull();
} else {
return false;
}
};
this.grabModuleWantsNearbyOverlay = function(controllerData) {
if (controllerData.triggerValues[this.hand] > TRIGGER_ON_VALUE || controllerData.secondaryValues[this.hand] > BUMPER_ON_VALUE) {
var nearGrabName = this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay";
@ -184,7 +198,12 @@ Script.include("/~/system/libraries/controllers.js");
this.dominantHandOverride = false;
this.isReady = function(controllerData) {
this.isReady = function (controllerData) {
// Trivial rejection for when FarGrab is active.
if (this.farGrabActive()) {
return makeRunningValues(false, [], []);
}
var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE &&
controllerData.triggerValues[this.otherHand] <= TRIGGER_OFF_VALUE;
var type = this.getInteractableType(controllerData, isTriggerPressed, false);