Skip to content

Commit

Permalink
Fixed cinematic not starting if skip was pressed shortly
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannify committed May 10, 2024
1 parent 8d4549c commit 608b777
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
5 changes: 3 additions & 2 deletions NitroxClient/MonoBehaviours/IntroCinematicUpdater.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections;
using NitroxClient.GameLogic;
using NitroxModel.Core;
Expand All @@ -19,11 +20,11 @@ public class IntroCinematicUpdater : MonoBehaviour
private Transform[] seatPartsRight;
private Transform seatArmRestLeft;
private Transform seatArmRestRight;
private SkinnedMeshRenderer[] seatBarRendererRight;
private SkinnedMeshRenderer[] seatBarRendererRight = Array.Empty<SkinnedMeshRenderer>();

private SkinnedMeshRenderer remotePlayerHeadRenderer;
private GameObject remotePlayerCustomHead;
private SkinnedMeshRenderer[] remoteRenders;
private SkinnedMeshRenderer[] remoteRenders = Array.Empty<SkinnedMeshRenderer>();

public void Awake()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ private static float GetSkipTime()
private static bool IsRemoteCinematicReady(uGUI_SceneIntro uGuiSceneIntro)
{
if (callbackRun) return true;

if (GameModeUtils.currentGameMode.HasFlag(GameModeOption.Creative)) uGuiSceneIntro.Stop(true); // Stopping intro if Creative like in normal SN

if (Resolve<LocalPlayer>().IntroCinematicMode == IntroCinematicMode.COMPLETED)
Expand All @@ -101,7 +102,14 @@ private static bool IsRemoteCinematicReady(uGUI_SceneIntro uGuiSceneIntro)
EndRemoteCinematic();
}

if (!uGuiSceneIntro.moveNext) return false;
// See NitroxServer.Communication.Packets.Processors.SetIntroCinematicModeProcessor
RemotePlayer firstWaitingRemotePlayer = Resolve<PlayerManager>().GetAll().FirstOrDefault(r => r.PlayerContext.IntroCinematicMode is IntroCinematicMode.START);
if (firstWaitingRemotePlayer != null)
{
partner = firstWaitingRemotePlayer;
EnqueueStartCinematic(uGuiSceneIntro);
Resolve<PlayerCinematics>().SetLocalIntroCinematicMode(IntroCinematicMode.PLAYING);
}

if (!packetSend)
{
Expand All @@ -112,16 +120,6 @@ private static bool IsRemoteCinematicReady(uGUI_SceneIntro uGuiSceneIntro)
Resolve<PlayerCinematics>().SetLocalIntroCinematicMode(IntroCinematicMode.WAITING);
packetSend = true;
IsWaitingForPartner = true;
return false;
}

// See NitroxServer.Communication.Packets.Processors.SetIntroCinematicModeProcessor
RemotePlayer firstWaitingRemotePlayer = Resolve<PlayerManager>().GetAll().FirstOrDefault(r => r.PlayerContext.IntroCinematicMode is IntroCinematicMode.START);
if (firstWaitingRemotePlayer != null)
{
partner = firstWaitingRemotePlayer;
EnqueueStartCinematic(uGuiSceneIntro);
Resolve<PlayerCinematics>().SetLocalIntroCinematicMode(IntroCinematicMode.PLAYING);
}

return false;
Expand Down

0 comments on commit 608b777

Please sign in to comment.