Ejemplo n.º 1
0
        private void Start()
        {
            //get player instance
            PlayerMain = Player.main;
            PdaMain    = PlayerMain.GetPDA();
            //forced triggering the Awake method in uGUI_Equipment for patching
            PdaMain.Open();
            PdaMain.Close();
            //add and start a handler to check the player mode if changed
            PlayerMain.playerModeChanged.AddHandler(gameObject, new Event <Player.Mode> .HandleFunction(OnPlayerModeChanged));

            string vehicleName = string.Empty;

            if (ThisVehicle)
            {
                isActive    = (PlayerMain.GetVehicle() == ThisVehicle);
                vehicleName = ThisVehicle.vehicleName;
            }
            else if (helper.isReady)
            {
                isActive    = (PlayerMain.GetComponentInParent <SeaTruckUpgrades>() == helper.TruckUpgrades);
                vehicleName = helper.TruckName;
            }

            BZLogger.Log($"Broadcasting message: 'WakeUp', Name: {vehicleName}, Instance ID: {gameObject.GetInstanceID()}");
            gameObject.BroadcastMessage("WakeUp");
        }
Ejemplo n.º 2
0
        public static void Postfix(Exosuit __instance)
        {
            if (!((Vehicle)__instance).GetPilotingMode())
            {
                return;
            }
            PDA pda = PDA_Awake_Patch.Pda;

            using (List <GameInput.Button> .Enumerator enumerator = QPatch.UpgradeButtons.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    if (GameInput.GetButtonDown(enumerator.Current))
                    {
                        if (Object.Equals((Object)pda, (Object)null) && pda.Open())
                        {
                            pda.Close();
                            return;
                        }
                        ((VehicleUpgradeConsoleInput)((Vehicle)__instance).upgradesInput).OpenFromExternal();
                        return;
                    }
                }
            }
            using (List <GameInput.Button> .Enumerator enumerator = QPatch.StorageButtons.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    if (GameInput.GetButtonDown(enumerator.Current))
                    {
                        if (Object.Equals((Object)pda, (Object)null) && pda.Open())
                        {
                            pda.Close();
                            break;
                        }
                        ((StorageContainer)__instance.storageContainer).Open();
                        break;
                    }
                }
            }
        }
 internal void Start()
 {
     //get player instance
     PlayerMain = Player.main;
     PdaMain    = PlayerMain.GetPDA();
     //forced triggering the Awake method in uGUI_Equipment for patching
     PdaMain.Open();
     PdaMain.Close();
     //add and start a handler to check the player mode if changed
     PlayerMain.playerModeChanged.AddHandler(gameObject, new Event <Player.Mode> .HandleFunction(OnPlayerModeChanged));
     isActive = PlayerMain.GetVehicle() == ThisVehicle ? true : false;
 }
