Example #1
0
        public static bool UpdateReplacement(SatelliteSnapshotController __instance)
        {
            if (!OWInput.IsInputMode(InputMode.SatelliteCam))
            {
                return(false);
            }

            if (OWInput.IsNewlyPressed(InputLibrary.toolActionPrimary))
            {
                new SatelliteProjectorSnapshotMessage(true).Send();
                __instance._satelliteCamera.transform.localEulerAngles = __instance._initCamLocalRot;
                __instance.RenderSnapshot();
                return(false);
            }

            if (__instance._allowRearview && OWInput.IsNewlyPressed(InputLibrary.toolActionSecondary))
            {
                new SatelliteProjectorSnapshotMessage(false).Send();
                __instance._satelliteCamera.transform.localEulerAngles = __instance._initCamLocalRot + new Vector3(0f, 180f, 0f);
                __instance.RenderSnapshot();
                return(false);
            }

            if (OWInput.IsNewlyPressed(InputLibrary.cancel))
            {
                __instance.TurnOffProjector();
            }

            return(false);
        }
Example #2
0
            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;
                    }
                }
            }
Example #3
0
 private static bool PreRetrieveProbe()
 {
     if (Locator.GetReferenceFrame(true) != null && OWInput.IsInputMode(InputMode.ShipCockpit))
     {
         return(false);
     }
     return(true);
 }
Example #4
0
 public static bool IsAllowedToEquip(ToolMode mode)
 {
     if (OWInput.IsInputMode(InputMode.ShipCockpit) && mode == ToolMode.None)
     {
         return(true);
     }
     return(_toolsAllowedToEquip.ContainsKey(mode) && _toolsAllowedToEquip[mode]);
 }
Example #5
0
 public static bool IsUIInteractionMode(bool includeDialogue = false)
 {
     return(OWInput.IsInputMode(
                InputMode.Menu |
                InputMode.KeyboardInput |
                (includeDialogue ? InputMode.Dialogue : 0)
                ));
 }
Example #6
0
 public static bool IsAllowedToEquip(ToolMode mode)
 {
     if (_isBuccklingUp || (OWInput.IsInputMode(InputMode.ShipCockpit) && mode == ToolMode.None))
     {
         _isBuccklingUp = false;
         return(true);
     }
     return(_toolsAllowedToEquip.ContainsKey(mode) && _toolsAllowedToEquip[mode]);
 }
Example #7
0
            internal void LateUpdate()
            {
                var isInShip = ToolHelper.Swapper.GetToolGroup() == ToolGroup.Ship;
                var isUsingFixedProbeTool = OWInput.IsInputMode(InputMode.StationaryProbeLauncher) || OWInput.IsInputMode(InputMode.SatelliteCam);

                if (!isInShip && !isUsingFixedProbeTool)
                {
                    foreach (var prompt in _toolUnequipPrompts)
                    {
                        prompt.SetVisibility(false);
                    }
                }
            }
Example #8
0
        private void UpdateVisibility()
        {
            var isCharacterMode = OWInput.IsInputMode(InputMode.Character);
            var shouldBeVisible = !ToolHelper.IsUsingAnyTool() && isCharacterMode;

            if (!_visible && shouldBeVisible)
            {
                SetVisible(true);
            }
            if (_visible && !shouldBeVisible)
            {
                SetVisible(false);
            }
        }
Example #9
0
        internal void Update()
        {
            var isInShip    = OWInput.IsInputMode(InputMode.ShipCockpit);
            var isUsingTool = mode != ToolMode.None && ToolHelper.Swapper.IsInToolMode(mode, ToolGroup.Ship);

            if (!_collider.enabled && isInShip && !isUsingTool)
            {
                _collider.enabled = true;
            }
            if (_collider.enabled && (!isInShip || isUsingTool))
            {
                _collider.enabled = false;
            }
        }
Example #10
0
        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);
            }
        }
Example #11
0
 private void UpdateGrab()
 {
     if (!OWInput.IsInputMode(InputMode.Character))
     {
         if (IsEquipped())
         {
             Unequip();
         }
         return;
     }
     if (ControllerInput.Behaviour.IsGripping && !IsEquipped() && Detector.isInside && _visible)
     {
         Equip();
     }
     if (!ControllerInput.Behaviour.IsGripping && IsEquipped())
     {
         Unequip();
     }
 }
        private void Update()
        {
            if (OWInput.IsInputMode(InputMode.ShipCockpit) && Input.GetKeyDown(KeyCode.L))
            {
                lowSpeedMode = !lowSpeedMode;

                if (lowSpeedMode)
                {
                    NotificationManager.SharedInstance.PostNotification(modeActive, true);
                }
                else
                {
                    if (NotificationManager.SharedInstance.IsPinnedNotification(modeActive))
                    {
                        NotificationManager.SharedInstance.UnpinNotification(modeActive);
                    }

                    NotificationManager.SharedInstance.PostNotification(modeDeactivated);
                }
            }
        }
Example #13
0
            private void OnInteractChange(SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource, bool newState)
            {
                var value = newState ? 1 : 0;

                if (!SceneHelper.IsInGame())
                {
                    _buttons[JoystickButton.FaceLeft] = value;
                    return;
                }

                var button = IsGripping ? JoystickButton.RightBumper : JoystickButton.FaceLeft;

                var isRepairPromptVisible = _repairPrompt != null && _repairPrompt.IsVisible();
                var canRepairSuit         = _playerResources.IsSuitPunctured() && OWInput.IsInputMode(InputMode.Character) && !ToolHelper.Swapper.IsSuitPatchingBlocked();
                var isUsingTranslator     = ToolHelper.Swapper.IsInToolMode(ToolMode.Translator);

                if (!isRepairPromptVisible && !canRepairSuit && !isUsingTranslator)
                {
                    if (newState)
                    {
                        _primaryLastTime = fromAction.changedTime;
                    }
                    else
                    {
                        _primaryLastTime = -1;
                        if (!_justHeld)
                        {
                            SimulateInput(button);
                        }
                        _justHeld = false;
                    }
                }
                else
                {
                    _buttons[button] = value;
                }
            }