Skip to content

Commit bf95890

Browse files
Fix teleport commands not working correctly inside a subroot (#2205)
1 parent 14cfb2f commit bf95890

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Reflection;
2+
using NitroxClient.GameLogic;
3+
using NitroxModel.DataStructures.Util;
4+
using NitroxModel.Helper;
5+
6+
namespace NitroxPatcher.Patches.Dynamic;
7+
8+
// This method sets the player's subroot to null, so send a packet accordingly
9+
public sealed partial class Player_OnPlayerPositionCheat_Patch : NitroxPatch, IDynamicPatch
10+
{
11+
private static readonly MethodInfo TARGET_METHOD = Reflect.Method((Player t) => t.OnPlayerPositionCheat());
12+
13+
public static void Prefix(Player __instance)
14+
{
15+
if (__instance.GetCurrentSub())
16+
{
17+
Resolve<LocalPlayer>().BroadcastSubrootChange(Optional.Empty);
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)