2f107db...5202af9
This commit is contained in:
@@ -15,7 +15,13 @@ namespace Barotrauma.Networking
|
||||
UPDATE_LOBBY, //update state in lobby
|
||||
UPDATE_INGAME, //update state ingame
|
||||
|
||||
SERVER_SETTINGS, //change server settings
|
||||
|
||||
CAMPAIGN_SETUP_INFO,
|
||||
|
||||
FILE_REQUEST, //request a (submarine) file from the server
|
||||
|
||||
VOICE,
|
||||
|
||||
RESPONSE_STARTGAME, //tell the server whether you're ready to start
|
||||
SERVER_COMMAND, //tell the server to end a round or kick/ban someone (special permissions required)
|
||||
@@ -47,9 +53,14 @@ namespace Barotrauma.Networking
|
||||
|
||||
PERMISSIONS, //tell the client which special permissions they have (if any)
|
||||
ACHIEVEMENT, //give the client a steam achievement
|
||||
CHEATS_ENABLED, //tell the clients whether cheats are on or off
|
||||
|
||||
CAMPAIGN_SETUP_INFO,
|
||||
|
||||
FILE_TRANSFER,
|
||||
|
||||
VOICE,
|
||||
|
||||
QUERY_STARTGAME, //ask the clients whether they're ready to start
|
||||
STARTGAME, //start a new round
|
||||
ENDGAME
|
||||
@@ -60,6 +71,7 @@ namespace Barotrauma.Networking
|
||||
SYNC_IDS,
|
||||
CHAT_MESSAGE,
|
||||
VOTE,
|
||||
CLIENT_LIST,
|
||||
ENTITY_POSITION,
|
||||
ENTITY_EVENT,
|
||||
ENTITY_EVENT_INITIAL,
|
||||
@@ -98,6 +110,24 @@ namespace Barotrauma.Networking
|
||||
|
||||
abstract partial class NetworkMember
|
||||
{
|
||||
public UInt16 LastClientListUpdateID
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public virtual bool IsServer
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public virtual bool IsClient
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public abstract void CreateEntityEvent(INetSerializable entity, object[] extraData = null);
|
||||
|
||||
#if DEBUG
|
||||
public Dictionary<string, long> messageCount = new Dictionary<string, long>();
|
||||
#endif
|
||||
@@ -110,6 +140,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
protected string name;
|
||||
|
||||
protected ServerSettings serverSettings;
|
||||
|
||||
protected TimeSpan updateInterval;
|
||||
protected DateTime updateTimer;
|
||||
|
||||
@@ -117,17 +149,25 @@ namespace Barotrauma.Networking
|
||||
|
||||
protected bool gameStarted;
|
||||
|
||||
public Dictionary<string, bool> monsterEnabled;
|
||||
|
||||
protected RespawnManager respawnManager;
|
||||
|
||||
public Voting Voting;
|
||||
|
||||
public bool ShowNetStats;
|
||||
|
||||
public int Port
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public int TickRate
|
||||
{
|
||||
get { return serverSettings.TickRate; }
|
||||
set
|
||||
{
|
||||
serverSettings.TickRate = MathHelper.Clamp(value, 1, 60);
|
||||
updateInterval = new TimeSpan(0, 0, 0, 0, MathHelper.Clamp(1000 / serverSettings.TickRate, 1, 500));
|
||||
}
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
@@ -154,25 +194,17 @@ namespace Barotrauma.Networking
|
||||
get { return respawnManager; }
|
||||
}
|
||||
|
||||
public ServerLog ServerLog
|
||||
public ServerSettings ServerSettings
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
get { return serverSettings; }
|
||||
}
|
||||
|
||||
|
||||
public NetPeerConfiguration NetPeerConfiguration
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
}
|
||||
|
||||
public NetworkMember()
|
||||
{
|
||||
InitProjSpecific();
|
||||
|
||||
Voting = new Voting();
|
||||
}
|
||||
|
||||
|
||||
public bool CanUseRadio(Character sender)
|
||||
{
|
||||
if (sender == null) return false;
|
||||
@@ -190,19 +222,14 @@ namespace Barotrauma.Networking
|
||||
AddChatMessage(ChatMessage.Create(senderName, message, type, senderCharacter));
|
||||
}
|
||||
|
||||
public void AddChatMessage(ChatMessage message)
|
||||
public virtual void AddChatMessage(ChatMessage message)
|
||||
{
|
||||
GameServer.Log(message.TextWithSender, ServerLog.MessageType.Chat);
|
||||
|
||||
if (string.IsNullOrEmpty(message.Text)) { return; }
|
||||
|
||||
if (message.Sender != null && !message.Sender.IsDead)
|
||||
{
|
||||
message.Sender.ShowSpeechBubble(2.0f, ChatMessage.MessageColor[(int)message.Type]);
|
||||
}
|
||||
|
||||
#if CLIENT
|
||||
GameMain.NetLobbyScreen.NewChatMessage(message);
|
||||
chatBox.AddMessage(message);
|
||||
#endif
|
||||
}
|
||||
|
||||
public virtual void KickPlayer(string kickedName, string reason) { }
|
||||
@@ -211,12 +238,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
public virtual void UnbanPlayer(string playerName, string playerIP) { }
|
||||
|
||||
public virtual void Update(float deltaTime)
|
||||
{
|
||||
#if CLIENT
|
||||
UpdateHUD(deltaTime);
|
||||
#endif
|
||||
}
|
||||
public virtual void Update(float deltaTime) { }
|
||||
|
||||
public virtual void Disconnect() { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user