Esempio n. 1
0
        void Update()
        {
            // If its not selected, we don't want to run the rest of the function
            if (!toggle)
            {
                return;
            }

            // Some checks to see if we can pick up or not.
            if (seamoth.modules.GetCount(SeamothModule.SeamothClawModule) <= 0)
            {
                return;
            }
            if (!seamoth.GetPilotingMode())
            {
                return;
            }
            if (Player.main.GetPDA().isOpen)
            {
                return;
            }

            // Update hovering.
            UpdateActiveTarget(seamoth);

            // If we let up the Left Mouse Button
            if (GameInput.GetButtonUp(GameInput.Button.LeftHand))
            {
                if (Time.time > this.cooldownTime)
                {
                    // Try Use!
                    TryUse();
                }
            }
        }
Esempio n. 2
0
 [HarmonyPrefix]      // Harmony Prefix
 public static bool Prefix(SeaMoth __instance)
 {
     // Kickstart battery monitoring
     if (__instance.GetPilotingMode())
     {
         MonitorBatteryCount.MonitorSeamothBatteryCount(__instance);
     }
     return(true);
 } // end public static void Postfix()
Esempio n. 3
0
        void Update()
        {
            // If its not selected, we don't want to run the rest of the function
            if (!toggle)
            {
                return;
            }

            // Some checks to see if we can drill or not.
            if (seamoth.modules.GetCount(SeamothModule.SeamothDrillModule) <= 0)
            {
                return;
            }
            if (!seamoth.GetPilotingMode())
            {
                return;
            }
            if (Player.main.GetPDA().isOpen)
            {
                return;
            }

            // Update hovering.
            UpdateActiveTarget(seamoth);

            // If we're pressing the Left Mouse Button and we're not drilling
            if (GameInput.GetButtonDown(GameInput.Button.LeftHand) && !isDrilling)
            {
                // We're now set to drilling, and the drill will start 0.5 seconds from now
                isDrilling    = true;
                timeNextDrill = Time.time + 0.5f;

                // Start the sound.
                Main.DrillLoop.Play();
            }

            // If we let up the Left Mouse Button
            if (GameInput.GetButtonUp(GameInput.Button.LeftHand))
            {
                // We're no longer drilling and sounds have stopped.
                isDrilling = false;
                StopEffects();
            }

            // If we can drill
            if (Time.time > timeNextDrill && isDrilling)
            {
                // Drill!
                Drill(seamoth);
                timeNextDrill = Time.time + 0.12f;
            }
        }
            private static void Postfix(SeaMoth __instance)
            {
                if (__instance.GetPilotingMode() && !Player.main.GetPDA().isInUse)
                {
                    string button2 = LanguageCache.GetButtonFormat("Change Torpedo (<color=#ADF8FFFF>{0}</color>)", GameInput.Button.Deconstruct);

                    string button3      = "";
                    var    toggledSlots = (bool[])Vehicle_quickSlotToggled.GetValue(__instance);
                    for (var i = 0; i < toggledSlots.Length; ++i)
                    {
                        if (toggledSlots[i] && __instance.GetSlotItem(i) != null && __instance.GetSlotItem(i).item.GetTechType() == TechType.SeamothTorpedoModule)
                        {
                            button3 = LanguageCache.GetButtonFormat("\nAccess Torpedo Storage (<color=#ADF8FFFF>{0}</color>)", GameInput.Button.AltTool);
                            break;
                        }
                    }

                    string buttonFormat = LanguageCache.GetButtonFormat("PressToExit", GameInput.Button.Exit);
                    HandReticle.main.SetUseTextRaw(buttonFormat, button2 + button3);
                }
            }
        private void Update()
        {
            if (!isSeamothArmSlotsReady || armsDirty)
            {
                return;
            }

            bool pilotingMode = seamoth.GetPilotingMode();
            bool flag2        = pilotingMode && !seamoth.docked;

#if DEBUG
            pilotingMode = true;
            flag2        = true;

            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                if (currentSelectedArm != SeamothArm.Left)
                {
                    seamoth.SlotKeyDown(LeftArmSlotID);
                }

                seamoth.SendMessage("SlotLeftDown");
            }

            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                if (currentSelectedArm != SeamothArm.Right)
                {
                    seamoth.SlotKeyDown(RightArmSlotID);
                }

                seamoth.SendMessage("SlotLeftDown");
            }

            if (Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow))
            {
                seamoth.SendMessage("SlotLeftUp");
            }
