예제 #1
0
        static void Postfix(SeaMoth __instance, int slotID, bool active)
        {
            // Find the TechType in the toggled slot.
            // Valid inputs would be along the lines of: SeamothModule1, SeamothModule2, etc
            // slotID is 0-based, so an addition of 1 is required.
            var techType = __instance.modules.GetTechTypeInSlot($"SeamothModule{slotID + 1}");

            // If its the SeamothClawModule
            if (techType == SeamothModule.SeamothClawModule)
            {
                // Get the SeamothClaw component from the SeaMoth object.
                var seamothClawModule = __instance.GetComponent <SeamothClaw>();

                // If its not null
                if (seamothClawModule != null)
                {
                    // Set its toggle!
                    seamothClawModule.toggle = active;
                }
            }
            // If its the SeamothDrillModule
            else if (techType == SeamothModule.SeamothDrillModule)
            {
                // Get the SeamothDrill component from the SeaMoth object.
                var seamothDrillModule = __instance.GetComponent <SeamothDrill>();

                // If its not null
                if (seamothDrillModule != null)
                {
                    // Set its toggle!
                    seamothDrillModule.toggle = active;
                }
            }
        }
예제 #2
0
 static void Postfix(SeaMoth __instance, int slotID, TechType techType, bool added)
 {
     if (techType == LaserCannon.TechTypeID)
     {
         if (added)
         {
             if (__instance.GetComponent <LaserCannon_Seamoth>() == null)
             {
                 var laserCannon = __instance.gameObject.AddComponent <LaserCannon_Seamoth>();
                 laserCannon.slotID = slotID;
                 Debug.Log($"[LaserCannon] Added component to instance: {__instance.name} ID: {__instance.GetInstanceID()}");
             }
             else
             {
                 var laserCannon = __instance.GetComponent <LaserCannon_Seamoth>();
                 laserCannon.seamoth = __instance.GetComponent <SeaMoth>();
                 laserCannon.slotID  = slotID;
                 laserCannon.enabled = true;
             }
         }
         else
         {
             __instance.GetComponent <LaserCannon_Seamoth>().enabled = false;
         }
     }
 }
        public void Awake()
        {
            Main = this;

            seamoth     = gameObject.GetComponent <SeaMoth>();
            energyMixin = seamoth.GetComponent <EnergyMixin>();
            var repulsionCannonPrefab = Resources.Load <GameObject>("WorldEntities/Tools/RepulsionCannon").GetComponent <RepulsionCannon>();

            //RepulsionCannon repulsionCannonPrefab = CraftData.InstantiateFromPrefab(TechType.RepulsionCannon, false).GetComponent<RepulsionCannon>();
            shootSound = Instantiate(repulsionCannonPrefab.shootSound, seamoth.transform);
            //Destroy(repulsionCannonPrefab);

            loopingEmitter       = gameObject.AddComponent <FMOD_CustomLoopingEmitter>();
            loopingEmitter.asset = shootSound;

            var powerRelayPrefab = Resources.Load <GameObject>("Submarine/Build/PowerTransmitter").GetComponent <PowerFX>();

            //PowerFX powerRelayPrefab = CraftData.InstantiateFromPrefab(TechType.PowerTransmitter, false).GetComponent<PowerFX>();
            laserBeam = Instantiate(powerRelayPrefab.vfxPrefab, seamoth.transform);
            laserBeam.SetActive(false);
            //Destroy(powerRelayPrefab);

            lineRenderer                = laserBeam.GetComponent <LineRenderer>();
            lineRenderer.startWidth     = 0.4f;
            lineRenderer.endWidth       = 0.4f;
            lineRenderer.receiveShadows = false;
            lineRenderer.loop           = false;

            SetBeamColor();
        }
        public void Awake()
        {
            seamoth         = gameObject.GetComponent <SeaMoth>();
            leftTorpedoSlot = seamoth.torpedoTubeLeft.transform;
            energyMixin     = seamoth.GetComponent <EnergyMixin>();

            var scannerPrefab = Resources.Load <GameObject>("WorldEntities/Tools/Scanner").GetComponent <ScannerTool>();

            //ScannerTool scannerPrefab = CraftData.InstantiateFromPrefab(TechType.Scanner, false).GetComponent<ScannerTool>();
            scanSound     = Instantiate(scannerPrefab.scanSound, gameObject.transform);
            completeSound = Instantiate(scannerPrefab.completeSound, gameObject.transform);
            fxControl     = Instantiate(scannerPrefab.fxControl, gameObject.transform);
            scanBeam      = Instantiate(scannerPrefab.scanBeam, leftTorpedoSlot.transform);

            MeshRenderer[] renderers             = scannerPrefab.GetComponentsInChildren <MeshRenderer>(true);
            Renderer       instantiated_renderer = Instantiate(renderers[0]);

            scanCircuitTex = instantiated_renderer.materials[0].mainTexture;
            scanOrganicTex = instantiated_renderer.materials[2].mainTexture;

            //Destroy(instantiated_renderer);
            //Resources.UnloadAsset(scannerPrefab);

            scanBeam.transform.localScale    = new Vector3(1, 4, 1);
            scanBeam.transform.localRotation = new Quaternion(-0.7683826f, 0.1253118f, 0.0448633f, 0.6259971f);
        }
        internal static void Postfix(SeaMoth __instance)
        {
            if (__instance.GetComponent <SlotExtender>() == null)
            {
                __instance.gameObject.AddComponent <SlotExtender>();

                Debug.Log($"[SlotExtender] Added component to instance: {__instance.name} ID: {__instance.GetInstanceID()}");
            }
        }
