mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-19 15:51:54 +00:00
Add skid mode back
This commit is contained in:
1 parent
a4ae89630f
commit
e9aa92afcb
2 files changed
+21
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using Hazel;
|
||||
using Hazel.Udp;
|
||||
@@ -125,6 +126,21 @@ namespace Reactor.Networking.Patches
|
||||
var client = AmongUsClient.Instance;
|
||||
if (client != null && client.connection != null && client.connection.Equals(connection) && client.connection.State == ConnectionState.Connecting)
|
||||
{
|
||||
var reactorPlugin = PluginSingleton<ReactorPlugin>.Instance;
|
||||
|
||||
if (reactorPlugin.AllowVanillaServers.Value)
|
||||
{
|
||||
if (reactorPlugin.CustomRpcManager.List.Any())
|
||||
{
|
||||
Logger<ReactorPlugin>.Warning("Config option AllowVanillaServers was set to true, but there are custom rpcs registered!");
|
||||
}
|
||||
else
|
||||
{
|
||||
connection.State = ConnectionState.Connected;
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
client.LastDisconnectReason = DisconnectReasons.Custom;
|
||||
client.LastCustomDisconnect = "Server didn't respond to modded handshake";
|
||||
client.HandleDisconnect(client.LastDisconnectReason, client.LastCustomDisconnect);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.IL2CPP;
|
||||
using HarmonyLib;
|
||||
using Reactor.Extensions;
|
||||
@@ -21,6 +22,8 @@ namespace Reactor
|
||||
public Harmony Harmony { get; } = new Harmony(Id);
|
||||
public CustomRpcManager CustomRpcManager { get; } = new CustomRpcManager();
|
||||
|
||||
public ConfigEntry<bool> AllowVanillaServers;
|
||||
|
||||
private GameObject _gameObject;
|
||||
private RegionInfoWatcher RegionInfoWatcher { get; } = new RegionInfoWatcher();
|
||||
|
||||
@@ -28,6 +31,8 @@ namespace Reactor
|
||||
{
|
||||
RegisterInIl2CppAttribute.Register();
|
||||
|
||||
AllowVanillaServers = Config.Bind("Features", "Allow vanilla servers", false, "Whether reactor should ignore servers not responding to modded handshake. This config is ignored if any plugin uses custom rpcs!");
|
||||
|
||||
_gameObject = new GameObject(nameof(ReactorPlugin)).DontDestroy();
|
||||
_gameObject.AddComponent<ReactorComponent>().Plugin = this;
|
||||
_gameObject.AddComponent<Coroutines.Component>();
|
||||
|
||||
Reference in new issue
Block a user