示例#1
0
 public static bool Prefix(ItemsContainer __instance, bool __result, Pickupable pickupable, bool verbose)
 {
     try
     {
         if (!PFC_Config.Enable)
         {
             return(true);
         }
         if (__instance != Inventory.main.container)
         {
             return(true);
         }
         if (pickupable == InventoryOpener.LastOpened?.item)
         {
             __result = false;
             return(false);
         }
         return(true);
     }
     catch (Exception e)
     {
         Logger.Exception(e, LoggedWhen.InPatch, QMod.assembly);
         return(false);
     }
 }
示例#2
0
        public void OnSliderChanged(object sender, SliderChangedEventArgs e)
        {
            try
            {
                int val = (int)Math.Round(e.Value, 0);

                if (e.Id == "cdcMin")
                {
                    Logger.Log($"Minimum value updated from {CDC_Config.Min} to {val}", QMod.assembly);
                    CDC_Config.Min = val;
                    PlayerPrefs.SetInt("cdcMin", val);
                    PlayerPrefs.Save();
                }
                else if (e.Id == "cdcMax")
                {
                    Logger.Log($"Maximum value updated from {CDC_Config.Max} to {val}", QMod.assembly);
                    CDC_Config.Max = val;
                    PlayerPrefs.SetInt("cdcMax", val);
                    PlayerPrefs.Save();
                }

                UnityEngine.Object.FindObjectsOfType <CDC_Config>().Do(cdc => cdc.UpdateNumbers());
                Logger.Log("Updated Drillable components for all objects", QMod.assembly);
            }
            catch (Exception ex)
            {
                Logger.Exception(ex, LoggedWhen.Options);
            }
        }
示例#3
0
        public static void Patch()
        {
            try
            {
                HarmonyHelper.Patch();

                Logger.Log("Patched successfully!");

                PFC_Config.Enable = PlayerPrefsExtra.GetBool("pfcEnable", true);

                Logger.Log("Obtained values from config");

                OptionsPanelHandler.RegisterModOptions(new Options("Pickup Full Carry-alls"));

                Logger.Log("Registered mod options");

                ItemActionHelper.RegisterAction(MouseButton.Middle, TechType.LuggageBag, InventoryOpener.OnMiddleClick, "open storage", InventoryOpener.Condition);
                ItemActionHelper.RegisterAction(MouseButton.Middle, TechType.SmallStorage, InventoryOpener.OnMiddleClick, "open storage", InventoryOpener.Condition);

                /*
                 * ItemActionHandler.RegisterMiddleClickAction(TechType.LuggageBag, InventoryOpener.OnMiddleClick, "open storage");
                 * ItemActionHandler.RegisterMiddleClickAction(TechType.SmallStorage, InventoryOpener.OnMiddleClick, "open storage");
                 *
                 * Logger.Log("Registered middle click actions");
                 */
            }
            catch (Exception e)
            {
                Logger.Exception(e, LoggedWhen.Initializing);
            }
        }
示例#4
0
        public static void Patch()
        {
            HarmonyHelper.Patch();
            new HorizontalWallLocker().Patch();

            Logger.Log("Patched");
        }
示例#5
0
 public void OnChoiceChanged(object sender, ChoiceChangedEventArgs e)
 {
     if (e.Id == "pfcMMB")
     {
         Logger.Log($"Set storage opening in inventory to: \"{e.Value}\"");
         PFC_Config.AllowMMB = e.Value;
     }
 }
示例#6
0
        public static void Patch()
        {
            HarmonyHelper.Patch();
            Logger.Log("Patched successfully!");

            IBA_Config.Enable = PlayerPrefsExtra.GetBool("ibaEnable", true);
            Logger.Log("Obtained values from config");

            OptionsPanelHandler.RegisterModOptions(new Options("Instant Bulkhead Animations"));
            Logger.Log("Registered mod options");
        }
示例#7
0
 public Options(string name) : base(name)
 {
     try
     {
         ToggleChanged += OnToggleChanged;
     }
     catch (Exception e)
     {
         Logger.Exception(e, LoggedWhen.Options);
     }
 }
示例#8
0
 public override void BuildModOptions()
 {
     try
     {
         AddToggleOption("ibaEnable", "Enable", IBA_Config.Enable);
     }
     catch (Exception e)
     {
         Logger.Exception(e, LoggedWhen.Options);
     }
 }
示例#9
0
 public override void BuildModOptions()
 {
     try
     {
         AddSliderOption("cdcMin", "Minimum", 0, 10, CDC_Config.Min);
         AddSliderOption("cdcMax", "Maximum", 0, 10, CDC_Config.Max);
     }
     catch (Exception e)
     {
         Logger.Exception(e, LoggedWhen.Options);
     }
 }
示例#10
0
 public override void BuildModOptions()
 {
     try
     {
         AddToggleOption("pfcEnable", "Enable", PFC_Config.Enable);
         AddChoiceOption("pfcMMB", "Open storage in inventory", PFC_Config.AllowMMBOptions, PFC_Config.AllowMMB);
     }
     catch (Exception e)
     {
         Logger.Exception(e, LoggedWhen.Options);
     }
 }
