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

28 lines
707 B
C#
Raw Permalink Normal View History

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