Ejemplo n.º 4
0
        internal void Start()
        {
            PdaMain = Player.main.GetPDA();
            //forced triggering the Awake method in uGUI_Equipment for patching
            PdaMain.Open();
            PdaMain.Close();

            //add and start a handler to check the player mode if changed
            Player.main.playerModeChanged.AddHandler(this, new Event <Player.Mode> .HandleFunction(OnPlayerModeChanged));

            isActive = Player.main.currentMountedVehicle == ThisVehicle ? true : false;

            SNLogger.Log($"[SlotExtender] Broadcasting message: 'WakeUp', Vehicle Name: {ThisVehicle.GetName()}, Instance ID: {ThisVehicle.GetInstanceID()}");

            gameObject.BroadcastMessage("WakeUp", SendMessageOptions.DontRequireReceiver);
        }
        internal static void RefreshPDA()
        {
            if (_pdaRefreshed || Player.main == null || !LargeWorldStreamer.main.IsReady())
            {
                return;
            }

            PDA pdaMain = Player.main?.GetPDA();

            if (pdaMain == null)
            {
                QuickLogger.Error("Player GetPDA was null when trying to refresh PDA");
                return;
            }

            pdaMain.Open(PDATab.None, null, null, -1f);
            pdaMain.Close();
            QuickLogger.Debug("Deep Driller refreshed PDA.");
            _pdaRefreshed = true;
        }
 internal void Update()
 {
     if (!isActive)
     {
         return; // SlotExtenderZero not active. Exit method.
     }
     if (Main.isConsoleActive)
     {
         return; // Input console active. Exit method.
     }
     if (!PlayerMain.inSeamoth && !PlayerMain.inExosuit)
     {
         return; // Player not in any vehicle. Exit method.
     }
     if (Input.GetKeyDown(Config.KEYBINDINGS["Upgrade"]))
     {
         if (PdaMain.isOpen)
         {
             PdaMain.Close();
             return;
         }
         else // Is Closed
         {
             ThisVehicle.upgradesInput.OpenFromExternal();
             return;
         }
     }
     else if (Input.GetKeyDown(Config.KEYBINDINGS["Storage"]))
     {
         if (ThisVehicle.GetType() != typeof(Exosuit))
         {
             return;
         }
         if (PdaMain.isOpen)
         {
             PdaMain.Close();
             return;
         }
         else
         {
             ThisVehicle.GetComponent <Exosuit>().storageContainer.Open();
             return;
         }
     }
     else if (GameInput.GetButtonDown(GameInput.Button.Slot1))
     {
         if (ThisVehicle.GetType() != typeof(SeaMoth))
         {
             return;
         }
         if (ThisVehicle.GetSlotBinding(0) != TechType.VehicleStorageModule)
         {
             return;
         }
         if (PdaMain.isOpen)
         {
             PdaMain.Close();
             return;
         }
         else
         {
             ThisVehicle.GetComponent <SeaMoth>().storageInputs[0].OpenFromExternal();
             return;
         }
     }
     else if (GameInput.GetButtonDown(GameInput.Button.Slot2))
     {
         if (ThisVehicle.GetType() != typeof(SeaMoth))
         {
             return;
         }
         if (ThisVehicle.GetSlotBinding(1) != TechType.VehicleStorageModule)
         {
             return;
         }
         if (PdaMain.isOpen)
         {
             PdaMain.Close();
             return;
         }
         else
         {
             ThisVehicle.GetComponent <SeaMoth>().storageInputs[1].OpenFromExternal();
             return;
         }
     }
     else if (GameInput.GetButtonDown(GameInput.Button.Slot3))
     {
         if (ThisVehicle.GetType() != typeof(SeaMoth))
         {
             return;
         }
         if (ThisVehicle.GetSlotBinding(2) != TechType.VehicleStorageModule)
         {
             return;
         }
         if (PdaMain.isOpen)
         {
             PdaMain.Close();
             return;
         }
         else
         {
             ThisVehicle.GetComponent <SeaMoth>().storageInputs[2].OpenFromExternal();
             return;
         }
     }
     else if (GameInput.GetButtonDown(GameInput.Button.Slot4))
     {
         if (ThisVehicle.GetType() != typeof(SeaMoth))
         {
             return;
         }
         if (ThisVehicle.GetSlotBinding(3) != TechType.VehicleStorageModule)
         {
             return;
         }
         if (PdaMain.isOpen)
         {
             PdaMain.Close();
             return;
         }
         else
         {
             ThisVehicle.GetComponent <SeaMoth>().storageInputs[3].OpenFromExternal();
             return;
         }
     }
     else if (Input.GetKeyDown(Config.KEYBINDINGS["Slot_6"]))
     {
         ThisVehicle.SendMessage("SlotKeyDown", 5);
         return;
     }
     else if (Input.GetKeyDown(Config.KEYBINDINGS["Slot_7"]))
     {
         ThisVehicle.SendMessage("SlotKeyDown", 6);
         return;
     }
     else if (Input.GetKeyDown(Config.KEYBINDINGS["Slot_8"]))
     {
         ThisVehicle.SendMessage("SlotKeyDown", 7);
         return;
     }
     else if (Input.GetKeyDown(Config.KEYBINDINGS["Slot_9"]))
     {
         ThisVehicle.SendMessage("SlotKeyDown", 8);
         return;
     }
     else if (Input.GetKeyDown(Config.KEYBINDINGS["Slot_10"]))
     {
         ThisVehicle.SendMessage("SlotKeyDown", 9);
         return;
     }
     else if (Input.GetKeyDown(Config.KEYBINDINGS["Slot_11"]))
     {
         ThisVehicle.SendMessage("SlotKeyDown", 10);
         return;
     }
     else if (Input.GetKeyDown(Config.KEYBINDINGS["Slot_12"]))
     {
         ThisVehicle.SendMessage("SlotKeyDown", 11);
         return;
     }
 }
