converted to be a component, updated for 3.8.3

This commit is contained in:
CWX 2024-06-06 08:11:02 +01:00
parent ab2c77417c
commit 01ae57f49a
11 changed files with 38 additions and 122 deletions

View File

@ -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<GameWorld>.Instance.gameObject.AddComponent<PowerOn>();
}
}
}

View File

@ -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<int> configCustoms;
@ -48,11 +45,11 @@ namespace ValensHasThePower
}
}
public static class PowerOn
public class PowerOn : MonoBehaviour
{
public static void Start()
public void Start()
{
List<Switch> PowerSwitches = UnityEngine.Object.FindObjectsOfType<Switch>().ToList();
List<Switch> PowerSwitches = FindObjectsOfType<Switch>().ToList();
foreach (var switcher in PowerSwitches)
{
@ -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();
}
}
}

View File

@ -26,6 +26,9 @@
<Reference Include="UnityEngine.CoreModule">
<HintPath>shared\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="Comfort.Common">
<HintPath>shared\Comfort.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,24 +4,19 @@
<name>ConfigurationManager</name>
</assembly>
<members>
<member name="M:ConfigurationManager.LegacySettingSearcher.GetLegacyPluginConfig(BepInEx.BaseUnityPlugin)">
<summary>
Used by bepinex 4 plugins
</summary>
</member>
<member name="M:ConfigurationManager.SettingSearcher.GetBepInExCoreConfig">
<summary>
Bepinex 5 config
Get entries for all core BepInEx settings
</summary>
</member>
<member name="M:ConfigurationManager.SettingSearcher.GetPluginConfig(BepInEx.BaseUnityPlugin)">
<summary>
Used by bepinex 5 plugins
Get entries for all settings of a plugin
</summary>
</member>
<member name="M:ConfigurationManager.Utilities.Utils.FilterBrowsable``1(System.Collections.Generic.IEnumerable{``0},System.Boolean,System.Boolean)">
<member name="M:ConfigurationManager.Utilities.Utils.FindPlugins">
<summary>
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.
</summary>
</member>
<member name="T:ConfigurationManager.ConfigurationManager">
@ -64,17 +59,16 @@
Do not use any Begin / End layout methods, and avoid raising height from standard.
</summary>
</member>
<member name="M:ConfigurationManager.ConfigurationManager.BuildSettingList">
<summary>
Rebuild the setting list. Use to update the config manager window if config settings were removed or added while it was open.
</summary>
</member>
<member name="P:ConfigurationManager.ConfigurationManager.SearchString">
<summary>
String currently entered into the search box
</summary>
</member>
<member name="P:ConfigurationManager.LegacySettingEntry.Wrapper">
<summary>
Instance of the object that holds this setting.
Null if setting is not in a ConfigWrapper.
</summary>
</member>
<member name="T:ConfigurationManager.SettingEntryBase">
<summary>
Class representing all data about a setting collected by ConfigurationManager.
@ -97,9 +91,23 @@
</member>
<member name="P:ConfigurationManager.SettingEntryBase.CustomDrawer">
<summary>
Custom setting draw action
Custom setting draw action.
Use either CustomDrawer or CustomHotkeyDrawer, using both at the same time leads to undefined behaviour.
</summary>
</member>
<member name="P:ConfigurationManager.SettingEntryBase.CustomHotkeyDrawer">
<summary>
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.
</summary>
</member>
<member name="T:ConfigurationManager.SettingEntryBase.CustomHotkeyDrawerFunc">
<summary>
Custom setting draw action that allows polling keyboard input with the Input class.
</summary>
<param name="setting">Setting currently being set, is available</param>
<param name="isCurrentlyAcceptingInput">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!</param>
</member>
<member name="P:ConfigurationManager.SettingEntryBase.Browsable">
<summary>
Show this setting in the settings screen at all? If false, don't show.
@ -204,95 +212,5 @@
Newly assigned value
</summary>
</member>
<member name="T:BepInEx.AcceptableValueListAttribute">
<summary>
Specify the list of acceptable values for this variable. It will allow the configuration window to show a list of available values.
</summary>
</member>
<member name="M:BepInEx.AcceptableValueListAttribute.#ctor(System.Object[])">
<summary>
Specify the list of acceptable values for this variable. It will allow the configuration window to show a list of available values.
</summary>
<param name="acceptableValues">List of acceptable values for this setting</param>
</member>
<member name="M:BepInEx.AcceptableValueListAttribute.#ctor(System.String)">
<summary>
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.
</summary>
<param name="acceptableValueGetterName">Name of an instance method that takes no arguments and returns array object[] that contains the acceptable values</param>
</member>
<member name="T:BepInEx.AcceptableValueRangeAttribute">
<summary>
Specify the range of acceptable values for this variable. It will allow the configuration window to show a slider
and filter inputs.
</summary>
</member>
<member name="M:BepInEx.AcceptableValueRangeAttribute.#ctor(System.Object,System.Object,System.Boolean)">
<param name="minValue">Lowest acceptable value</param>
<param name="maxValue">Highest acceptable value</param>
<param name="showAsPercentage">
Show the current value as % between min and max values if possible. Otherwise show the
value itself.
</param>
</member>
<member name="M:BepInEx.CustomSettingDrawAttribute.#ctor(System.String)">
<summary>
Register a custom field editor drawer that will replace config manager's default field editors
(The part between setting name and the default button).
</summary>
<param name="customFieldDrawMethod">Name of the method that will draw the edit field.
The method needs to be an instance method with signature <code>void Name ()</code>. Runs in OnGUI.</param>
</member>
<member name="T:BepInEx.KeyboardShortcut">
<summary>
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.
</summary>
</member>
<member name="M:BepInEx.KeyboardShortcut.#ctor(UnityEngine.KeyCode,UnityEngine.KeyCode[])">
<summary>
Create a new keyboard shortcut.
</summary>
<param name="mainKey">Main key to press</param>
<param name="modifiers">Keys that should be held down before main key is registered</param>
</member>
<member name="M:BepInEx.KeyboardShortcut.IsDown">
<summary>
Check if the main key was just pressed (Input.GetKeyDown), and specified modifier keys are all pressed
</summary>
</member>
<member name="M:BepInEx.KeyboardShortcut.IsPressed">
<summary>
Check if the main key is currently held down (Input.GetKey), and specified modifier keys are all pressed
</summary>
</member>
<member name="M:BepInEx.KeyboardShortcut.IsUp">
<summary>
Check if the main key was just lifted (Input.GetKeyUp), and specified modifier keys are all pressed.
</summary>
</member>
<member name="T:BepInEx.SavedKeyboardShortcut">
<summary>
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.
</summary>
</member>
<member name="M:BepInEx.SavedKeyboardShortcut.IsPressed">
<summary>
Check if the main key is currently held down (Input.GetKey), and specified modifier keys are all pressed
</summary>
</member>
<member name="M:BepInEx.SavedKeyboardShortcut.IsDown">
<summary>
Check if the main key was just pressed (Input.GetKeyDown), and specified modifier keys are all pressed
</summary>
</member>
<member name="M:BepInEx.SavedKeyboardShortcut.IsUp">
<summary>
Check if the main key was just lifted (Input.GetKeyUp), and specified modifier keys are all pressed.
</summary>
</member>
</members>
</doc>

Binary file not shown.