converted to be a component, updated for 3.8.3
This commit is contained in:
parent
ab2c77417c
commit
01ae57f49a
@ -1,4 +1,5 @@
|
|||||||
using Aki.Reflection.Patching;
|
using Aki.Reflection.Patching;
|
||||||
|
using Comfort.Common;
|
||||||
using EFT;
|
using EFT;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
@ -8,15 +9,13 @@ namespace ValensHasThePower
|
|||||||
{
|
{
|
||||||
protected override MethodBase GetTargetMethod()
|
protected override MethodBase GetTargetMethod()
|
||||||
{
|
{
|
||||||
var result = typeof(GameWorld).GetMethod("OnGameStarted", BindingFlags.Public | BindingFlags.Instance);
|
return typeof(GameWorld).GetMethod("OnGameStarted", BindingFlags.Public | BindingFlags.Instance);
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[PatchPostfix]
|
[PatchPostfix]
|
||||||
private static void PatchPostFix()
|
private static void PatchPostFix()
|
||||||
{
|
{
|
||||||
PowerOn.Start();
|
Singleton<GameWorld>.Instance.gameObject.AddComponent<PowerOn>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
20
PowerOn.cs
20
PowerOn.cs
@ -1,16 +1,13 @@
|
|||||||
using BepInEx;
|
using BepInEx;
|
||||||
using BepInEx.Configuration;
|
using BepInEx.Configuration;
|
||||||
using EFT.Interactive;
|
using EFT.Interactive;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ValensHasThePower
|
namespace ValensHasThePower
|
||||||
{
|
{
|
||||||
[BepInPlugin("com.Valens.HasThePower", "ValensHasThePower", "1.2.1")]
|
[BepInPlugin("com.Valens.HasThePower", "ValensHasThePower", "1.3.0")]
|
||||||
public class Plugin : BaseUnityPlugin
|
public class Plugin : BaseUnityPlugin
|
||||||
{
|
{
|
||||||
public static ConfigEntry<int> configCustoms;
|
public static ConfigEntry<int> configCustoms;
|
||||||
@ -28,13 +25,13 @@ namespace ValensHasThePower
|
|||||||
configCustoms = Config.Bind("General.Maps",
|
configCustoms = Config.Bind("General.Maps",
|
||||||
"Customs",
|
"Customs",
|
||||||
100,
|
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.");
|
"Default is 100.");
|
||||||
|
|
||||||
configInterchange = Config.Bind("General.Maps",
|
configInterchange = Config.Bind("General.Maps",
|
||||||
"Interchange",
|
"Interchange",
|
||||||
100,
|
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.");
|
"Default is 100.");
|
||||||
|
|
||||||
configReserve = Config.Bind("General.Maps",
|
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<Switch> PowerSwitches = UnityEngine.Object.FindObjectsOfType<Switch>().ToList();
|
List<Switch> PowerSwitches = FindObjectsOfType<Switch>().ToList();
|
||||||
|
|
||||||
foreach (var switcher in PowerSwitches)
|
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")
|
if (switcher.Id == "Shopping_Mall_DesignStuff_00055" && switcher.name == "reserve_electric_switcher_lever")
|
||||||
{
|
{
|
||||||
int percent = RandomGen();
|
int percent = RandomGen();
|
||||||
@ -99,8 +96,7 @@ namespace ValensHasThePower
|
|||||||
}
|
}
|
||||||
private static void PowerSwitch(Switch switcher)
|
private static void PowerSwitch(Switch switcher)
|
||||||
{
|
{
|
||||||
switcher.GetType().GetMethod("Open", BindingFlags.NonPublic | BindingFlags.Instance)
|
switcher.Open();
|
||||||
.Invoke(switcher, new object[0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,6 +26,9 @@
|
|||||||
<Reference Include="UnityEngine.CoreModule">
|
<Reference Include="UnityEngine.CoreModule">
|
||||||
<HintPath>shared\UnityEngine.CoreModule.dll</HintPath>
|
<HintPath>shared\UnityEngine.CoreModule.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Comfort.Common">
|
||||||
|
<HintPath>shared\Comfort.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</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.
@ -4,24 +4,19 @@
|
|||||||
<name>ConfigurationManager</name>
|
<name>ConfigurationManager</name>
|
||||||
</assembly>
|
</assembly>
|
||||||
<members>
|
<members>
|
||||||
<member name="M:ConfigurationManager.LegacySettingSearcher.GetLegacyPluginConfig(BepInEx.BaseUnityPlugin)">
|
|
||||||
<summary>
|
|
||||||
Used by bepinex 4 plugins
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:ConfigurationManager.SettingSearcher.GetBepInExCoreConfig">
|
<member name="M:ConfigurationManager.SettingSearcher.GetBepInExCoreConfig">
|
||||||
<summary>
|
<summary>
|
||||||
Bepinex 5 config
|
Get entries for all core BepInEx settings
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:ConfigurationManager.SettingSearcher.GetPluginConfig(BepInEx.BaseUnityPlugin)">
|
<member name="M:ConfigurationManager.SettingSearcher.GetPluginConfig(BepInEx.BaseUnityPlugin)">
|
||||||
<summary>
|
<summary>
|
||||||
Used by bepinex 5 plugins
|
Get entries for all settings of a plugin
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</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>
|
<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>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:ConfigurationManager.ConfigurationManager">
|
<member name="T:ConfigurationManager.ConfigurationManager">
|
||||||
@ -64,17 +59,16 @@
|
|||||||
Do not use any Begin / End layout methods, and avoid raising height from standard.
|
Do not use any Begin / End layout methods, and avoid raising height from standard.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</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">
|
<member name="P:ConfigurationManager.ConfigurationManager.SearchString">
|
||||||
<summary>
|
<summary>
|
||||||
String currently entered into the search box
|
String currently entered into the search box
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</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">
|
<member name="T:ConfigurationManager.SettingEntryBase">
|
||||||
<summary>
|
<summary>
|
||||||
Class representing all data about a setting collected by ConfigurationManager.
|
Class representing all data about a setting collected by ConfigurationManager.
|
||||||
@ -97,9 +91,23 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="P:ConfigurationManager.SettingEntryBase.CustomDrawer">
|
<member name="P:ConfigurationManager.SettingEntryBase.CustomDrawer">
|
||||||
<summary>
|
<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>
|
</summary>
|
||||||
</member>
|
</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">
|
<member name="P:ConfigurationManager.SettingEntryBase.Browsable">
|
||||||
<summary>
|
<summary>
|
||||||
Show this setting in the settings screen at all? If false, don't show.
|
Show this setting in the settings screen at all? If false, don't show.
|
||||||
@ -204,95 +212,5 @@
|
|||||||
Newly assigned value
|
Newly assigned value
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</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>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user