Ejemplo n.º 7
0
        private void Update()
        {
            if (!isActive)
            {
                return; // SlotExtenderZero not active. Exit method.
            }
            if (Main.isConsoleActive)
            {
                return; // Input console active. Exit method.
            }
            if (!PlayerMain.inExosuit && !PlayerMain.IsPilotingSeatruck())
            {
                return; // Player not in any vehicle. Exit method.
            }
            if (Input.GetKeyDown(SEzConfig.KEYBINDINGS["Upgrade"]))
            {
                if (PdaMain.isOpen)
                {
                    PdaMain.Close();
                    return;
                }
                else // Is Closed
                {
                    if (ThisVehicle)
                    {
                        ThisVehicle.upgradesInput.OpenFromExternal();
                    }
                    else if (helper.isReady)
                    {
                        helper.TruckUpgrades.upgradesInput.OpenFromExternal();
                    }

                    return;
                }
            }
            else if (Input.GetKeyDown(SEzConfig.KEYBINDINGS["Storage"]))
            {
                if (!ThisVehicle)
                {
                    return;
                }
                if (ThisVehicle.GetType() != typeof(Exosuit))
                {
                    return;
                }
                if (PdaMain.isOpen)
                {
                    PdaMain.Close();
                    return;
                }

                StorageContainer storageContainer = ThisVehicle.GetComponent <Exosuit>().storageContainer;
                storageContainer.Open(storageContainer.gameObject.transform);
                return;
            }
            else if (GameInput.GetButtonDown(GameInput.Button.Slot1))
            {
                TryUseSlotItem(0);
                return;
            }
            else if (GameInput.GetButtonDown(GameInput.Button.Slot2))
            {
                TryUseSlotItem(1);
                return;
            }
            else if (GameInput.GetButtonDown(GameInput.Button.Slot3))
            {
                TryUseSlotItem(2);
                return;
            }
            else if (GameInput.GetButtonDown(GameInput.Button.Slot4))
            {
                TryUseSlotItem(3);
                return;
            }
            else if (GameInput.GetButtonDown(GameInput.Button.Slot5))
            {
                TryUseSlotItem(4);
                return;
            }
            else if (Input.GetKeyDown(SEzConfig.KEYBINDINGS["Slot_6"]))
            {
                TryUseSlotItem(5);
                return;
            }
            else if (Input.GetKeyDown(SEzConfig.KEYBINDINGS["Slot_7"]))
            {
                TryUseSlotItem(6);
                return;
            }
            else if (Input.GetKeyDown(SEzConfig.KEYBINDINGS["Slot_8"]))
            {
                TryUseSlotItem(7);
                return;
            }
            else if (Input.GetKeyDown(SEzConfig.KEYBINDINGS["Slot_9"]))
            {
                TryUseSlotItem(8);
                return;
            }
            else if (Input.GetKeyDown(SEzConfig.KEYBINDINGS["Slot_10"]))
            {
                TryUseSlotItem(9);
                return;
            }
            else if (Input.GetKeyDown(SEzConfig.KEYBINDINGS["Slot_11"]))
            {
                TryUseSlotItem(10);
                return;
            }
            else if (Input.GetKeyDown(SEzConfig.KEYBINDINGS["Slot_12"]))
            {
                TryUseSlotItem(11);
                return;
            }
            else if (Input.GetKeyDown(SEzConfig.KEYBINDINGS[SlotHelper.slotStringCache[SlotName.SeaTruckArmLeft]]))
            {
                TryUseSeatruckArm(SlotHelper.slotStringCache[SlotName.SeaTruckArmLeft]);
                return;
            }
            else if (Input.GetKeyDown(SEzConfig.KEYBINDINGS[SlotHelper.slotStringCache[SlotName.SeaTruckArmRight]]))
            {
                TryUseSeatruckArm(SlotHelper.slotStringCache[SlotName.SeaTruckArmRight]);
                return;
            }
        }
