first commit

This commit is contained in:
2025-07-06 00:23:46 +02:00
commit 38f50c8819
1788 changed files with 112878 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxClient.GameLogic;
using NitroxClient.MonoBehaviours;
using NitroxClient.MonoBehaviours.CinematicController;
using NitroxModel.DataStructures.Util;
using NitroxModel.Helper;
using NitroxModel.Packets;
using UnityEngine;
namespace NitroxClient.Communication.Packets.Processors;
public class PlayerCinematicControllerCallProcessor : ClientPacketProcessor<PlayerCinematicControllerCall>
{
private readonly PlayerManager playerManager;
public PlayerCinematicControllerCallProcessor(PlayerManager playerManager)
{
this.playerManager = playerManager;
}
public override void Process(PlayerCinematicControllerCall packet)
{
if (!NitroxEntity.TryGetObjectFrom(packet.ControllerID, out GameObject entity))
{
return; // Entity can be not spawned yet bc async.
}
if (!entity.TryGetComponent(out MultiplayerCinematicReference reference))
{
Log.Warn($"Couldn't find {nameof(MultiplayerCinematicReference)} on {entity.name}:{packet.ControllerID}");
return;
}
Optional<RemotePlayer> opPlayer = playerManager.Find(packet.PlayerId);
Validate.IsPresent(opPlayer);
if (packet.StartPlaying)
{
reference.CallStartCinematicMode(packet.Key, packet.ControllerNameHash, opPlayer.Value);
}
else
{
reference.CallCinematicModeEnd(packet.Key, packet.ControllerNameHash, opPlayer.Value);
}
}
}