Exemple #1
0
        // emulate CrewHatchController, which uses LateUpdate(), not Update()
        private void LateUpdate()
        {
            if (hijack)
            {
                considerHijack();
            }

            if (Mouse.CheckButtons(Mouse.GetAllMouseButtonsDown(), Mouse.Buttons.Left) && FlightUIModeController.Instance.Mode != FlightUIMode.ORBITAL)
            {
                modclick = modkey.GetKey();
                if ((modclick || useCTI) && Physics.Raycast(FlightCamera.fetch.mainCamera.ScreenPointToRay(Input.mousePosition), out hit, RAYCAST_DIST, 1 << LAYER_PARTTRIGGER, QueryTriggerInteraction.Collide))
                {
                    if (hit.collider.CompareTag(TAG_AIRLOCK))
                    {
                        if (InputLockManager.IsAllLocked(ControlTypes.KEYBOARDINPUT))
                        {
                            Debug.Log("[AirlockPlus] INFO: " + (modclick?"mod+":"") + "click detected on airlock, but input lock is active.");
                            Debug.Log(InputLockManager.PrintLockStack());
                        }
                        else
                        {
                            Debug.Log("[AirlockPlus] INFO: " + (modclick?"mod+":"") + "click detected on airlock, standing by to hijack CrewHatchDialog.");
                            airlock = hit.collider;
                            hijack  = true;
                            chd     = null;
                            frame   = 0;
                        }
                    }
                }
            }
        }
        public override void OnUpdate()
        {
            // Do nothing unless this KerbalEVA is the active vessel in flight, in vessel view, and positioned to enter an airlock
            if (tgtAirlockPart == null || !HighLogic.LoadedSceneIsFlight || !vessel.isActiveVessel || inMap)
            {
                return;
            }

            // HACK: re-enable KerbalEVA one frame after blocking stock boarding from registering alongside auto boarding
            if (autoBoardingFull)
            {
                keva.enabled     = true;
                autoBoardingFull = false;
            }

            if (manualBoarding)
            {
                // Not checking for input locks in here, we should be holding the lock on all but camera controls at this juncture

                // Use GetKeyUp instead of GetKey/GetKeyDown prevents triggering game pause immediately upon releasing input lock
                if (Input.GetKeyUp(KeyCode.Escape))
                {
                    BoardManualCxl();
                    return;
                }

                if (lastHovered != Mouse.HoveredPart)
                {
                    if (lastHovered != null && highlightParts.ContainsKey(lastHovered.flightID))
                    {
                        lastHovered.highlighter.ConstantOnImmediate(SpaceAvail(lastHovered) ? COLOR_AVAIL : COLOR_FULL);
                    }
                    lastHovered = Mouse.HoveredPart;
                    if (lastHovered != null && highlightParts.ContainsKey(lastHovered.flightID))
                    {
                        lastHovered.highlighter.ConstantOnImmediate(SpaceAvail(lastHovered) ? COLOR_AVAIL_OVR : COLOR_FULL_OVR);
                    }
                }

                if (Mouse.CheckButtons(Mouse.GetAllMouseButtonsDown(), Mouse.Buttons.Left) && lastHovered != null)
                {
                    BoardManualSel();
                }
            }
            else
            {
                if (Input.GetKey(KeyCode.LeftShift) && boardkey.GetKeyUp())
                {
                    if (InputLockManager.IsAllLocked(ControlTypes.KEYBOARDINPUT))
                    {
                        Debug.Log("[AirlockPlus|BoardingPass] INFO: shift+board detected, but input lock is active.");
                        Debug.Log(InputLockManager.PrintLockStack());
                    }
                    else
                    {
                        _BoardAuto();
                    }
                }
                if (Input.GetKey(KeyCode.LeftControl) && boardkey.GetKeyUp())
                {
                    if (InputLockManager.IsAllLocked(ControlTypes.KEYBOARDINPUT))
                    {
                        Debug.Log("[AirlockPlus|BoardingPass] INFO: ctrl+board detected, but input lock is active.");
                        Debug.Log(InputLockManager.PrintLockStack());
                    }
                    else
                    {
                        BoardManual();
                    }
                }
            }
        }