2024-05-21 19:10:17 +01:00
|
|
|
|
using SPT.Reflection.Patching;
|
|
|
|
|
using SPT.SinglePlayer.Models.Progression;
|
2023-03-03 18:52:31 +00:00
|
|
|
|
using Comfort.Common;
|
|
|
|
|
using EFT;
|
|
|
|
|
using System.Reflection;
|
2024-01-13 22:08:29 +00:00
|
|
|
|
using HarmonyLib;
|
2023-03-03 18:52:31 +00:00
|
|
|
|
|
2024-05-21 19:10:17 +01:00
|
|
|
|
namespace SPT.SinglePlayer.Patches.Progression
|
2023-03-03 18:52:31 +00:00
|
|
|
|
{
|
|
|
|
|
public class LighthouseBridgePatch : ModulePatch
|
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
2024-01-13 22:08:29 +00:00
|
|
|
|
return AccessTools.Method(typeof(GameWorld), nameof(GameWorld.OnGameStarted));
|
2023-03-03 18:52:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPostfix]
|
|
|
|
|
private static void PatchPostfix()
|
|
|
|
|
{
|
|
|
|
|
var gameWorld = Singleton<GameWorld>.Instance;
|
2023-10-10 10:58:33 +00:00
|
|
|
|
|
|
|
|
|
if (gameWorld == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (gameWorld.MainPlayer.Location.ToLower() != "lighthouse" || gameWorld.MainPlayer.Side == EPlayerSide.Savage)
|
2023-07-30 10:04:35 +01:00
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-03-03 18:52:31 +00:00
|
|
|
|
|
|
|
|
|
gameWorld.GetOrAddComponent<LighthouseProgressionClass>();
|
2023-10-10 10:58:33 +00:00
|
|
|
|
}
|
2023-03-03 18:52:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|