Skip to content

Commit

Permalink
Fix "Run Through" status not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Jun 13, 2024
1 parent 3bc80f9 commit 8ebb53c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
17 changes: 8 additions & 9 deletions Fika.Core/Coop/Components/CoopHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,35 +197,34 @@ void ProcessQuitting()
if (FikaPlugin.ExtractKey.Value.IsDown() && quitState != EQuitState.NONE && !requestQuitGame)
{
requestQuitGame = true;
CoopGame coopGame = (CoopGame)Singleton<IFikaGame>.Instance;

// If you are the server / host
if (MatchmakerAcceptPatches.IsServer)
{
// A host needs to wait for the team to extract or die!
if ((Singleton<FikaServer>.Instance.NetServer.ConnectedPeersCount > 0) && quitState != EQuitState.NONE)
// A host needs to wait for the team to extract or die!
if ((Singleton<FikaServer>.Instance.NetServer.ConnectedPeersCount > 0) && quitState != EQuitState.NONE)
{
NotificationManagerClass.DisplayWarningNotification("HOSTING: You cannot exit the game until all clients have disconnected.");
requestQuitGame = false;
return;
}
else if (Singleton<FikaServer>.Instance.NetServer.ConnectedPeersCount == 0 && Singleton<FikaServer>.Instance.timeSinceLastPeerDisconnected > DateTime.Now.AddSeconds(-5) && Singleton<FikaServer>.Instance.hasHadPeer)
else if (Singleton<FikaServer>.Instance.NetServer.ConnectedPeersCount == 0
&& Singleton<FikaServer>.Instance.timeSinceLastPeerDisconnected > DateTime.Now.AddSeconds(-5)
&& Singleton<FikaServer>.Instance.hasHadPeer)
{
NotificationManagerClass.DisplayWarningNotification($"HOSTING: Please wait at least 5 seconds after the last peer disconnected before quitting.");
requestQuitGame = false;
return;
}
else
{
Singleton<IFikaGame>.Instance.Stop(Singleton<GameWorld>.Instance.MainPlayer.ProfileId,
Singleton<IFikaGame>.Instance.MyExitStatus,
MyPlayer.ActiveHealthController.IsAlive ? Singleton<IFikaGame>.Instance.MyExitLocation : null, 0);
coopGame.Stop(Singleton<GameWorld>.Instance.MainPlayer.ProfileId, coopGame.MyExitStatus, MyPlayer.ActiveHealthController.IsAlive ? coopGame.MyExitLocation : null, 0);
}
}
else
{
Singleton<IFikaGame>.Instance.Stop(Singleton<GameWorld>.Instance.MainPlayer.ProfileId,
Singleton<IFikaGame>.Instance.MyExitStatus,
MyPlayer.ActiveHealthController.IsAlive ? Singleton<IFikaGame>.Instance.MyExitLocation : null, 0);
coopGame.Stop(Singleton<GameWorld>.Instance.MainPlayer.ProfileId, coopGame.MyExitStatus, MyPlayer.ActiveHealthController.IsAlive ? coopGame.MyExitLocation : null, 0);
}
return;
}
Expand Down
11 changes: 9 additions & 2 deletions Fika.Core/Coop/GameMode/CoopGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1466,11 +1466,18 @@ public void Extract(CoopPlayer player, ExfiltrationPoint point)
{
PreloaderUI preloaderUI = Singleton<PreloaderUI>.Instance;

if (MyExitStatus == ExitStatus.MissingInAction)

if (MyExitStatus == ExitStatus.MissingInAction)
{
NotificationManagerClass.DisplayMessageNotification("You have gone missing in action...", iconType: EFT.Communications.ENotificationIconType.Alert, textColor: Color.red);
}

BackendConfigSettingsClass.GClass1361.GClass1367 matchEndConfig = Singleton<BackendConfigSettingsClass>.Instance.Experience.MatchEnd;
if (player.Profile.EftStats.SessionCounters.GetAllInt([CounterTag.Exp]) < matchEndConfig.SurvivedExpRequirement || PastTime < matchEndConfig.SurvivedTimeRequirement)
{
MyExitStatus = ExitStatus.Runner;
}

if (point != null)
{
point.Disable();
Expand Down Expand Up @@ -1635,7 +1642,7 @@ private IEnumerator SaveOnDeathRoutine()

public override void Stop(string profileId, ExitStatus exitStatus, string exitName, float delay = 0f)
{
Logger.LogInfo("CoopGame::Stop");
Logger.LogDebug("CoopGame::Stop");

CoopPlayer myPlayer = (CoopPlayer)Singleton<GameWorld>.Instance.MainPlayer;
myPlayer.PacketSender.DestroyThis();
Expand Down

0 comments on commit 8ebb53c

Please sign in to comment.