mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-20 01:46:21 +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;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Linq;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using Hazel;
|
using Hazel;
|
||||||
using Hazel.Udp;
|
using Hazel.Udp;
|
||||||
@@ -125,6 +126,21 @@ namespace Reactor.Networking.Patches
|
|||||||
var client = AmongUsClient.Instance;
|
var client = AmongUsClient.Instance;
|
||||||
if (client != null && client.connection != null && client.connection.Equals(connection) && client.connection.State == ConnectionState.Connecting)
|
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.LastDisconnectReason = DisconnectReasons.Custom;
|
||||||
client.LastCustomDisconnect = "Server didn't respond to modded handshake";
|
client.LastCustomDisconnect = "Server didn't respond to modded handshake";
|
||||||
client.HandleDisconnect(client.LastDisconnectReason, client.LastCustomDisconnect);
|
client.HandleDisconnect(client.LastDisconnectReason, client.LastCustomDisconnect);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using BepInEx;
|
using BepInEx;
|
||||||
|
using BepInEx.Configuration;
|
||||||
using BepInEx.IL2CPP;
|
using BepInEx.IL2CPP;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using Reactor.Extensions;
|
using Reactor.Extensions;
|
||||||
@@ -21,6 +22,8 @@ namespace Reactor
|
|||||||
public Harmony Harmony { get; } = new Harmony(Id);
|
public Harmony Harmony { get; } = new Harmony(Id);
|
||||||
public CustomRpcManager CustomRpcManager { get; } = new CustomRpcManager();
|
public CustomRpcManager CustomRpcManager { get; } = new CustomRpcManager();
|
||||||
|
|
||||||
|
public ConfigEntry<bool> AllowVanillaServers;
|
||||||
|
|
||||||
private GameObject _gameObject;
|
private GameObject _gameObject;
|
||||||
private RegionInfoWatcher RegionInfoWatcher { get; } = new RegionInfoWatcher();
|
private RegionInfoWatcher RegionInfoWatcher { get; } = new RegionInfoWatcher();
|
||||||
|
|
||||||
@@ -28,6 +31,8 @@ namespace Reactor
|
|||||||
{
|
{
|
||||||
RegisterInIl2CppAttribute.Register();
|
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 = new GameObject(nameof(ReactorPlugin)).DontDestroy();
|
||||||
_gameObject.AddComponent<ReactorComponent>().Plugin = this;
|
_gameObject.AddComponent<ReactorComponent>().Plugin = this;
|
||||||
_gameObject.AddComponent<Coroutines.Component>();
|
_gameObject.AddComponent<Coroutines.Component>();
|
||||||
|
|||||||
Reference in new issue
Block a user