예제 #6
0
        static void Prefix(SeaMoth __instance)
        {
            // Get TemperatureDamage class from SeaMoth
            var tempDamage = __instance.GetComponent <TemperatureDamage>();

            // Set the different fields
            // No need to check for depth because the SeaMoth would already
            // be dead if you don't have the depth modules.
            tempDamage.baseDamagePerSecond  = 0.2f;
            tempDamage.onlyLavaDamage       = true;
            tempDamage.minDamageTemperature = 50;
        }
            private static bool Prefix(SeaMoth __instance, TechType techType, int slotID)
            {
                if (techType == TechType.SeamothTorpedoModule)
                {
                    Transform[] muzzles =
                    {
                        __instance.transform.Find("TorpedoSiloLeft"),
                        __instance.transform.Find("TorpedoSiloRight"),
                        __instance.transform.Find("TorpedoSiloUpperLeft"),
                        __instance.transform.Find("TorpedoSiloUpperRight"),
                    };
                    Transform muzzle = muzzles[slotID];

                    ItemsContainer storageInSlot = __instance.GetStorageInSlot(slotID, TechType.SeamothTorpedoModule);
                    if (storageInSlot.count == 0)
                    {
                        ErrorMessage.AddError(Language.main.Get("VehicleTorpedoNoAmmo"));
                    }

                    TorpedoType        torpedoType  = null;
                    var                primaryType  = __instance.GetComponent <PrimaryTorpedo>().PrimaryTorpedoType;
                    List <TorpedoType> torpedoTypes = __instance.torpedoTypes.ToList();
                    torpedoTypes.Sort((a, b) => {
                        return(a.techType == b.techType ? 0 : (a.techType == primaryType ? -1 : 1));
                    });
                    foreach (var t in torpedoTypes)
                    {
                        if (storageInSlot.Contains(t.techType))
                        {
                            torpedoType = t;
                            break;
                        }
                    }

                    var firedTorpedo = Vehicle.TorpedoShot(storageInSlot, torpedoType, muzzle);
                    if (firedTorpedo && storageInSlot.count == 0)
                    {
                        Utils.PlayFMODAsset(__instance.torpedoDisarmed, __instance.transform, 1f);
                    }

                    if (firedTorpedo)
                    {
                        var quickSlotTimeUsed = (float[])Vehicle_quickSlotTimeUsed.GetValue(__instance);
                        var quickSlotCooldown = (float[])Vehicle_quickSlotCooldown.GetValue(__instance);
                        quickSlotTimeUsed[slotID] = Time.time;
                        quickSlotCooldown[slotID] = Mod.config.TorpedoShotCooldown;
                    }

                    return(false);
                }
                return(true);
            }
