Esempio n. 1
0
        public static void MonitorModeKeyDown()
        {
            // Detect key press and set variable to toggle Seamoth engine Turbo / Green mode

            // Toggle Turbo / Green mode
            if (KeyCodeUtils.GetKeyDown(Config.ModeKeybindValue))
            {
                if (SeamothInfo.ModeGreenOn)
                {
                    if (Config.SeamothGearValue == 6f)
                    {
                        Config.SeamothGearValue = 5f;
                    }

                    SeamothInfo.ModeGreenOn = false;
                    SeamothInfo.ModeChanged = true;
                    PlayerPrefs.SetFloat("SeamothGearValueSlider", Config.SeamothGearValue);
                }
                else
                {
                    SeamothInfo.ModeGreenOn = true;
                    SeamothInfo.ModeChanged = true;
                }
            }
        }
Esempio n. 2
0
        public static bool Prefix()
        {
            bool flag  = MainCameraControlPatcher.IsInSeamoth && !Config.EnableSeamoth;
            bool flag2 = MainCameraControlPatcher.IsInPrawnSuit && !Config.EnablePrawn;
            bool flag3 = !Config.EnableSnapTurning || flag || flag2;
            bool result;

            if (flag3)
            {
                result = true;
            }
            else
            {
                bool flag4       = GameInput.GetButtonDown(26) || KeyCodeUtils.GetKeyDown(Config.KeybindKeyRight);
                bool flag5       = GameInput.GetButtonDown(25) || KeyCodeUtils.GetKeyDown(Config.KeybindKeyLeft);
                bool buttonHeld  = GameInput.GetButtonHeld(25);
                bool buttonHeld2 = GameInput.GetButtonHeld(26);
                bool flag6       = flag5 || flag4 || buttonHeld || buttonHeld2;
                bool flag7       = XRSettings.enabled && flag6;
                bool flag8       = flag7;
                if (flag8)
                {
                    MainCameraControlPatcher.UpdatePlayerOrVehicleRotation(flag4, flag5);
                    result = false;
                }
                else
                {
                    result = true;
                }
            }
            return(result);
        }
        private void Update()
        {
            if (musicSource != null)
            {
                musicSource.volume = volume;
            }

            if (VirtualKey.GetKeyDown(VK.VK_MEDIA_STOP) || KeyCodeUtils.GetKeyDown(Config.StopKey))
            {
                stopped = true;
                paused  = false;
                Stop();
            }
            if (VirtualKey.GetKeyDown(VK.VK_MEDIA_PLAY_PAUSE) || KeyCodeUtils.GetKeyDown(Config.PlayPauseKey))
            {
                if (!stopped)
                {
                    Pause();
                }
                else
                {
                    stopped         = false;
                    paused          = false;
                    timeOfLastMusic = Time.time;
                    var filename = OST.Concat(CustomMusic).First(x => x.Value == musicSource.clip).Key;
                    musicSource.Play();
                }
            }
            if (VirtualKey.GetKeyDown(VK.VK_MEDIA_NEXT_TRACK) || KeyCodeUtils.GetKeyDown(Config.NextTrackKey))
            {
                NextTrack();
            }
            if (VirtualKey.GetKeyDown(VK.VK_MEDIA_PREV_TRACK) || KeyCodeUtils.GetKeyDown(Config.PreviousTrackKey))
            {
                if (CurrentTrackIndex > 0 && Time.time - timeOfLastMusic <= 1)
                {
                    PreviousTrack();
                }
                else
                {
                    Stop();
                    timeOfLastMusic = Time.time;
                    var filename = OST.Concat(CustomMusic).First(x => x.Value == musicSource.clip).Key;
                    musicSource.Play();
                }
            }
        }
        public static void MonitorLightBeamKeyDown(SeaMoth thisSeaMoth)
        {
            // Detect key press and set variable to toggle lights Lo / Hi beam
            if (KeyCodeUtils.GetKeyDown(Config.LightsLoHiKeybindValue))
            {
                ToggleLights thisToggleLights = thisSeaMoth.GetComponentInChildren <ToggleLights>();

                if (Vehicle_Update_Patch.HighBeamOn)
                {
                    Utils.PlayEnvSound(thisToggleLights.lightsOffSound, thisToggleLights.lightsOffSound.gameObject.transform.position, 20f);
                    Vehicle_Update_Patch.HighBeamOn = false;
                }
                else
                {
                    Utils.PlayEnvSound(thisToggleLights.lightsOnSound, thisToggleLights.lightsOnSound.gameObject.transform.position, 20f);
                    Vehicle_Update_Patch.HighBeamOn = true;
                }
            }
        }
        public static void MonitorCruiseKeyDown()
        {
            // Detect key press and set variable to toggle Cruise Control on / off
            // Turn cruise off if forward or reverse buttonis pressed
            if (KeyCodeUtils.GetKeyDown(KeyCode.W) || KeyCodeUtils.GetKeyDown(KeyCode.S))
            {
                SeamothInfo.CruiseControlOn = false;
            }

            // Toggle cruise control
            if (KeyCodeUtils.GetKeyDown(Config.CruiseKeybindValue))
            {
                if (SeamothInfo.CruiseControlOn)
                {
                    SeamothInfo.CruiseControlOn = false;
                }
                else
                {
                    SeamothInfo.CruiseControlOn = true;
                }
            }
        }