#endif

            if (pilotingMode)
            {
                if (AvatarInputHandler.main.IsEnabled())
                {
                    Vector3 eulerAngles = seamoth.transform.eulerAngles;
                    eulerAngles.x = MainCamera.camera.transform.eulerAngles.x;
                    Quaternion quaternion = Quaternion.Euler(eulerAngles.x, eulerAngles.y, eulerAngles.z);
                    Quaternion rotation   = quaternion;

                    if (flag2)
                    {
                        aimTargetLeft.transform.position  = MainCamera.camera.transform.position + quaternion * Vector3.forward * 100f;
                        aimTargetRight.transform.position = MainCamera.camera.transform.position + rotation * Vector3.forward * 100f;
                    }

                    bool hasPropCannon = false;

                    if (currentSelectedArm == SeamothArm.Left && leftArm != null)
                    {
                        leftArm.Update(ref quaternion);
                        hasPropCannon = leftArm.HasPropCannon();
                    }
                    else if (currentSelectedArm == SeamothArm.Right && rightArm != null)
                    {
                        rightArm.Update(ref rotation);
                        hasPropCannon = rightArm.HasPropCannon();
                    }

                    if (hasPropCannon)
                    {
                        UpdateUIText(hasPropCannon);
                    }

                    if (GameInput.GetButtonDown(GameInput.Button.AltTool))
                    {
                        if (currentSelectedArm == SeamothArm.Left && leftArm != null)
                        {
                            leftArm.OnAltDown();
                        }
                        else if (currentSelectedArm == SeamothArm.Right && rightArm != null)
                        {
                            rightArm.OnAltDown();
                        }
                    }
                }

                UpdateActiveTarget(HasClaw(), HasDrill());
            }
        }
