public Options(string name) : base(name) { try { SliderChanged += OnSliderChanged; } catch (Exception e) { Logger.Exception(e, LoggedWhen.Options); } }
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); } }
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); } }
public Options(string name) : base(name) { try { ToggleChanged += OnToggleChanged; ChoiceChanged += OnChoiceChanged; } catch (Exception e) { Logger.Exception(e, LoggedWhen.Options); } }
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); } }
public void UpdateNumbers() { try { Drillable drillable = gameObject.GetComponent <Drillable>(); drillable.minResourcesToSpawn = Min; drillable.maxResourcesToSpawn = Max; } catch (Exception e) { Logger.Exception(e); } }
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); } }
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); } }
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); } }
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); } }
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; } }
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); } }
public static void Patch() { try { 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"); } catch (Exception e) { Logger.Exception(e, LoggedWhen.Initializing); } }
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); } }
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); } }
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); } }
public static void Patch() { try { 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"); } catch (Exception e) { Logger.Exception(e, LoggedWhen.Initializing); } }
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); } }
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); } }