Esempio n. 6
0
        public static void MonitorGearKeysDown()
        {
            // Detect key press and set variable (march up) to set Seamoth gear
            if (KeyCodeUtils.GetKeyDown(Config.GearUpKeybindValue))
            {
                var gearVal = Config.SeamothGearValue + 1f;
                if (SeamothInfo.ModeGreenOn)
                {
                    if (gearVal > 5f)
                    {
                        return;
                    }
                }
                if (!SeamothInfo.ModeGreenOn)
                {
                    if (gearVal > 6f)
                    {
                        return;
                    }
                }
                Config.SeamothGearValue = gearVal;
                PlayerPrefs.SetFloat("SeamothGearValueSlider", gearVal);
            } // end if (KeyCodeUtils.GetKeyDown(KeyCode.LeftShift))

            // Detect key press and set variable (march down) to set Seamoth gear
            if (KeyCodeUtils.GetKeyDown(Config.GearDownKeybindValue))
            {
                var gearVal = Config.SeamothGearValue - 1f;
                if (gearVal < 1f)
                {
                    return;
                }
                Config.SeamothGearValue = gearVal;
                PlayerPrefs.SetFloat("SeamothGearValueSlider", gearVal);
            } // end if (KeyCodeUtils.GetKeyDown(KeyCode.LeftControl))
        }
        public static void MonitorHealthKeyDown()
        {
            // Detect key press and set variable to cycle through health display (mh, h, %)
            if (KeyCodeUtils.GetKeyDown(Config.HealthKeybindValue))
            {
                switch (Config.MarchThroughHealthValue)
                {
                case 1:
                    Config.MarchThroughHealthValue = 2f;
                    PlayerPrefs.SetFloat("MarchThroughHealthValueSlider", 2f);
                    break;

                case 2:
                    Config.MarchThroughHealthValue = 3f;
                    PlayerPrefs.SetFloat("MarchThroughHealthValueSlider", 3f);
                    break;

                default:
                    Config.MarchThroughHealthValue = 1f;
                    PlayerPrefs.SetFloat("MarchThroughHealthValueSlider", 1f);
                    break;
                }
            }
        }
