diff --git a/Fika.Core/Coop/Components/CoopExfilManager.cs b/Fika.Core/Coop/Components/CoopExfilManager.cs index b7a587e4..66bfc26c 100644 --- a/Fika.Core/Coop/Components/CoopExfilManager.cs +++ b/Fika.Core/Coop/Components/CoopExfilManager.cs @@ -73,7 +73,7 @@ protected void Update() if (!exfiltrationPoint.UnmetRequirements(player).Any()) { game.MyExitLocation = exfiltrationPoint.Settings.Name; - game.Extract(player, exfiltrationPoint); + game.Extract((CoopPlayer)player, exfiltrationPoint); } } diff --git a/Fika.Core/Coop/GameMode/CoopGame.cs b/Fika.Core/Coop/GameMode/CoopGame.cs index 10418138..43ffe13f 100644 --- a/Fika.Core/Coop/GameMode/CoopGame.cs +++ b/Fika.Core/Coop/GameMode/CoopGame.cs @@ -49,26 +49,31 @@ namespace Fika.Core.Coop.GameMode /// internal sealed class CoopGame : BaseLocalGame, IBotGame, IFikaGame { - public new bool InRaid { get => true; } - public string InfiltrationPoint; - public bool HasAddedFenceRep = false; - public bool forceStart = false; + public ExitStatus MyExitStatus { get; set; } = ExitStatus.Survived; + public string MyExitLocation { get; set; } = null; + public ISpawnSystem SpawnSystem { get; set; } + + public Dictionary Bots { get; set; } = []; private CoopExfilManager exfilManager; private GameObject fikaStartButton; private readonly Dictionary botQueue = []; - public FikaDynamicAI DynamicAI { get; private set; } + private Coroutine extractRoutine; + private GClass2928 spawnPoints = null; + private ISpawnPoint spawnPoint = null; + private GClass579 GClass579; + private WavesSpawnScenario wavesSpawnScenario_0; + private NonWavesSpawnScenario nonWavesSpawnScenario_0; + private Func func_1; + public FikaDynamicAI DynamicAI { get; private set; } public RaidSettings RaidSettings { get; private set; } - //WildSpawnType for sptUsec and sptBear const int sptUsecValue = 47; const int sptBearValue = 48; - public ISession BackEndSession { get => PatchConstants.BackEndSession; } - BotsController IBotGame.BotsController { get @@ -76,7 +81,6 @@ BotsController IBotGame.BotsController return botsController_0; } } - public BotsController BotsController { get @@ -84,7 +88,6 @@ public BotsController BotsController return botsController_0; } } - public IWeatherCurve WeatherCurve { get @@ -93,7 +96,6 @@ public IWeatherCurve WeatherCurve } } - private static ManualLogSource Logger; internal static CoopGame Create(InputTree inputTree, Profile profile, GameDateTime backendDateTime, InsuranceCompanyClass insurance, MenuUI menuUI, @@ -214,8 +216,6 @@ public async Task CreateCoopHandler() } } - public Dictionary Bots { get; set; } = []; - private List GetPlayers(CoopHandler coopHandler) { List humanPlayers = []; @@ -687,9 +687,6 @@ private async Task SendOrReceiveSpawnPoint() } } - GClass2928 spawnPoints = null; - ISpawnPoint spawnPoint = null; - /// /// Creating the EFT.LocalPlayer /// @@ -1433,7 +1430,7 @@ public void ResetExfilPointsFromServer(ExfiltrationPoint[] points) /// /// The local player to start the Coroutine on /// - public void Extract(Player player, ExfiltrationPoint point) + public void Extract(CoopPlayer player, ExfiltrationPoint point) { PreloaderUI preloaderUI = Singleton.Instance; @@ -1460,7 +1457,7 @@ public void Extract(Player player, ExfiltrationPoint point) GenericPacket genericPacket = new() { - NetId = ((CoopPlayer)player).NetId, + NetId = player.NetId, PacketType = EPackageType.ClientExtract }; @@ -1495,6 +1492,8 @@ public void Extract(Player player, ExfiltrationPoint point) player.ActiveHealthController.DisableMetabolism(); player.ActiveHealthController.PauseAllEffects(); + extractRoutine = StartCoroutine(ExtractRoutine(player)); + // Prevents players from looting after extracting GClass3107.Instance.CloseAllScreensForced(); @@ -1524,6 +1523,30 @@ public void Extract(Player player, ExfiltrationPoint point) } } + /// + /// Used to make sure no stims or mods reset the DamageCoeff + /// + /// The to run the coroutine on + /// + private IEnumerator ExtractRoutine(CoopPlayer player) + { + while (true) + { + if (player != null && player.ActiveHealthController != null) + { + if (player.ActiveHealthController.DamageCoeff != 0) + { + player.ActiveHealthController.SetDamageCoeff(0); + } + } + else + { + yield break; + } + yield return new WaitForEndOfFrame(); + } + } + public void ClearHostAI(Player player) { if (player != null) @@ -1550,10 +1573,6 @@ public void ClearHostAI(Player player) } } - public ExitStatus MyExitStatus { get; set; } = ExitStatus.Survived; - public string MyExitLocation { get; set; } = null; - public ISpawnSystem SpawnSystem { get; set; } - private void HealthController_DiedEvent(EDamageType obj) { gparam_0.Player.HealthController.DiedEvent -= method_15; @@ -1836,6 +1855,11 @@ public override void Dispose() Singleton.Instance.MineManager.OnExplosion -= OnMineExplode; } + if (extractRoutine != null) + { + StopCoroutine(extractRoutine); + } + if (MatchmakerAcceptPatches.IsServer) { CoopPlayer coopPlayer = (CoopPlayer)Singleton.Instance.MainPlayer; @@ -1884,11 +1908,6 @@ public override void Dispose() base.Dispose(); } - private GClass579 GClass579; - private WavesSpawnScenario wavesSpawnScenario_0; - private NonWavesSpawnScenario nonWavesSpawnScenario_0; - private Func func_1; - private class ErrorExitManager : Class1364 { public void ExitOverride() @@ -1918,10 +1937,9 @@ public void ExitOverride() } } - public new void method_6(string backendUrl, string locationId, int variantId) { - Logger.LogInfo("CoopGame:method_6"); + Logger.LogDebug("CoopGame::method_6"); return; } }