예제 #8
0
 static void Postfix(SeaMoth __instance, int slotID, TechType techType, bool added)
 {
     if (techType == ScannerModule.TechTypeID)
     {
         if (added)
         {
             if (__instance.GetComponent <ScannerModuleSeamoth>() == null)
             {
                 __instance.gameObject.AddComponent <ScannerModuleSeamoth>();
                 Debug.Log($"[ScannerModule] Added component to instance: {__instance.name} ID: {__instance.GetInstanceID()}");
             }
             else
             {
                 __instance.GetComponent <ScannerModuleSeamoth>().enabled = true;
             }
         }
         else
         {
             __instance.GetComponent <ScannerModuleSeamoth>().enabled = false;
         }
     }
 }
        static void PostFix(SeaMoth instance, int slotID, bool active)
        {
            // Finds the tech type in the toggled slot
            TechType type = instance.modules.GetTechTypeInSlot(SeamothSlots.slotIDs[slotID]);

            // If it was the builder module, access the module and activate/deactivate it
            if (type == MainPatcher.SeamothBuilderModule)
            {
                SeamothBuilder tool = instance.GetComponent <SeamothBuilder>();
                if (tool)
                {
                    tool.enable = active;
                }
            }
        }
        internal static bool Prefix(ref SeaMoth __instance, ref string __result)
        {
            var techType = __instance.GetComponent <TechTag>().type;

            if (techType == SeaMothMk2.TechTypeID)
            {
                __result = "SEAMOTH MK2";
                return(false);
            }
            else if (techType == SeaMothMk3.TechTypeID)
            {
                __result = "SEAMOTH MK3";
                return(false);
            }

            return(true);
        }
        static void Postfix(SeaMoth __instance, int slotID, bool active)
        {
            // Find the TechType in the toggled slot.
            var techType = __instance.modules.GetTechTypeInSlot(SeamothUtility.slotIDs[slotID]);

            // If its the SeamothDrillModule
            if (techType == Main.SeamothDrillModule)
            {
                // Get the SeamothDrill component from the SeaMoth object.
                var seamothDrillModule = __instance.GetComponent <SeamothDrill>();

                // If its not null
                if (seamothDrillModule != null)
                {
                    // Set its toggle!
                    seamothDrillModule.toggle = active;
                }
            }
        }
예제 #12
0
        internal static void UpgradeSeaMoth(SeaMoth seamoth, bool announce = false)
        {
            TechType seamothType = seamoth.GetComponent <TechTag>().type;

            if (seamothType != SeaMothMk2.TechTypeID && seamothType != SeaMothMk3.TechTypeID)
            {
                return; // This is a normal Seamoth. Do not upgrade.
            }
            float minimumCrush = 0f;

            if (seamothType == SeaMothMk2.TechTypeID)
            {
                minimumCrush = 700f;
            }
            else if (seamothType == SeaMothMk3.TechTypeID)
            {
                minimumCrush = 1500f;
            }

            OverrideCrushDepth(seamoth.crushDamage, minimumCrush, announce);
        }
예제 #13
0
 /// <summary>
 /// This method is examine of the the current mounted left arm <see cref="TechType"/> of the <see cref="SeaMoth"/>.
 /// </summary>
 /// <returns>
 /// If any arm mounted in the left arm socket, returns the arm <see cref="TechType"/>.<br/>Otherwise, returns <see cref="TechType.None"/>.
 /// </returns>
 public TechType GetLeftArmType(SeaMoth seamoth)
 {
     return(seamoth.GetComponent <SeamothArmManager>().currentLeftArmType);
 }
예제 #14
0
 /// <summary>
 /// This method is examine if any arm selected in the quickslot bar.
 /// </summary>
 /// <returns>
 /// If any arm selected in the quickslot bar, returns <c>true</c>.<br/>Otherwise, returns <c>false</c>.
 /// </returns>
 public bool IsArmSlotSelected(SeaMoth seamoth)
 {
     return(seamoth.GetComponent <SeamothArmManager>().IsArmSlotSelected);
 }
