private void OnPrimaryActionChange(SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource, bool newState) { var value = newState ? 1 : 0; if (!SceneHelper.IsInGame()) { _buttons[JoystickButton.FaceLeft] = value; return; } var toolSwapper = ToolHelper.Swapper; var isInShip = toolSwapper.GetToolGroup() == ToolGroup.Ship; var isUsingSignalscope = toolSwapper.IsInToolMode(ToolMode.SignalScope); var isUsingProbeLauncher = toolSwapper.IsInToolMode(ToolMode.Probe); var isUsingFixedProbeTool = OWInput.IsInputMode(InputMode.StationaryProbeLauncher) || OWInput.IsInputMode(InputMode.SatelliteCam); if (!isUsingFixedProbeTool && !ToolHelper.IsUsingAnyTool()) { var isRepairPromptVisible = _repairPrompt != null && !_repairPrompt.IsVisible(); var canRepairSuit = _playerResources.IsSuitPunctured() && OWInput.IsInputMode(InputMode.Character) && !ToolHelper.Swapper.IsSuitPatchingBlocked(); if (isRepairPromptVisible && !isInShip && !canRepairSuit) { if (newState) { _primaryLastTime = fromAction.changedTime; } else { _primaryLastTime = -1; if (!_justHeld) { SimulateInput(JoystickButton.FaceLeft); } _justHeld = false; } } else { _buttons[JoystickButton.FaceLeft] = value; } } else if (!isInShip || isUsingProbeLauncher || isUsingFixedProbeTool) { _buttons[JoystickButton.RightBumper] = value; } else if (isUsingSignalscope) { _axes[XboxAxis.dPadX.GetInputAxisName(0)] = value; } if (isInShip) { if (!newState) { _buttons[JoystickButton.FaceLeft] = value; } } }
internal void Update() { if (IsActive() && ToolHelper.IsUsingAnyTool()) { SetActive(false); } else if (!IsActive() && !ToolHelper.IsUsingAnyTool()) { SetActive(true); } }
internal void Update() { if (_referenceFrameTracker.isActiveAndEnabled && ToolHelper.IsUsingAnyTool()) { _referenceFrameTracker.enabled = false; } else if (!_referenceFrameTracker.isActiveAndEnabled && !ToolHelper.IsUsingAnyTool()) { _referenceFrameTracker.enabled = true; } }
private void UpdateVisibility() { var isCharacterMode = OWInput.IsInputMode(InputMode.Character); var shouldBeVisible = !ToolHelper.IsUsingAnyTool() && isCharacterMode; if (!_visible && shouldBeVisible) { SetVisible(true); } if (_visible && !shouldBeVisible) { SetVisible(false); } }
internal void Update() { var isInShip = _cockpitController.IsPlayerAtFlightConsole(); if (isInShip && !_canInteractWithTools) { SetEnabled(true); } else if (!isInShip && _canInteractWithTools) { SetEnabled(false); } if (_referenceFrameTracker.isActiveAndEnabled && ToolHelper.IsUsingAnyTool()) { _referenceFrameTracker.enabled = false; } else if (!_referenceFrameTracker.isActiveAndEnabled && !ToolHelper.IsUsingAnyTool()) { _referenceFrameTracker.enabled = true; } if (_referenceFrameTracker.GetReferenceFrame() == null && _referenceFrameTracker.GetPossibleReferenceFrame() == null) { return; } if (OWInput.IsNewlyPressed(InputLibrary.interact)) { _pressedInteract = true; } if (OWInput.IsNewlyHeld(InputLibrary.interact)) { ControllerInput.Behaviour.SimulateInput(AxisIdentifier.CTRLR_DPADY, 1); _wasHoldingInteract = true; } if (OWInput.IsNewlyReleased(InputLibrary.interact)) { if (_wasHoldingInteract) { ControllerInput.Behaviour.SimulateInput(AxisIdentifier.CTRLR_DPADY, 0); _wasHoldingInteract = false; } else if (_pressedInteract && !IsFocused(_probe) && !IsFocused(_signalscope) && !IsFocused(_landingCam)) { ControllerInput.Behaviour.SimulateInput(JoystickButton.LeftStickClick); } _pressedInteract = false; } }
private void UpdateVisibility() { var isCharacterMode = OWInput.IsInputMode(InputMode.Character); var hand = HandsController.Behaviour.RightHand; var isHandClose = !ModSettings.AutoHideToolbelt || (hand.position - transform.position).sqrMagnitude < _minHandDistance; var shouldBeVisible = !ToolHelper.IsUsingAnyTool() && isCharacterMode && isHandClose; if (!_visible && shouldBeVisible) { SetVisible(true); } if (_visible && !shouldBeVisible) { SetVisible(false); } }
private void UpdateRaycast() { if (ToolHelper.IsUsingAnyTool() || PlayerState.IsInsideShip()) { SetText(GestureText.None); return; } var camera = Locator.GetPlayerCamera().transform; var isHit = Physics.Raycast(camera.position, camera.forward, out var hit, 5f, OWLayerMask.blockableInteractMask); if (!isHit) { return; } UpdateProbePrompt(hit); UpdateTranslatorPrompt(hit); }