Esempio n. 6
0
        [HarmonyPostfix]      // Harmony postfix
        public static void Postfix(SeaMoth __instance)
        {
            if (__instance.GetPilotingMode())
            {
                EnergyMixin     thisEnergyMixing    = __instance.GetComponent <EnergyMixin>();
                EnergyInterface thisEnergyInterface = thisEnergyMixing.GetComponent <EnergyInterface>();
                thisEnergyInterface.GetValues(out float charge, out float capacity);

                // Display if Player has no Seamoth Link Chip
                if (Config.ShowKeyPromptToggleValue)
                {
                    if (SeamothInfo.electricalModuleIn || SeamothInfo.electronicModuleIn || SeamothInfo.mechanicalModuleIn)
                    {
                        if (!SeamothInfo.seamothLinkModuleIn && !Subtitles.main.popup.isShowingMessage)
                        {
                            DisplayPrompts.DisplayNoLinkPrompts();
                        }
                    }
                }

                // If Seamoth without battery, and electricalModuleIn, show change battery prompt only
                // Display order 1. ELectrical, 2. Electronic, 3. Mechanical (each line adds itself up to the top of player prompts)

                // ###########
                // Mechanical
                // ###########
                if (SeamothInfo.mechanicalModuleIn && SeamothInfo.seamothLinkModuleIn && !FPSInputModule.current.lockMovement && SeamothInfo.BatteryInSlot == 1)
                {
                    // Detect key press and set variable (march up) to set Seamoth gear
                    MonitorGearKeys.MonitorGearKeysDown();

                    if (!Subtitles.main.popup.isShowingMessage && Config.ShowKeyPromptToggleValue && SeamothInfo.BatteryInSlot == 1)
                    {
                        DisplayPrompts.DisplayMechanicalPrompts();
                    }
                }

                // ###########
                // Electronic
                // ###########

                // Adjust gear if SeamothInfo.seamothLinkModuleIn not in
                if (!SeamothInfo.seamothLinkModuleIn && Config.SeamothGearValue != 4f)
                {
                    Config.SeamothGearValue = 4f;
                    PlayerPrefs.SetFloat("SeamothGearValueSlider", Config.SeamothGearValue);
                }

                if (SeamothInfo.electronicModuleIn && SeamothInfo.seamothLinkModuleIn && !FPSInputModule.current.lockMovement && SeamothInfo.BatteryInSlot == 1)
                {
                    // Detect key press and set variable to toggle Cruise Control on / off
                    MonitorCruiseKey.MonitorCruiseKeyDown();

                    // Detect key press and set variable to toggle Turbo on / off
                    if (charge > 20f)
                    {
                        MonitorModeKey.MonitorModeKeyDown();
                    }
                    else
                    {
                        if (!SeamothInfo.ModeGreenOn)
                        {
                            SeamothInfo.ModeGreenOn = true;
                            SeamothInfo.ModeChanged = true;
                        }
                    }

                    // Adjust gear for Green Mode
                    if (SeamothInfo.ModeGreenOn && Config.SeamothGearValue == 6f)
                    {
                        Config.SeamothGearValue = 5f;
                        PlayerPrefs.SetFloat("SeamothGearValueSlider", Config.SeamothGearValue);
                    }

                    // Detect key press and set variable to cycle through health display (mh, h, %)
                    MonitorHealthKey.MonitorHealthKeyDown();

                    // Detect key press and set variable to cycle through power display (mu, u, %)
                    MonitorPowerKey.MonitorPowerKeyDown();

                    if (!Subtitles.main.popup.isShowingMessage && Config.ShowKeyPromptToggleValue)
                    {
                        DisplayPrompts.DisplayElectronicPrompts(charge);
                    }
                } // end if (SeamothInfo.electronicModuleIn)


                // ###########
                // Electrical
                // ###########
                if (SeamothInfo.electricalModuleIn && SeamothInfo.seamothLinkModuleIn && !FPSInputModule.current.lockMovement)
                {
                    // Detect key press for the battery reload button
                    MonitorReloadKey.MonitorReloadKeyDown(__instance);

                    if (SeamothInfo.BatteryInSlot == 1)
                    {
                        // Detect key press and set variable to toggle lights Lo / Hi beam
                        MonitorLightBeamKey.MonitorLightBeamKeyDown(__instance);

                        // Seaglide Map Controls light toggle fix
                        SeaglideMapControlFix.SeaglideMapControlLightFix(__instance);

                        // Show player key prompts
                        if (Player.main != null && !Player.main.GetPDA().isInUse&& !FPSInputModule.current.lockMovement)
                        {
                            if (!Subtitles.main.popup.isShowingMessage && Config.ShowKeyPromptToggleValue)
                            {
                                DisplayPrompts.DisplayElectricalPrompts();
                            }
                            if (SeamothInfo.preventLightToggle == true)
                            {
                                SeamothInfo.preventLightToggle = false;
                            }
                        }
                    }
                    else
                    {
                        if (SeamothInfo.MainBatteryCount > 0)
                        {
                            DisplayPrompts.DisplayInsertBattery();
                        }
                        else
                        {
                            DisplayPrompts.DisplayNoBattery();
                        }
                    }

                    // Display battery prompts when R key was pressed which triggers FPSInputModule.current.lockMovement for 5 seconds
                    if (Player.main != null && FPSInputModule.current.lockMovement)
                    {
                        DisplayPrompts.DisplayBatteryPrompts();
                    }
                }

                if (!SeamothInfo.electricalModuleIn)
                {
                    // Make new default light mode to be a Low Beam mode
                    if (Vehicle_Update_Patch.HighBeamOn)
                    {
                        Vehicle_Update_Patch.HighBeamOn = false;
                    }
                }

                // Update batery count
                MonitorBatteryCount.MonitorSeamothBatteryCount(__instance);

                // Apply Low and High beam light toggle
                ToggleLightBeam.ToggleLoHighBeam(__instance);
            } // end if (__instance.GetPilotingMode())
        }     // end public static void Postfix(SeaMoth __instance)