using Barotrauma;
using Barotrauma.Networking;
using System;
namespace MoreLevelContent.Networking
{
///
/// Shared
///
public static partial class NetUtil
{
internal static IWriteMessage CreateNetMsg(NetEvent target) => GameMain.LuaCs.Networking.Start(Enum.GetName(typeof(NetEvent), target));
///
/// Register a method to run when the specified NetEvent happens
///
///
///
public static void Register(NetEvent target, LuaCsAction netEvent)
{
if (GameMain.IsSingleplayer) return;
GameMain.LuaCs.Networking.Receive(Enum.GetName(typeof(NetEvent), target), netEvent);
}
}
///
/// Events that are sent over the network
///
public enum NetEvent
{
///
/// Send a config message to the server
///
CONFIG_WRITE_SERVER,
///
/// Send a config message to the clients
///
CONFIG_WRITE_CLIENT,
///
/// Request the current config from the server
///
CONFIG_REQUEST,
///
/// Used to test if the target has the mod installed
///
PING_CLIENT,
///
/// Used to reply to the server's ping
///
PONG_SERVER,
///
/// Send the location of a new distress signal
///
MAP_SEND_NEWDISTRESS,
///
/// Send the location of a new lost cargo mission
///
MAP_SEND_NEWCARGO,
///
/// Call the create distress method on the server
///
COMMAND_CREATEDISTRESS,
///
/// Fakes a world step
///
COMMAND_STEPWORLD,
///
/// Request a map connection equality check from the server
///
MAP_CONNECTION_EQUALITYCHECK_REQUEST,
///
/// Sends the result to the client
///
MAP_CONNECTION_EQUALITYCHECK_SENDCLIENT,
///
/// Reveals the specified map feature
///
EVENT_REVEALMAPFEATURE,
///
/// Updates the status of a pirate base
///
PIRATEBASE_STATUS,
///
/// Request information on custom data added to the campaign map by mlc
///
MAP_REQUEST_STATE,
///
/// Information on the current map state, distress beacons, pirate state, etc
///
MAP_SEND_STATE
}
}