Skip to content

Commit 06894f9

Browse files
committed
Merge remote-tracking branch 'Torch/master'
2 parents 3c38b97 + 25d1d85 commit 06894f9

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using NLog;
2+
using Torch.Managers.PatchManager;
3+
using VRage;
4+
using VRage.Network;
5+
6+
namespace Torch.Patches
7+
{
8+
[PatchShim]
9+
public static class MyReplicationServerPatch
10+
{
11+
public static Logger Log = LogManager.GetCurrentClassLogger();
12+
13+
public static void Patch(PatchContext ctx)
14+
{
15+
ctx.GetPattern(typeof(MyReplicationServer).GetMethod("OnClientConnected", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance))
16+
.Suffixes.Add(typeof(MyReplicationServerPatch).GetMethod(nameof(OnClientConnectedSuffix), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static));
17+
}
18+
19+
public static void OnClientConnectedSuffix(ref ConnectedClientDataMsg __result, MyPacket packet)
20+
{
21+
int nameLimit = 32;
22+
23+
if (__result.Name.Length > nameLimit)
24+
{
25+
__result.Name = __result.Name.Substring(0, nameLimit);
26+
}
27+
}
28+
}
29+
}

‎Torch/Torch.csproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@
247247
<Compile Include="Patches\KeenLogPatch.cs" />
248248
<Compile Include="Patches\MessageSizeLimitPatch.cs" />
249249
<Compile Include="Patches\ModsDownloadingPatch.cs" />
250+
<Compile Include="Patches\MyReplicationServerPatch.cs" />
250251
<Compile Include="Patches\PhysicsMemoryPatch.cs" />
251252
<Compile Include="Patches\SessionDownloadPatch.cs" />
252253
<Compile Include="Patches\TorchAsyncSaving.cs" />

0 commit comments

Comments
 (0)