Esempio n. 8
0
        [HarmonyPostfix]      // Harmony postfix
        public static void Postfix(Vehicle __instance)
        {
            if (Player.main.currentMountedVehicle != null)
            {
                if (Player.main.currentMountedVehicle == __instance && Config.UseEnergyToggleValue && !AirVentInfo.AirVentsOn)
                {
                    var efficiencyLoaded = __instance.modules.GetCount(TechType.VehiclePowerUpgradeModule);
                    //float energyCost = 0.1f; // vanilla 0.1f per sec
                    float energyCost = Player.main.currentMountedVehicle.oxygenEnergyCost;

                    if (Config.UseEasyEnergyToggleValue)
                    {
                        switch (efficiencyLoaded)
                        {
                        case 0:
                            energyCost *= 0.4f;
                            break;

                        case 1:
                            energyCost *= 0.25f;
                            break;

                        default:
                            energyCost *= 0.1f;
                            break;
                        }
                    }
                    else
                    {
                        switch (efficiencyLoaded)
                        {
                        case 0:
                            energyCost *= 0.5f;
                            break;

                        case 1:
                            energyCost *= 0.4f;
                            break;

                        case 2:
                            energyCost *= 0.3f;
                            break;

                        case 3:
                            energyCost *= 0.2f;
                            break;

                        default:
                            energyCost *= 0.1f;
                            break;
                        }
                    }

                    // Consume energy for continuously replenishing oxygen
                    OxygenManager oxygenMgr = Player.main.oxygenMgr;
                    oxygenMgr.GetTotal(out float oxygenAvailable, out float oxygenCapacity);

                    if (!OtherModsInfo.RefillableOxygenTankPresent)
                    {
                        if (oxygenAvailable == oxygenCapacity)
                        {
                            ConsumeOxygenEnergy(__instance, energyCost);
                        }
                    }
                    else
                    {
                        //if (!Player.main.oxygenMgr.HasOxygenTank())
                        if (Player.main.currentMountedVehicle.modules.GetCount(VehicleOxygenUpgradeModule.TechTypeID) > 0)
                        {
                            ConsumeOxygenEnergy(__instance, energyCost);
                        }
                    }
                } // end if (main.currentMountedVehicle != null && Config.UseEnergyToggleValue)

                if (KeyCodeUtils.GetKeyDown(Config.ToggleAirVentsKeybindValue))
                {
                    //if (Mathf.RoundToInt(Player.main.GetDepth()) < Objects.AirVentInfo.DepthDetection)
                    if (Player.main.GetDepth() < AirVentInfo.DepthDetection)
                    {
                        if (AirVentInfo.AirVentsOn == false)
                        {
                            AirVentInfo.AirVentsOn = true;
                        }
                        else
                        {
                            AirVentInfo.AirVentsOn = false;
                        }
                    }
                }

                // (Mathf.RoundToInt(Player.main.GetDepth()) > Objects.AirVentInfo.DepthDetection)
                if (Player.main.GetDepth() > AirVentInfo.DepthDetection)
                {
                    if (AirVentInfo.AirVentsOn == true)
                    {
                        AirVentInfo.AirVentsOn = false;
                    }
                }
                else
                {
                    if (Config.AirVentsAutoToggleValue)
                    {
                        if (AirVentInfo.AirVentsOn == false)
                        {
                            AirVentInfo.AirVentsOn = true;
                        }
                    }
                }
            } // end if (Player.main.currentMountedVehicle != null)
        }     // end public static void Postfix(Vehicle __instance)
Esempio n. 9
0
        public static bool Prefix()
        {
            var isIgnoringSeamoth = IsInSeamoth && !Config.EnableSeamoth;
            var isIgnoringPrawn   = IsInPrawnSuit && !Config.EnablePrawn;

            if (!Config.EnableSnapTurning || isIgnoringSeamoth || isIgnoringPrawn)
            {
                return(true); //Enter vanilla method
            }

            var didLookRight   = GameInput.GetButtonDown(GameInput.Button.LookRight) || KeyCodeUtils.GetKeyDown(Config.KeybindKeyRight);
            var didLookLeft    = GameInput.GetButtonDown(GameInput.Button.LookLeft) || KeyCodeUtils.GetKeyDown(Config.KeybindKeyLeft);
            var isLookingLeft  = GameInput.GetButtonHeld(GameInput.Button.LookLeft);
            var isLookingRight = GameInput.GetButtonHeld(GameInput.Button.LookRight);
            var isLooking      = didLookLeft || didLookRight || isLookingLeft || isLookingRight;

            var shouldSnapTurn = XRSettings.enabled && isLooking;

            if (shouldSnapTurn)
            {
                UpdatePlayerOrVehicleRotation(didLookRight, didLookLeft);
                return(false); //Don't enter vanilla method if we snap turn
            }

            return(true);
        }
Esempio n. 10
0
 private static void UpdateFields()
 {
     _didLookRight         = GameInput.GetButtonDown(GameInput.Button.LookRight) || KeyCodeUtils.GetKeyDown(Config.instance.KeybindKeyRight);
     _didLookLeft          = GameInput.GetButtonDown(GameInput.Button.LookLeft) || KeyCodeUtils.GetKeyDown(Config.instance.KeybindKeyLeft);
     _isLookingRight       = GameInput.GetButtonHeld(GameInput.Button.LookRight) || KeyCodeUtils.GetKeyHeld(Config.instance.KeybindKeyRight);
     _isLookingLeft        = GameInput.GetButtonHeld(GameInput.Button.LookLeft) || KeyCodeUtils.GetKeyHeld(Config.instance.KeybindKeyLeft);
     _isLookingLeftOrRight = _didLookLeft || _didLookRight || _isLookingLeft || _isLookingRight;
     _shouldSnapTurn       = XRSettings.enabled && _isLookingLeftOrRight;
     _isLookingUpOrDown    = GameInput.GetButtonDown(GameInput.Button.LookUp) ||
                             GameInput.GetButtonDown(GameInput.Button.LookDown) ||
                             GameInput.GetButtonHeld(GameInput.Button.LookUp) ||
                             GameInput.GetButtonHeld(GameInput.Button.LookDown);
 }