mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-20 01:46:21 +00:00
Kick for not having reactor only when necessary
This commit is contained in:
3 files changed
+7
-3
No files matched your search
@@ -39,6 +39,8 @@ public static class ModList
|
||||
return _modByPluginType[pluginType];
|
||||
}
|
||||
|
||||
internal static bool IsAnyModIsRequiredOnAllClients { get; private set; }
|
||||
|
||||
private static readonly Dictionary<uint, Mod> _modByNetId = new();
|
||||
private static readonly Dictionary<Mod, uint> _netIdByMod = new();
|
||||
|
||||
@@ -113,6 +115,8 @@ public static class ModList
|
||||
netId++;
|
||||
}
|
||||
|
||||
IsAnyModIsRequiredOnAllClients = Current.Any(m => m.IsRequiredOnAllClients);
|
||||
|
||||
var debug = new StringBuilder("Mod list:");
|
||||
foreach (var mod in Current)
|
||||
{
|
||||
|
||||
@@ -84,7 +84,7 @@ internal static class ClientPatches
|
||||
|
||||
if (innerNetClient.AmHost)
|
||||
{
|
||||
if (reactorClientData == null)
|
||||
if (reactorClientData == null && ModList.IsAnyModIsRequiredOnAllClients)
|
||||
{
|
||||
Warning("Kicking " + clientData.PlayerName + " for not having Reactor installed");
|
||||
|
||||
@@ -100,7 +100,7 @@ internal static class ClientPatches
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Mod.Validate(reactorClientData.Mods, ModList.Current, out var reason))
|
||||
if (!Mod.Validate(reactorClientData?.Mods ?? Array.Empty<Mod>(), ModList.Current, out var reason))
|
||||
{
|
||||
innerNetClient.KickWithReason(clientData.Id, reason);
|
||||
__result = false;
|
||||
|
||||
@@ -103,7 +103,7 @@ internal static class HttpPatches
|
||||
public static void Postfix(GameStartManager __instance)
|
||||
{
|
||||
if (AmongUsClient.Instance.GameMode != GameModes.OnlineGame) return;
|
||||
if (ModList.Current.Any(m => m.IsRequiredOnAllClients) && !IsCurrentRegionModded())
|
||||
if (ModList.IsAnyModIsRequiredOnAllClients && !IsCurrentRegionModded())
|
||||
{
|
||||
Warning("Vanilla region, locking public toggle");
|
||||
|
||||
|
||||
Reference in new issue
Block a user