This repository has been archived on 2024-12-03. You can view files and clone it, but cannot push or open issues or pull requests.
Freecam/project/Terkoiz.Freecam/FreecamPatch.cs
2024-07-09 00:06:17 +03:00

28 lines
707 B
C#

using System.Reflection;
using SPT.Reflection.Patching;
using Comfort.Common;
using EFT;
using HarmonyLib;
namespace Terkoiz.Freecam
{
public class FreecamPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(GameWorld), nameof(GameWorld.OnGameStarted));
}
[PatchPostfix]
public static void PatchPostFix()
{
var gameWorld = Singleton<GameWorld>.Instance;
if (gameWorld == null)
return;
// Add FreecamController to GameWorld GameObject
gameWorld.gameObject.AddComponent<FreecamController>();
}
}
}