예제 #15
0
        public void Awake()
        {
            thisSeamoth     = GetComponent <SeaMoth>();
            leftTorpedoSlot = thisSeamoth.torpedoTubeLeft.transform;
            energyMixin     = thisSeamoth.GetComponent <EnergyMixin>();

            GameObject scannerPrefab = Instantiate(CraftData.GetPrefabForTechType(TechType.Scanner));

            scannerPrefab.SetActive(false);
            Utils.ZeroTransform(scannerPrefab.transform);

            ScannerTool scannerTool = scannerPrefab.GetComponent <ScannerTool>();

            GameObject ScannerModuleGO = new GameObject("ScannerModuleGO");

            ScannerModuleGO.transform.SetParent(leftTorpedoSlot.transform, false);
            Utils.ZeroTransform(ScannerModuleGO.transform);

            scan_loop       = ScriptableObject.CreateInstance <FMODAsset>();
            scan_loop.name  = "scan_loop";
            scan_loop.path  = "event:/tools/scanner/scan_loop";
            scanSound       = ScannerModuleGO.AddComponent <FMOD_CustomLoopingEmitter>();
            scanSound.asset = scan_loop;

            completeSound      = ScriptableObject.CreateInstance <FMODAsset>();
            completeSound.name = "scan_complete";
            completeSound.path = "event:/tools/scanner/scan_complete";

            fxControl = scannerTool.fxControl.GetComponentClone(ScannerModuleGO.transform);

            scanBeam = scannerPrefab.FindChild("x_ScannerBeam").GetPrefabClone(ScannerModuleGO.transform, false);

            scanCircuitTex = scannerTool.scanCircuitTex.CreateRWTextureFromNonReadableTexture();
            scanOrganicTex = scannerTool.scanOrganicTex.CreateRWTextureFromNonReadableTexture();

            scanCircuitColor = scannerTool.scanCircuitColor;
            scanOrganicColor = scannerTool.scanOrganicColor;

            scanBeam.transform.localPosition = new Vector3(0, 0, -0.37f);
            scanBeam.transform.localScale    = new Vector3(1, 4.41f, 1.55f);
            scanBeam.transform.localRotation = Quaternion.Euler(280, 184, 185);

            Destroy(scannerPrefab);
            Destroy(ScannerModuleGO.FindChild("Scanner(Clone)(Clone)"));



            SetFXActive(false);

            Shader shader = Shader.Find("FX/Scanning");

            if (shader != null)
            {
                scanMaterialCircuitFX = new Material(shader)
                {
                    hideFlags = HideFlags.HideAndDontSave
                };
                scanMaterialCircuitFX.SetTexture(ShaderPropertyID._MainTex, scanCircuitTex);
                scanMaterialCircuitFX.SetColor(ShaderPropertyID._Color, scanCircuitColor);
                scanMaterialOrganicFX = new Material(shader)
                {
                    hideFlags = HideFlags.HideAndDontSave
                };
                scanMaterialOrganicFX.SetTexture(ShaderPropertyID._MainTex, scanOrganicTex);
                scanMaterialOrganicFX.SetColor(ShaderPropertyID._Color, scanOrganicColor);
            }

            thisSeamoth.onToggle             += OnToggle;
            thisSeamoth.modules.onAddItem    += OnAddItem;
            thisSeamoth.modules.onRemoveItem += OnRemoveItem;

            Player.main.playerMotorModeChanged.AddHandler(this, new Event <Player.MotorMode> .HandleFunction(OnPlayerMotorModeChanged));

            moduleCount = thisSeamoth.modules.GetCount(ScannerModulePrefab.TechTypeID);
        }
예제 #16
0
 /// <summary>
 /// This method is examine if any arm attached to any of the <see cref="SeaMoth"/> arm slots.
 /// </summary>
 /// <returns>
 /// If any arm attached to any of the <see cref="SeaMoth"/> arm slots, returns <c>true</c>.<br/>Otherwise, returns <c>false</c>.
 /// </returns>
 public bool IsAnyArmAttached(SeaMoth seamoth)
 {
     return(seamoth.GetComponent <SeamothArmManager>().IsAnyArmAttached);
 }
예제 #17
0
 /// <summary>
 /// This method is examine for the selected arm <see cref="TechType"/>.
 /// </summary>
 /// <returns>
 /// If any arm selected in the quickslot bar, returns the arm <see cref="TechType"/>.<br/>Otherwise, returns <see cref="TechType.None"/>.
 /// </returns>
 public TechType GetSelectedArmTechType(SeaMoth seamoth)
 {
     return(seamoth.GetComponent <SeamothArmManager>().GetSelectedArmTechType());
 }
예제 #18
0
 /// <summary>
 /// This method is examine of the current active target on crosshair.
 /// </summary>
 /// <returns>
 /// If current active target not null, returns the target <see cref="GameObject"/>.<br/>Otherwise, returns <c>null</c>.
 /// </returns>
 public GameObject GetActiveTarget(SeaMoth seamoth)
 {
     return(seamoth.GetComponent <SeamothArmManager>().GetActiveTarget());
 }
예제 #19
0
 /// <summary>
 /// This method examines whether there is enough space for the <see cref="Pickupable"/> item in the <see cref="SeaMoth"/> storage modules.
 /// </summary>
 /// <returns>
 /// <c>true</c> if any of <see cref="SeaMoth"/> storage module have an enough space for the <see cref="Pickupable"/> item.<br/>Otherwise, returns <c>false</c>.
 /// </returns>
 public bool HasRoomForItem(SeaMoth seamoth, Pickupable pickupable)
 {
     return(seamoth.GetComponent <SeamothArmManager>().HasRoomForItem(pickupable));
 }
