2023-02-18 20:23:20 +00:00
|
|
|
using System.Reflection;
|
|
|
|
using Aki.Reflection.Patching;
|
|
|
|
using Comfort.Common;
|
|
|
|
using EFT;
|
2024-03-02 18:40:51 +02:00
|
|
|
using HarmonyLib;
|
2023-02-18 20:23:20 +00:00
|
|
|
|
|
|
|
namespace Terkoiz.Freecam
|
|
|
|
{
|
|
|
|
public class FreecamPatch : ModulePatch
|
|
|
|
{
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
{
|
2024-03-02 18:40:51 +02:00
|
|
|
return AccessTools.Method(typeof(GameWorld), "OnGameStarted");
|
2023-02-18 20:23:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[PatchPostfix]
|
|
|
|
public static void PatchPostFix()
|
|
|
|
{
|
|
|
|
var gameworld = Singleton<GameWorld>.Instance;
|
|
|
|
|
|
|
|
if (gameworld == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Add FreeCamController to GameWorld GameObject
|
2023-02-18 21:35:18 +00:00
|
|
|
gameworld.gameObject.AddComponent<FreecamController>();
|
2023-02-18 20:23:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|