Ejemplo n.º 8
0
 internal void Update()
 {
     if (!isActive)
     {
         return; // Slot Extender not active. Exit method.
     }
     if (Main.isConsoleActive)
     {
         return; // Input console active. Exit method.
     }
     if (Main.isKeyBindigsUpdate)
     {
         return; // Keybindings changed and updating in progress. Exit method.
     }
     // Safety check
     if (!IsPlayerInVehicle())
     {
         return; // Player not in any vehicle. Exit method.
     }
     if (Input.GetKeyDown(SEConfig.KEYBINDINGS["Upgrade"]))
     {
         if (PdaMain.isOpen)
         {
             PdaMain.Close();
             return;
         }
         else // Is Closed
         {
             ThisVehicle.upgradesInput.OpenFromExternal();
             return;
         }
     }
     else if (Input.GetKeyDown(SEConfig.KEYBINDINGS["Storage"]))
     {
         if (ThisVehicle.GetType() != typeof(Exosuit))
         {
             return;
         }
         if (PdaMain.isOpen)
         {
             PdaMain.Close();
             return;
         }
         else
         {
             ThisVehicle.GetComponent <Exosuit>().storageContainer.Open();
             return;
         }
     }
     else if (GameInput.GetButtonDown(GameInput.Button.Slot1))
     {
         TryUseSlotItem(0);
         return;
     }
     else if (GameInput.GetButtonDown(GameInput.Button.Slot2))
     {
         TryUseSlotItem(1);
         return;
     }
     else if (GameInput.GetButtonDown(GameInput.Button.Slot3))
     {
         TryUseSlotItem(2);
         return;
     }
     else if (GameInput.GetButtonDown(GameInput.Button.Slot4))
     {
         TryUseSlotItem(3);
         return;
     }
     else if (GameInput.GetButtonDown(GameInput.Button.Slot5))
     {
         TryUseSlotItem(4);
         return;
     }
     else if (Input.GetKeyDown(SEConfig.KEYBINDINGS["Slot_6"]))
     {
         TryUseSlotItem(5);
         return;
     }
     else if (Input.GetKeyDown(SEConfig.KEYBINDINGS["Slot_7"]))
     {
         TryUseSlotItem(6);
         return;
     }
     else if (Input.GetKeyDown(SEConfig.KEYBINDINGS["Slot_8"]))
     {
         TryUseSlotItem(7);
         return;
     }
     else if (Input.GetKeyDown(SEConfig.KEYBINDINGS["Slot_9"]))
     {
         TryUseSlotItem(8);
         return;
     }
     else if (Input.GetKeyDown(SEConfig.KEYBINDINGS["Slot_10"]))
     {
         TryUseSlotItem(9);
         return;
     }
     else if (Input.GetKeyDown(SEConfig.KEYBINDINGS["Slot_11"]))
     {
         TryUseSlotItem(10);
         return;
     }
     else if (Input.GetKeyDown(SEConfig.KEYBINDINGS["Slot_12"]))
     {
         TryUseSlotItem(11);
         return;
     }
     else if (Input.GetKeyDown(SEConfig.KEYBINDINGS[SlotHelper.slotStringCache[SlotName.SeamothArmLeft]]))
     {
         TryUseSeamothArm(SlotHelper.slotStringCache[SlotName.SeamothArmLeft]);
         return;
     }
     else if (Input.GetKeyDown(SEConfig.KEYBINDINGS[SlotHelper.slotStringCache[SlotName.SeamothArmRight]]))
     {
         TryUseSeamothArm(SlotHelper.slotStringCache[SlotName.SeamothArmRight]);
         return;
     }
 }