예제 #20
0
 /// <summary>
 /// This method is examine if any of the <see cref="SeaMoth"/> storage module that can fits the <see cref="Pickupable"/> item.
 /// </summary>
 /// <returns>
 /// an <see cref="ItemsContainer"/> if any of <see cref="SeaMoth"/> storage module have an enough space for the <see cref="Pickupable"/> item.<br/>Otherwise, returns <c>null</c>.
 /// </returns>
 public ItemsContainer GetRoomForItem(SeaMoth seamoth, Pickupable pickupable)
 {
     return(seamoth.GetComponent <SeamothArmManager>().GetRoomForItem(pickupable));
 }
        public void ManagedUpdate()
        {
            if (timeLastDrilled + 0.5f > Time.time)
            {
                drillable.modelRoot.transform.position = transform.position + new Vector3(Mathf.Sin(Time.time * 60f), Mathf.Cos(Time.time * 58f + 0.5f), Mathf.Cos(Time.time * 64f + 2f)) * 0.011f;
            }
            if (lootPinataObjects.Count > 0 && drillingMoth)
            {
                List <GameObject> list = new List <GameObject>();

                foreach (GameObject gameObject in lootPinataObjects)
                {
                    if (gameObject == null)
                    {
                        list.Add(gameObject);
                    }
                    else
                    {
                        Vector3 b = drillingMoth.transform.position + new Vector3(0f, 0.8f, 0f);

                        gameObject.transform.position = Vector3.Lerp(gameObject.transform.position, b, Time.deltaTime * 5f);

                        float num = Vector3.Distance(gameObject.transform.position, b);

                        if (num < 3f)
                        {
                            Pickupable pickupable = gameObject.GetComponentInChildren <Pickupable>();

                            if (pickupable)
                            {
                                SeamothArmManager control = drillingMoth.GetComponent <SeamothArmManager>();

                                if (!control.HasRoomForItem(pickupable))
                                {
                                    if (Player.main.GetVehicle() == drillingMoth)
                                    {
                                        ErrorMessage.AddMessage(Language.main.Get("ContainerCantFit"));
                                    }
                                }
                                else
                                {
                                    string arg = Language.main.Get(pickupable.GetTechName());
                                    ErrorMessage.AddMessage(Language.main.GetFormat("VehicleAddedToStorage", arg));
                                    uGUI_IconNotifier.main.Play(pickupable.GetTechType(), uGUI_IconNotifier.AnimationType.From, null);
                                    pickupable = pickupable.Initialize();
                                    InventoryItem item = new InventoryItem(pickupable);
                                    control.GetRoomForItem(pickupable).UnsafeAdd(item);
                                    pickupable.PlayPickupSound();
                                }
                                list.Add(gameObject);
                            }
                        }
                    }
                }

                if (list.Count > 0)
                {
                    foreach (GameObject item2 in list)
                    {
                        lootPinataObjects.Remove(item2);
                    }
                }
            }
        }
        private void UpdateArmRenderers()
        {
            GetArmModels();

            SubName subName = seamoth.GetComponent <SubName>();

            List <Renderer> armRenderers = new List <Renderer>();

            foreach (GameObject geo in GeoCache)
            {
                Renderer[] renderers = geo.GetComponents <Renderer>();

                for (int i = 0; i < renderers.Length; i++)
                {
                    armRenderers.Add(renderers[i]);
                }
            }

            int armMaterials = 0;

            for (int i = 0; i < armRenderers.Count; i++)
            {
                armMaterials += armRenderers[i].materials.Length;
            }

            for (int i = 0; i < subName.rendererInfo.Length; i++)
            {
                SubName.ColorData colorData = subName.rendererInfo[i];

                switch (i)
                {
                case 0:
                case 3:
                case 4:

                    int arraySize = colorData.renderers.Length;

                    Array.Resize(ref colorData.renderers, arraySize + armMaterials);

                    int m = arraySize;

                    for (int j = 0; j < armRenderers.Count; j++)
                    {
                        for (int k = 0; k < armRenderers[j].materials.Length; k++)
                        {
                            colorData.renderers[m]                 = default(SubName.RenderData);
                            colorData.renderers[m].renderer        = armRenderers[j];
                            colorData.renderers[m].materialIndex   = k;
                            colorData.renderers[m].colorProperties = new SubName.PropertyData[]
                            {
                                new SubName.PropertyData(false, colorParams[i]),
                                new SubName.PropertyData(true, specParams[i])
                            };

                            m++;
                        }
                    }

                    break;

                default:
                    continue;
                }
            }

            Vector3[] hsbArray = new Vector3[subName.rendererInfo.Length];

            for (int i = 0; i < subName.rendererInfo.Length; i++)
            {
                hsbArray[i] = subName.rendererInfo[i].HSB;
            }

            subName.DeserializeColors(hsbArray);
        }
예제 #23
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)