diff --git a/project/Aki.Core/AkiCorePlugin.cs b/project/Aki.Core/AkiCorePlugin.cs
index 7324aa4..eaacee0 100644
--- a/project/Aki.Core/AkiCorePlugin.cs
+++ b/project/Aki.Core/AkiCorePlugin.cs
@@ -8,7 +8,7 @@ namespace Aki.Core
[BepInPlugin("com.spt-aki.core", "AKI.Core", AkiPluginInfo.PLUGIN_VERSION)]
class AkiCorePlugin : BaseUnityPlugin
{
- public AkiCorePlugin()
+ public void Awake()
{
Logger.LogInfo("Loading: Aki.Core");
diff --git a/project/Aki.Debugging/AkiDebuggingPlugin.cs b/project/Aki.Debugging/AkiDebuggingPlugin.cs
index 02fe9b2..ead4d08 100644
--- a/project/Aki.Debugging/AkiDebuggingPlugin.cs
+++ b/project/Aki.Debugging/AkiDebuggingPlugin.cs
@@ -8,7 +8,7 @@ namespace Aki.Debugging
[BepInPlugin("com.spt-aki.debugging", "AKI.Debugging", AkiPluginInfo.PLUGIN_VERSION)]
public class AkiDebuggingPlugin : BaseUnityPlugin
{
- public AkiDebuggingPlugin()
+ public void Awake()
{
Logger.LogInfo("Loading: Aki.Debugging");
diff --git a/project/Aki.SinglePlayer/AkiSingleplayerPlugin.cs b/project/Aki.SinglePlayer/AkiSingleplayerPlugin.cs
index 8bd770d..b4fc67a 100644
--- a/project/Aki.SinglePlayer/AkiSingleplayerPlugin.cs
+++ b/project/Aki.SinglePlayer/AkiSingleplayerPlugin.cs
@@ -13,7 +13,7 @@ namespace Aki.SinglePlayer
[BepInPlugin("com.spt-aki.singleplayer", "AKI.Singleplayer", AkiPluginInfo.PLUGIN_VERSION)]
class AkiSingleplayerPlugin : BaseUnityPlugin
{
- public AkiSingleplayerPlugin()
+ public void Awake()
{
Logger.LogInfo("Loading: Aki.SinglePlayer");
@@ -54,6 +54,7 @@ namespace Aki.SinglePlayer
new SpawnProcessNegativeValuePatch().Enable();
new InsuredItemManagerStartPatch().Enable();
new MapReadyButtonPatch().Enable();
+ new LabsKeycardRemovalPatch().Enable();
}
catch (Exception ex)
{
diff --git a/project/Aki.SinglePlayer/Patches/RaidFix/LabsKeycardRemovalPatch.cs b/project/Aki.SinglePlayer/Patches/RaidFix/LabsKeycardRemovalPatch.cs
new file mode 100644
index 0000000..18bfb4e
--- /dev/null
+++ b/project/Aki.SinglePlayer/Patches/RaidFix/LabsKeycardRemovalPatch.cs
@@ -0,0 +1,49 @@
+using System.Linq;
+using System.Reflection;
+using Aki.Reflection.Patching;
+using Comfort.Common;
+using EFT;
+using HarmonyLib;
+
+namespace Aki.SinglePlayer.Patches.RaidFix
+{
+ ///
+ /// Patch to remove the Labs Access Card from player inventory upon entering Labs
+ ///
+ public class LabsKeycardRemovalPatch : ModulePatch
+ {
+ private const string LabsAccessCardTemplateId = "5c94bbff86f7747ee735c08f";
+
+ protected override MethodBase GetTargetMethod()
+ {
+ return typeof(GameWorld).GetMethod(nameof(GameWorld.OnGameStarted));
+ }
+
+ [PatchPostfix]
+ private static void PatchPostfix()
+ {
+ var gameWorld = Singleton.Instance;
+ var player = gameWorld?.MainPlayer;
+
+ if (gameWorld == null || player == null)
+ {
+ return;
+ }
+
+ if (gameWorld.MainPlayer.Location.ToLower() != "laboratory")
+ {
+ return;
+ }
+
+ var accessCardItem = player.Profile.Inventory.AllRealPlayerItems.FirstOrDefault(x => x.TemplateId == LabsAccessCardTemplateId);
+
+ if (accessCardItem == null)
+ {
+ return;
+ }
+
+ var inventoryController = Traverse.Create(player).Field("_inventoryController").Value;
+ GClass2585.Remove(accessCardItem, inventoryController, false, true);
+ }
+ }
+}
\ No newline at end of file