Kick for not having reactor only when necessary

This commit is contained in:
js6pak committed 2022-10-27 11:41:41 +02:00
1 parent fa4cc03e33
commit 9246458919
3 files changed
+7 -3

No files matched your search

+4
View File
@@ -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)
{
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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");