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

27 lines
702 B
C#
Raw Normal View History

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