mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-19 15:51:54 +00:00
Initial BepInEx upgrade
This commit is contained in:
6 files changed
+25
-42
No files matched your search
+2
-2
@@ -13,11 +13,11 @@ indent_size = 4
|
||||
|
||||
# XML project files
|
||||
[*.{csproj, vbproj, vcxproj, vcxproj.filters, proj, projitems, shproj}]
|
||||
indent_size = 2
|
||||
indent_size = 4
|
||||
|
||||
# XML config files
|
||||
[*.{props, targets, ruleset, config, nuspec, resx, vsixmanifest, vsct}]
|
||||
indent_size = 2
|
||||
indent_size = 4
|
||||
|
||||
# Dotnet code style settings:
|
||||
[*.{cs, vb}]
|
||||
|
||||
+7
-3
@@ -1,11 +1,15 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2021.6.30s</GameVersion>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2021.6.30i</GameVersion>
|
||||
<GamePlatform Condition="'$(GamePlatform)' == ''">Steam</GamePlatform>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2021.6.30-s</GameVersion>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2021.6.30-i</GameVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Reactor.MSBuild" Version="0.1.5" PrivateAssets="all" />
|
||||
<PackageReference Include="BepInEx.AutoPlugin" Version="1.0.0" />
|
||||
<PackageReference Include="BepInEx.IL2CPP" Version="6.0.0-be.426" />
|
||||
<PackageReference Include="AmongUs.GameLibs" Version="$(GameVersion)" />
|
||||
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="0.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''">
|
||||
|
||||
@@ -11,21 +11,18 @@ using UnityEngine;
|
||||
|
||||
namespace Reactor.Debugger
|
||||
{
|
||||
[BepInPlugin(Id)]
|
||||
[BepInAutoPlugin("gg.reactor.debugger")]
|
||||
[BepInProcess("Among Us.exe")]
|
||||
[BepInDependency(ReactorPlugin.Id)]
|
||||
[ReactorPluginSide(PluginSide.ClientOnly)]
|
||||
public class DebuggerPlugin : BasePlugin
|
||||
public partial class DebuggerPlugin : BasePlugin
|
||||
{
|
||||
public const string Id = "gg.reactor.debugger";
|
||||
|
||||
public Harmony Harmony { get; } = new Harmony(Id);
|
||||
public DebuggerComponent Component { get; private set; }
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
var gameObject = new GameObject(nameof(DebuggerPlugin)).DontDestroy();
|
||||
Component = gameObject.AddComponent<DebuggerComponent>();
|
||||
Component = this.AddComponent<DebuggerComponent>();
|
||||
|
||||
GameOptionsData.MaxImpostors = GameOptionsData.RecommendedImpostors = Enumerable.Repeat((int) byte.MaxValue, byte.MaxValue).ToArray();
|
||||
GameOptionsData.MinPlayers = Enumerable.Repeat(1, 4).ToArray();
|
||||
|
||||
@@ -1,32 +1,24 @@
|
||||
using System;
|
||||
using BepInEx;
|
||||
using BepInEx.IL2CPP;
|
||||
using Reactor.Extensions;
|
||||
using Reactor.Networking;
|
||||
using UnhollowerBaseLib.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Reactor.Example
|
||||
{
|
||||
[BepInPlugin(Id)]
|
||||
[BepInAutoPlugin("gg.reactor.Example")]
|
||||
[BepInProcess("Among Us.exe")]
|
||||
[BepInDependency(ReactorPlugin.Id)]
|
||||
public class ExamplePlugin : BasePlugin
|
||||
public partial class ExamplePlugin : BasePlugin
|
||||
{
|
||||
public const string Id = "gg.reactor.Example";
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
var gameObject = new GameObject(nameof(ReactorPlugin)).DontDestroy();
|
||||
gameObject.AddComponent<ExampleComponent>().Plugin = this;
|
||||
this.AddComponent<ExampleComponent>();
|
||||
}
|
||||
|
||||
[RegisterInIl2Cpp]
|
||||
public class ExampleComponent : MonoBehaviour
|
||||
{
|
||||
[HideFromIl2Cpp]
|
||||
public ExamplePlugin Plugin { get; internal set; }
|
||||
|
||||
public ExampleComponent(IntPtr ptr) : base(ptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.IL2CPP;
|
||||
using HarmonyLib;
|
||||
using Reactor.Extensions;
|
||||
using Reactor.Networking;
|
||||
using Reactor.Patches;
|
||||
using Reactor.Unstrip;
|
||||
@@ -13,27 +12,19 @@ using UnityEngine;
|
||||
|
||||
namespace Reactor
|
||||
{
|
||||
[BepInPlugin(Id)]
|
||||
[BepInAutoPlugin("gg.reactor.api")]
|
||||
[BepInProcess("Among Us.exe")]
|
||||
public class ReactorPlugin : BasePlugin
|
||||
public partial class ReactorPlugin : BasePlugin
|
||||
{
|
||||
public const string Id = "gg.reactor.api";
|
||||
|
||||
public Harmony Harmony { get; } = new Harmony(Id);
|
||||
public CustomRpcManager CustomRpcManager { get; } = new CustomRpcManager();
|
||||
|
||||
public ConfigEntry<bool> AllowVanillaServers;
|
||||
public ConfigEntry<bool> AllowVanillaServers { get; private set; }
|
||||
|
||||
private GameObject _gameObject;
|
||||
private RegionInfoWatcher RegionInfoWatcher { get; } = new RegionInfoWatcher();
|
||||
|
||||
public ReactorPlugin()
|
||||
{
|
||||
if (Paths.BepInExVersion < new SemVer.Version("6.0.0-reactor.23"))
|
||||
{
|
||||
throw new NotSupportedException("This version of BepInEx is not supported!");
|
||||
}
|
||||
|
||||
PluginSingleton<BasePlugin>.Initialize();
|
||||
RegisterInIl2CppAttribute.Initialize();
|
||||
RegisterCustomRpcAttribute.Initialize();
|
||||
@@ -47,9 +38,8 @@ namespace Reactor
|
||||
|
||||
Harmony.PatchAll();
|
||||
|
||||
_gameObject = new GameObject(nameof(ReactorPlugin)).DontDestroy();
|
||||
_gameObject.AddComponent<ReactorComponent>().Plugin = this;
|
||||
_gameObject.AddComponent<Coroutines.Component>();
|
||||
this.AddComponent<ReactorComponent>().Plugin = this;
|
||||
this.AddComponent<Coroutines.Component>();
|
||||
|
||||
ReactorVersionShower.Initialize();
|
||||
SplashSkip.Initialize();
|
||||
@@ -59,7 +49,6 @@ namespace Reactor
|
||||
public override bool Unload()
|
||||
{
|
||||
Harmony.UnpatchSelf();
|
||||
_gameObject.Destroy();
|
||||
RegionInfoWatcher?.Dispose();
|
||||
|
||||
return base.Unload();
|
||||
|
||||
+5
-4
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="BepInExLibs" value="https://pkgs.dev.azure.com/bepinex/BepInEx/_packaging/BepInExLibs/nuget/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
<packageSources>
|
||||
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
Reference in new issue
Block a user