示例#11
0
 public static void Postfix(Drillable __instance)
 {
     try
     {
         CDC_Config cdc = __instance.gameObject.AddComponent <CDC_Config>();
         Logger.Log("Added component to Drillable!", QMod.assembly);
     }
     catch (Exception e)
     {
         Logger.Exception(e, LoggedWhen.InPatch, QMod.assembly);
     }
 }
示例#12
0
 public static uGUI_ItemIcon GetIconForItem(InventoryItem item)
 {
     try
     {
         Dictionary <InventoryItem, uGUI_ItemIcon> items = typeof(uGUI_ItemsContainer).GetField("items", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(InventoryUGUI) as Dictionary <InventoryItem, uGUI_ItemIcon>;
         return(items[item]);
     }
     catch (Exception e)
     {
         Logger.Exception(e, LoggedWhen.InPatch, QMod.assembly);
         return(null);
     }
 }
示例#13
0
 public void UpdateNumbers()
 {
     try
     {
         Drillable drillable = gameObject.GetComponent <Drillable>();
         drillable.minResourcesToSpawn = Min;
         drillable.maxResourcesToSpawn = Max;
     }
     catch (Exception e)
     {
         Logger.Exception(e);
     }
 }
示例#14
0
 public static void Postfix(uGUI_ItemsContainer __instance, ItemsContainer container)
 {
     try
     {
         if (container == Inventory.main.container)
         {
             InventoryOpener.InventoryUGUI = __instance;
         }
     }
     catch (Exception e)
     {
         Logger.Exception(e, LoggedWhen.InPatch, QMod.assembly);
     }
 }
示例#15
0
        public static void Patch()
        {
            HarmonyHelper.Patch();
            Logger.Log("Patched successfully!");

            PFC_Config.Enable = PlayerPrefsExtra.GetBool("pfcEnable", true);
            Logger.Log("Obtained values from config");

            OptionsPanelHandler.RegisterModOptions(new Options("Pickup Full Carry-alls"));
            Logger.Log("Registered mod options");

            ItemActionHandler.RegisterMiddleClickAction(TechType.LuggageBag, InventoryOpener.OnMiddleClick, "open storage", InventoryOpener.Condition);
            ItemActionHandler.RegisterMiddleClickAction(TechType.SmallStorage, InventoryOpener.OnMiddleClick, "open storage", InventoryOpener.Condition);
        }
示例#16
0
 public void OnChoiceChanged(object sender, ChoiceChangedEventArgs e)
 {
     try
     {
         if (e.Id == "pfcMMB")
         {
             Logger.Log($"Set storage opening in inventory to: \"{e.Value}\"");
             PFC_Config.AllowMMB = e.Value;
         }
     }
     catch (Exception ex)
     {
         Logger.Exception(ex, LoggedWhen.Options);
     }
 }
示例#17
0
 public void OnToggleChanged(object sender, ToggleChangedEventArgs e)
 {
     if (e.Id == "pfcEnable")
     {
         if (e.Value)
         {
             Logger.Log("Enabled mod");
         }
         else
         {
             Logger.Log("Disabled mod");
         }
         PFC_Config.Enable = e.Value;
     }
 }
示例#18
0
        public static void Patch()
        {
            HarmonyHelper.Patch();

            Logger.Log($"Patched successfully!");

            CDC_Config.Min = PlayerPrefs.GetInt("cdcMin", 1);
            CDC_Config.Max = PlayerPrefs.GetInt("cdcMax", 3);

            Logger.Log("Obtained min/max values from config");

            OptionsPanelHandler.RegisterModOptions(new Options("Configurable Drillable Count"));

            Logger.Log("Registered mod options");
        }
示例#19
0
 public static bool Prefix(BulkheadDoor __instance, GUIHand hand)
 {
     if (IBA_Config.Enable)
     {
         Vector3 position = Player.main.transform.position;
         __instance.GetInstanceMethod("ToggleImmediately").Invoke(__instance, null);
         Player.main.transform.position = position;
         Logger.Log("Bulkhead animation skipped!");
         return(false);
     }
     else
     {
         return(true);
     }
 }
示例#20
0
            public static bool Prefix(PickupableStorage __instance, GUIHand hand)
            {
                TechType type = __instance.pickupable.GetTechType();

                if (PFC_Config.Enable && type == TechType.LuggageBag || type == TechType.SmallStorage)
                {
                    __instance.pickupable.OnHandClick(hand);
                    Logger.Log("Picked up a carry-all");
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
示例#21
0
            public static void Postfix(GameObject __result, TechType techType)
            {
                try
                {
                    if (techType == TechType.Bleach)
                    {
                        __result.AddComponent <DrinkableBleach>();

                        Logger.Log($"Added components to bleach item!", QMod.assembly);
                    }
                }
                catch (Exception e)
                {
                    Logger.Exception(e, LoggedWhen.InPatch, QMod.assembly);
                }
            }
示例#22
0
 public static void Postfix()
 {
     try
     {
         if (InventoryOpener.LastOpened != null && !InventoryOpener.DontEnable)
         {
             InventoryOpener.LastOpened.isEnabled = true;
             InventoryOpener.GetIconForItem(InventoryOpener.LastOpened)?.SetChroma(1f);
             InventoryOpener.LastOpened = null;
         }
     }
     catch (Exception e)
     {
         Logger.Exception(e, LoggedWhen.InPatch, QMod.assembly);
         return;
     }
 }
示例#23
0
        public static void Patch()
        {
            try
            {
                HarmonyHelper.Patch();

                Logger.Log("Patched successfully!");

                LanguageHandler.SetLanguageLine("Tooltip_Bleach", "NaClO. Sodium hypochlorite bleach. Sanitizing applications.\n(If you cannot drink it, you need to craft a new one)");

                Logger.Log("Updated Bleach tooltip");
            }
            catch (Exception e)
            {
                Logger.Exception(e, LoggedWhen.Initializing);
            }
        }
示例#24
0
 public void OnToggleChanged(object sender, ToggleChangedEventArgs e)
 {
     if (e.Id == "ibaEnable")
     {
         if (e.Value)
         {
             Logger.Log("Enabled mod");
         }
         else
         {
             Logger.Log("Disabled mod");
         }
         IBA_Config.Enable = e.Value;
         PlayerPrefsExtra.SetBool("ibaEnable", e.Value);
         PlayerPrefs.Save();
     }
 }
示例#25
0
 public static bool Prefix(PickupableStorage __instance, GUIHand hand)
 {
     try
     {
         TechType type = __instance.pickupable.GetTechType();
         if (PFC_Config.Enable && type == TechType.LuggageBag || type == TechType.SmallStorage)
         {
             __instance.pickupable.OnHandHover(hand);
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception e)
     {
         Logger.Exception(e, LoggedWhen.InPatch, QMod.assembly);
         return(false);
     }
 }
示例#26
0
 public void OnToggleChanged(object sender, ToggleChangedEventArgs e)
 {
     try
     {
         if (e.Id == "pfcEnable")
         {
             if (e.Value)
             {
                 Logger.Log("Enabled mod", QMod.assembly);
             }
             else
             {
                 Logger.Log("Disabled mod", QMod.assembly);
             }
             PFC_Config.Enable = e.Value;
         }
     }
     catch (Exception ex)
     {
         Logger.Exception(ex, LoggedWhen.Options);
     }
 }
示例#27
0
        public static void OnMiddleClick(InventoryItem item)
        {
            try
            {
                if (!PFC_Config.Enable)
                {
                    ErrorMessage.AddMessage($"[{QMod.assembly}] Mod is disabled!");
                    return;
                }

                Vector2int cursorPosition = GetCursorPosition();

                DontEnable = true;
                Player.main.GetPDA().Close();
                DontEnable = false;

                StorageContainer container = item.item.gameObject.GetComponentInChildren <PickupableStorage>().storageContainer;
                container.Open();
                container.onUse.Invoke();

                if (PlayerInventoryContains(item))
                {
                    if (LastOpened != null)
                    {
                        LastOpened.isEnabled = true;
                        GetIconForItem(LastOpened)?.SetChroma(1f);
                    }
                    item.isEnabled = false;
                    GetIconForItem(item)?.SetChroma(0f);
                    LastOpened = item;
                }

                GameObject.FindObjectOfType <GameInput>().StartCoroutine(ResetCursor(cursorPosition));
            }
            catch (Exception e)
            {
                Logger.Exception(e);
            }
        }
示例#28
0
 public static bool Prefix(BulkheadDoor __instance, GUIHand hand)
 {
     try
     {
         if (IBA_Config.Enable)
         {
             Vector3 position = Player.main.transform.position;
             __instance.GetInstanceMethod("ToggleImmediately").Invoke(__instance, null);
             Player.main.transform.position = position;
             Logger.Log("Bulkhead animation skipped!", QMod.assembly);
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception e)
     {
         Logger.Exception(e, LoggedWhen.InPatch, QMod.assembly);
         return(false);
     }
 }
示例#29
0
 public void OnToggleChanged(object sender, ToggleChangedEventArgs e)
 {
     try
     {
         if (e.Id == "ibaEnable")
         {
             if (e.Value)
             {
                 Logger.Log("Enabled mod", QMod.assembly);
             }
             else
             {
                 Logger.Log("Disabled mod", QMod.assembly);
             }
             IBA_Config.Enable = e.Value;
             PlayerPrefsExtra.SetBool("ibaEnable", e.Value);
             PlayerPrefs.Save();
         }
     }
     catch (Exception ex)
     {
         Logger.Exception(ex, LoggedWhen.Options);
     }
 }
示例#30
0
            public static void Postfix(Drillable __instance)
            {
                CDC_Config cdc = __instance.gameObject.AddComponent <CDC_Config>();

                Logger.Log("Added component to Drillable!");
            }