using System.Reflection; using NitroxClient.MonoBehaviours; using NitroxModel.Helper; namespace NitroxPatcher.Patches.Dynamic; /// /// Adds to the Player's object when it's initialized /// public sealed partial class Player_Start_Patch : NitroxPatch, IDynamicPatch { private static readonly MethodInfo TARGET_METHOD = Reflect.Method((Player t) => t.Start()); public static void Postfix() { if (Player.mainObject.GetComponent()) { return; } GroundMotor groundMotor = Player.mainObject.GetComponent(); Player.mainObject.AddComponent().Initialize(groundMotor); } }