using Robust.Shared.Network;
using Robust.Shared.Network.Messages;
using Robust.Shared.Players;
using Robust.Shared.Utility;
namespace Robust.Shared.GameObjects
{
#nullable enable
///
/// A container that holds a component message and network info.
///
public readonly struct NetworkComponentMessage
{
///
/// Network channel this message came from.
///
public readonly INetChannel Channel;
///
/// Entity Uid this message is associated with.
///
public readonly EntityUid EntityUid;
///
/// If the Message is Directed, Component net Uid this message is being sent to.
///
public readonly uint NetId;
///
/// The message payload.
///
#pragma warning disable 618
public readonly ComponentMessage Message;
#pragma warning restore 618
///
/// If the message is from the client, the client's session.
///
public readonly ICommonSession? Session;
///
/// Constructs a new instance of .
///
/// Raw network message containing the component message.
public NetworkComponentMessage(MsgEntity netMsg, ICommonSession? session = null)
{
DebugTools.Assert(netMsg.Type == EntityMessageType.ComponentMessage);
Channel = netMsg.MsgChannel;
EntityUid = netMsg.EntityUid;
NetId = netMsg.NetId;
Message = netMsg.ComponentMessage;
Session = session;
}
}
#nullable restore
}