diff --git a/project/Aki.Custom/AkiCustomPlugin.cs b/project/Aki.Custom/AkiCustomPlugin.cs
index 41b7e45..ca0a108 100644
--- a/project/Aki.Custom/AkiCustomPlugin.cs
+++ b/project/Aki.Custom/AkiCustomPlugin.cs
@@ -45,6 +45,7 @@ namespace Aki.Custom
new QTEPatch().Enable();
new PmcFirstAidPatch().Enable();
new SettingsLocationPatch().Enable();
+ new SetLocationIdOnRaidStartPatch().Enable();
//new RankPanelPatch().Enable();
new RagfairFeePatch().Enable();
new ScavQuestPatch().Enable();
diff --git a/project/Aki.Custom/Patches/SetLocationIdOnRaidStartPatch.cs b/project/Aki.Custom/Patches/SetLocationIdOnRaidStartPatch.cs
new file mode 100644
index 0000000..b979ac4
--- /dev/null
+++ b/project/Aki.Custom/Patches/SetLocationIdOnRaidStartPatch.cs
@@ -0,0 +1,46 @@
+using Aki.Reflection.Patching;
+using Aki.Reflection.Utils;
+using EFT;
+using System.Linq;
+using System.Reflection;
+using Comfort.Common;
+using System;
+using static LocationSettingsClass;
+
+namespace Aki.Custom.Patches
+{
+ ///
+ /// Local games do not set the locationId property like a network game does, `LocationId` is used by various bsg systems
+ /// e.g. btr/lightkeeper services
+ ///
+ public class SetLocationIdOnRaidStartPatch : ModulePatch
+ {
+ private static PropertyInfo _locationProperty;
+ protected override MethodBase GetTargetMethod()
+ {
+ Type localGameBaseType = PatchConstants.LocalGameType.BaseType;
+
+ // At this point, gameWorld.MainPlayer isn't set, so we need to use the LocalGame's `Location_0` property
+ _locationProperty = localGameBaseType.GetProperties(PatchConstants.PrivateFlags).Single(x => x.PropertyType == typeof(Location));
+
+ // Find the TimeAndWeatherSettings handling method
+ return localGameBaseType.GetMethods(PatchConstants.PrivateFlags).SingleOrDefault(m => IsTargetMethod(m));
+ }
+
+ private static bool IsTargetMethod(MethodInfo mi)
+ {
+ // Find method_3(TimeAndWeatherSettings timeAndWeather)
+ var parameters = mi.GetParameters();
+ return (parameters.Length == 1
+ && parameters[0].ParameterType == typeof(TimeAndWeatherSettings));
+ }
+
+ [PatchPostfix]
+ private static void PatchPostfix(AbstractGame __instance)
+ {
+ var gameWorld = Singleton.Instance;
+ Location location = _locationProperty.GetValue(__instance) as Location;
+ gameWorld.LocationId = location.Id;
+ }
+ }
+}
diff --git a/project/Aki.Debugging/Patches/BtrTestPatch.cs b/project/Aki.Debugging/Patches/BtrTestPatch.cs
index 4bf1eea..9cb233f 100644
--- a/project/Aki.Debugging/Patches/BtrTestPatch.cs
+++ b/project/Aki.Debugging/Patches/BtrTestPatch.cs
@@ -26,7 +26,6 @@ namespace Aki.Debugging.Patches
}
var botGame = Singleton.Instance;
- gameWorld.LocationId = gameWorld.MainPlayer.Location;
if (gameWorld.BtrController == null)
{