first commit
This commit is contained in:
23
NitroxPatcher/Patches/Dynamic/Player_Start_Patch.cs
Normal file
23
NitroxPatcher/Patches/Dynamic/Player_Start_Patch.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Reflection;
|
||||
using NitroxClient.MonoBehaviours;
|
||||
using NitroxModel.Helper;
|
||||
|
||||
namespace NitroxPatcher.Patches.Dynamic;
|
||||
|
||||
/// <summary>
|
||||
/// Adds <see cref="CyclopsMotor"/> to the Player's object when it's initialized
|
||||
/// </summary>
|
||||
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<CyclopsMotor>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
GroundMotor groundMotor = Player.mainObject.GetComponent<GroundMotor>();
|
||||
Player.mainObject.AddComponent<CyclopsMotor>().Initialize(groundMotor);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user