first commit
This commit is contained in:
26
NitroxPatcher/Patches/Dynamic/Utils_GetEntityRoot_Patch.cs
Normal file
26
NitroxPatcher/Patches/Dynamic/Utils_GetEntityRoot_Patch.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Reflection;
|
||||
using NitroxClient.GameLogic.PlayerLogic;
|
||||
using NitroxClient.Unity.Helper;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NitroxPatcher.Patches.Dynamic;
|
||||
|
||||
/// <summary>
|
||||
/// When looking for an EntityRoot, we want to make sure that remote players can be recognized as one.
|
||||
/// </summary>
|
||||
public sealed partial class Utils_GetEntityRoot_Patch : NitroxPatch, IDynamicPatch
|
||||
{
|
||||
private static readonly MethodInfo TARGET_METHOD = Reflect.Method(() => UWE.Utils.GetEntityRoot(default));
|
||||
|
||||
public static bool Prefix(GameObject go, ref GameObject __result)
|
||||
{
|
||||
if (go.TryGetComponent(out RemotePlayerIdentifier remotePlayerIdentifier) ||
|
||||
go.TryGetComponentInParent(out remotePlayerIdentifier, true))
|
||||
{
|
||||
__result = remotePlayerIdentifier.gameObject;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user