From aaedfda019a3dbb09ccb1735c5100c92f1a15f50 Mon Sep 17 00:00:00 2001 From: Lacyway <20912169+Lacyway@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:40:53 +0200 Subject: [PATCH] Track insurance between clients --- Fika.Core/Coop/GameMode/CoopGame.cs | 7 ++++++- Fika.Core/Coop/Players/CoopPlayer.cs | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Fika.Core/Coop/GameMode/CoopGame.cs b/Fika.Core/Coop/GameMode/CoopGame.cs index 1b6751c2..7fcf6801 100644 --- a/Fika.Core/Coop/GameMode/CoopGame.cs +++ b/Fika.Core/Coop/GameMode/CoopGame.cs @@ -1558,7 +1558,6 @@ public void Extract(CoopPlayer player, ExfiltrationPoint point) { PreloaderUI preloaderUI = Singleton.Instance; - if (MyExitStatus == ExitStatus.MissingInAction) { NotificationManagerClass.DisplayMessageNotification("You have gone missing in action...", iconType: EFT.Communications.ENotificationIconType.Alert, textColor: Color.red); @@ -1630,6 +1629,12 @@ public void Extract(CoopPlayer player, ExfiltrationPoint point) extractRoutine = StartCoroutine(ExtractRoutine(player)); + // Clear to make sure we don't interfere with SPT logic + if (coopPlayer.Profile.InsuredItems.Length > 0) + { + coopPlayer.Profile.InsuredItems = Array.Empty(); + } + // Prevents players from looting after extracting CurrentScreenSingleton.Instance.CloseAllScreensForced(); diff --git a/Fika.Core/Coop/Players/CoopPlayer.cs b/Fika.Core/Coop/Players/CoopPlayer.cs index e1d2414c..84000a54 100644 --- a/Fika.Core/Coop/Players/CoopPlayer.cs +++ b/Fika.Core/Coop/Players/CoopPlayer.cs @@ -79,6 +79,21 @@ public static async Task Create(int playerId, Vector3 position, Qua questController.Init(); questController.Run(); + // Used to communicate what insurance each profile has between clients + if (session.InsuranceCompany?.InsuredItems?.Count > 0) + { + List itemsToInsure = []; + foreach (ItemClass item in session.InsuranceCompany.InsuredItems) + { + itemsToInsure.Add(new() + { + itemId = item.Id, + tid = item.TemplateId + }); + } + profile.InsuredItems = [.. itemsToInsure]; + } + GClass3233 achievementsController = new(profile, inventoryController, session, true); achievementsController.Init(); achievementsController.Run();