diff --git a/Patches.cs b/Patches.cs index 6582c7c..8b4d2d9 100644 --- a/Patches.cs +++ b/Patches.cs @@ -1,4 +1,5 @@ using Aki.Reflection.Patching; +using Comfort.Common; using EFT; using System.Reflection; @@ -8,15 +9,13 @@ namespace ValensHasThePower { protected override MethodBase GetTargetMethod() { - var result = typeof(GameWorld).GetMethod("OnGameStarted", BindingFlags.Public | BindingFlags.Instance); - - return result; + return typeof(GameWorld).GetMethod("OnGameStarted", BindingFlags.Public | BindingFlags.Instance); } [PatchPostfix] private static void PatchPostFix() { - PowerOn.Start(); + Singleton.Instance.gameObject.AddComponent(); } } } \ No newline at end of file diff --git a/PowerOn.cs b/PowerOn.cs index 6e549a2..4563d7e 100644 --- a/PowerOn.cs +++ b/PowerOn.cs @@ -1,16 +1,13 @@ using BepInEx; using BepInEx.Configuration; using EFT.Interactive; -using System; using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Reflection; using UnityEngine; namespace ValensHasThePower { - [BepInPlugin("com.Valens.HasThePower", "ValensHasThePower", "1.2.1")] + [BepInPlugin("com.Valens.HasThePower", "ValensHasThePower", "1.3.0")] public class Plugin : BaseUnityPlugin { public static ConfigEntry configCustoms; @@ -28,13 +25,13 @@ namespace ValensHasThePower configCustoms = Config.Bind("General.Maps", "Customs", 100, - "Percentage Chance that Power will be On at Raid Start for the Customs Map." + + "Percentage Chance that Power will be On at Raid Start for the Customs Map." + "Default is 100."); configInterchange = Config.Bind("General.Maps", "Interchange", 100, - "Percentage Chance that Power will be On at Raid Start for the Interchange Map." + + "Percentage Chance that Power will be On at Raid Start for the Interchange Map." + "Default is 100."); configReserve = Config.Bind("General.Maps", @@ -48,11 +45,11 @@ namespace ValensHasThePower } } - public static class PowerOn + public class PowerOn : MonoBehaviour { - public static void Start() + public void Start() { - List PowerSwitches = UnityEngine.Object.FindObjectsOfType().ToList(); + List PowerSwitches = FindObjectsOfType().ToList(); foreach (var switcher in PowerSwitches) { @@ -67,7 +64,7 @@ namespace ValensHasThePower } } - // Interchange Power Station + // Interchange Power Station if (switcher.Id == "Shopping_Mall_DesignStuff_00055" && switcher.name == "reserve_electric_switcher_lever") { int percent = RandomGen(); @@ -99,8 +96,7 @@ namespace ValensHasThePower } private static void PowerSwitch(Switch switcher) { - switcher.GetType().GetMethod("Open", BindingFlags.NonPublic | BindingFlags.Instance) - .Invoke(switcher, new object[0]); + switcher.Open(); } } } \ No newline at end of file diff --git a/ValensHasThePower.csproj b/ValensHasThePower.csproj index 0ee4f9a..52cd4c3 100644 --- a/ValensHasThePower.csproj +++ b/ValensHasThePower.csproj @@ -26,6 +26,9 @@ shared\UnityEngine.CoreModule.dll + + shared\Comfort.dll + diff --git a/shared/Aki.Common.dll b/shared/Aki.Common.dll index 5de967d..cc447b2 100644 Binary files a/shared/Aki.Common.dll and b/shared/Aki.Common.dll differ diff --git a/shared/Aki.Reflection.dll b/shared/Aki.Reflection.dll index 5b93eeb..6a698bf 100644 Binary files a/shared/Aki.Reflection.dll and b/shared/Aki.Reflection.dll differ diff --git a/shared/Assembly-CSharp.dll b/shared/Assembly-CSharp.dll index aa2d4dc..7e9b21d 100644 Binary files a/shared/Assembly-CSharp.dll and b/shared/Assembly-CSharp.dll differ diff --git a/shared/BepInEx.dll b/shared/BepInEx.dll index 8aedff0..826b479 100644 Binary files a/shared/BepInEx.dll and b/shared/BepInEx.dll differ diff --git a/shared/Comfort.dll b/shared/Comfort.dll index 51bee17..b23513f 100644 Binary files a/shared/Comfort.dll and b/shared/Comfort.dll differ diff --git a/shared/ConfigurationManager.dll b/shared/ConfigurationManager.dll index d997bda..0081f78 100644 Binary files a/shared/ConfigurationManager.dll and b/shared/ConfigurationManager.dll differ diff --git a/shared/ConfigurationManager.xml b/shared/ConfigurationManager.xml index a18f80d..7530006 100644 --- a/shared/ConfigurationManager.xml +++ b/shared/ConfigurationManager.xml @@ -4,24 +4,19 @@ ConfigurationManager - - - Used by bepinex 4 plugins - - - Bepinex 5 config + Get entries for all core BepInEx settings - Used by bepinex 5 plugins + Get entries for all settings of a plugin - + - Return items with browsable attribute same as expectedBrowsable, and optionally items with no browsable attribute + Search for all instances of BaseUnityPlugin loaded by chainloader or other means. @@ -64,17 +59,16 @@ Do not use any Begin / End layout methods, and avoid raising height from standard. + + + Rebuild the setting list. Use to update the config manager window if config settings were removed or added while it was open. + + String currently entered into the search box - - - Instance of the object that holds this setting. - Null if setting is not in a ConfigWrapper. - - Class representing all data about a setting collected by ConfigurationManager. @@ -97,9 +91,23 @@ - Custom setting draw action + Custom setting draw action. + Use either CustomDrawer or CustomHotkeyDrawer, using both at the same time leads to undefined behaviour. + + + Custom setting draw action that allows polling keyboard input with the Input class. + Use either CustomDrawer or CustomHotkeyDrawer, using both at the same time leads to undefined behaviour. + + + + + Custom setting draw action that allows polling keyboard input with the Input class. + + Setting currently being set, is available + Set this ref parameter to true when you want the current setting drawer to receive Input events. Remember to set it to false after you are done! + Show this setting in the settings screen at all? If false, don't show. @@ -204,95 +212,5 @@ Newly assigned value - - - Specify the list of acceptable values for this variable. It will allow the configuration window to show a list of available values. - - - - - Specify the list of acceptable values for this variable. It will allow the configuration window to show a list of available values. - - List of acceptable values for this setting - - - - Specify a method that returns the list of acceptable values for this variable. It will allow the configuration window to show a list of available values. - - Name of an instance method that takes no arguments and returns array object[] that contains the acceptable values - - - - Specify the range of acceptable values for this variable. It will allow the configuration window to show a slider - and filter inputs. - - - - Lowest acceptable value - Highest acceptable value - - Show the current value as % between min and max values if possible. Otherwise show the - value itself. - - - - - Register a custom field editor drawer that will replace config manager's default field editors - (The part between setting name and the default button). - - Name of the method that will draw the edit field. - The method needs to be an instance method with signature void Name (). Runs in OnGUI. - - - - A keyboard shortcut that can be used in Update method to check if user presses a key combo. - Use SavedKeyboardShortcut to allow user to change this shortcut and have the changes saved. - How to use: Use IsDown instead of the Imput.GetKeyDown in the Update loop. - - - - - Create a new keyboard shortcut. - - Main key to press - Keys that should be held down before main key is registered - - - - Check if the main key was just pressed (Input.GetKeyDown), and specified modifier keys are all pressed - - - - - Check if the main key is currently held down (Input.GetKey), and specified modifier keys are all pressed - - - - - Check if the main key was just lifted (Input.GetKeyUp), and specified modifier keys are all pressed. - - - - - A keyboard shortcut that is saved in the config file and can be changed by the user if ConfigurationManager plugin - is present. - How to use: Run IsPressed in Update to check if user presses the button combo. - - - - - Check if the main key is currently held down (Input.GetKey), and specified modifier keys are all pressed - - - - - Check if the main key was just pressed (Input.GetKeyDown), and specified modifier keys are all pressed - - - - - Check if the main key was just lifted (Input.GetKeyUp), and specified modifier keys are all pressed. - - diff --git a/shared/UnityEngine.CoreModule.dll b/shared/UnityEngine.CoreModule.dll index 7d585db..d8a5448 100644 Binary files a/shared/UnityEngine.CoreModule.dll and b/shared/UnityEngine.CoreModule.dll differ