Skip to content

Commit

Permalink
Fix rebase errors from changing PlayerId to nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannify committed Nov 14, 2024
1 parent a254112 commit afc771c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Nitrox.Test/Patcher/Patches/PatchesTranspilerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class PatchesTranspilerTest
[typeof(uGUI_PDA_Initialize_Patch), 2],
[typeof(uGUI_PDA_SetTabs_Patch), 3],
[typeof(uGUI_Pings_IsVisibleNow_Patch), 0],
[typeof(uGUI_SceneIntro_IntroSequence_Patch), 5],
[typeof(uGUI_SceneIntro_IntroSequence_Patch), 8],
[typeof(uSkyManager_SetVaryingMaterialProperties_Patch), 0],
[typeof(Welder_Weld_Patch), 1],
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ public SetIntroCinematicModeProcessor(PlayerManager playerManager, PlayerCinemat

public override void Process(SetIntroCinematicMode packet)
{
if (!packet.PlayerId.HasValue)
{
Log.Error("playerId of SetIntroCinematicMode packet is null which is not expected.");
return;
}

if (localPlayer.PlayerId == packet.PlayerId)
{
if (packet.PartnerId.HasValue)
Expand All @@ -37,7 +31,7 @@ public override void Process(SetIntroCinematicMode packet)
return;
}

if (playerManager.TryFind(packet.PlayerId.Value, out RemotePlayer remotePlayer))
if (playerManager.TryFind(packet.PlayerId, out RemotePlayer remotePlayer))
{
remotePlayer.PlayerContext.IntroCinematicMode = packet.Mode;
return;
Expand Down
2 changes: 1 addition & 1 deletion NitroxClient/GameLogic/PlayerLogic/PlayerCinematics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void SetLocalIntroCinematicMode(IntroCinematicMode introCinematicMode)
if (localPlayer.IntroCinematicMode != introCinematicMode)
{
localPlayer.IntroCinematicMode = introCinematicMode;
packetSender.Send(new SetIntroCinematicMode(localPlayer.PlayerId!.Value, introCinematicMode));
packetSender.Send(new SetIntroCinematicMode(localPlayer.PlayerId.Value, introCinematicMode));
}
}
}
6 changes: 3 additions & 3 deletions NitroxModel/Packets/SetIntroCinematicMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ namespace NitroxModel.Packets;
[Serializable]
public class SetIntroCinematicMode : Packet
{
public ushort? PlayerId { get; }
public ushort PlayerId { get; }
public IntroCinematicMode Mode { get; }
public ushort? PartnerId { get; set; }

public SetIntroCinematicMode(ushort? playerId, IntroCinematicMode mode)
public SetIntroCinematicMode(ushort playerId, IntroCinematicMode mode)
{
PlayerId = playerId;
Mode = mode;
PartnerId = null;
}

public SetIntroCinematicMode(ushort? playerId, IntroCinematicMode mode, ushort? partnerId)
public SetIntroCinematicMode(ushort playerId, IntroCinematicMode mode, ushort? partnerId)
{
PlayerId = playerId;
Mode = mode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ public SetIntroCinematicModeProcessor(PlayerManager playerManager)

public override void Process(SetIntroCinematicMode packet, Player player)
{
if (!packet.PlayerId.HasValue)
{
Log.Warn($"Received {nameof(SetIntroCinematicMode)} packet where packet.{nameof(SetIntroCinematicMode.PlayerId)} was null");
return;
}

if (packet.PlayerId != player.Id)
{
Log.Warn($"Received {nameof(SetIntroCinematicMode)} packet where packet.{nameof(SetIntroCinematicMode.PlayerId)} was not equal to sending playerId");
Expand Down

0 comments on commit afc771c

Please sign in to comment.