2 Commits

3 changed files with 26 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
using System.Reflection.Emit;
using System.Collections.Generic;
using HarmonyLib;
using stick.plugins.playermanager;
[HarmonyPatch(typeof(MatchmakingHandler), "OnRandomServerJoinFailed")]
class DistanceFilterPatch
{
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
return new CodeMatcher(instructions)
.MatchForward(false,
new CodeMatch(OpCodes.Ldc_I4_1),
new CodeMatch(OpCodes.Stloc_0)
)
.RemoveInstruction()
.InsertAndAdvance(
new CodeInstruction(OpCodes.Ldsfld,
AccessTools.Field(typeof(PlayerManager), nameof(PlayerManager.lobbyDistanceFilter))))
.InstructionEnumeration();
}
}

View File

@@ -293,6 +293,8 @@ public class PlayerManager : BaseUnityPlugin
}
Harmony.CreateAndPatchAll(typeof(ApplyBlacklist));
Harmony.CreateAndPatchAll(typeof(ListenForChange));
Harmony.CreateAndPatchAll(typeof(MutePatch));
Harmony.CreateAndPatchAll(typeof(DistanceFilterPatch));
}
/// <summary>

View File

@@ -4,7 +4,7 @@
<TargetFramework>net35</TargetFramework>
<AssemblyName>stick.plugins.playermanager</AssemblyName>
<Product>PlayerManager</Product>
<Version>4.0.5</Version>
<Version>4.0.6</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources>