(7ee8dbc11) v0.9.8.0

This commit is contained in:
Joonas Rikkonen
2020-03-31 15:11:41 +03:00
parent 3e99a49383
commit b647059b93
147 changed files with 2299 additions and 1297 deletions
@@ -21,16 +21,27 @@ namespace Barotrauma.Networking
private Character character;
public Character Character
{
get { return character; }
get
{
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient && (character?.ID ?? 0) != CharacterID)
{
Character = Entity.FindEntityByID(CharacterID) as Character;
}
return character;
}
set
{
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer)
{
GameMain.NetworkMember.LastClientListUpdateID++;
if (value != null)
{
CharacterID = value.ID;
}
}
else
{
if (value!=null)
if (value != null)
{
DebugConsole.NewMessage(value.Name, Microsoft.Xna.Framework.Color.Yellow);
}
@@ -52,6 +63,8 @@ namespace Barotrauma.Networking
}
}
public UInt16 CharacterID;
private Vector2 spectate_position;
public Vector2? SpectatePos
{
@@ -98,7 +111,22 @@ namespace Barotrauma.Networking
private set;
}
public bool InGame;
private bool inGame;
public bool InGame
{
get
{
return inGame;
}
set
{
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer)
{
GameMain.NetworkMember.LastClientListUpdateID++;
}
inGame = value;
}
}
public bool HasSpawned; //has the client spawned as a character during the current round
private List<Client> kickVoters;
@@ -22,6 +22,8 @@ namespace Barotrauma.Networking
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)
REQUEST_STARTGAMEFINALIZE, //tell the server you're ready to finalize round initialization
ERROR //tell the server that an error occurred
}
enum ClientNetObject
@@ -60,6 +62,7 @@ namespace Barotrauma.Networking
QUERY_STARTGAME, //ask the clients whether they're ready to start
STARTGAME, //start a new round
STARTGAMEFINALIZE, //finalize round initialization
ENDGAME,
TRAITOR_MESSAGE,
@@ -159,8 +159,9 @@ namespace Barotrauma.Steam
{
if (string.IsNullOrWhiteSpace(str)) { return 0; }
UInt64 retVal;
if (str.StartsWith("STEAM64_", StringComparison.InvariantCultureIgnoreCase)) { str = str.Substring(8); }
if (UInt64.TryParse(str, out retVal) && retVal >(1<<52)) { return retVal; }
if (str.ToUpper().IndexOf("STEAM_") != 0) { return 0; }
if (!str.StartsWith("STEAM_", StringComparison.InvariantCultureIgnoreCase)) { return 0; }
string[] split = str.Substring(6).Split(':');
if (split.Length != 3) { return 0; }
@@ -179,7 +180,11 @@ namespace Barotrauma.Steam
UInt64 accountNumber = (uint64 >> 1) & 0x7fffffff;
UInt64 universe = (uint64 >> 56) & 0xff;
return "STEAM_" + universe.ToString() + ":" + y.ToString() + ":" + accountNumber.ToString();
string retVal = "STEAM_" + universe.ToString() + ":" + y.ToString() + ":" + accountNumber.ToString();
if (SteamIDStringToUInt64(retVal) != uint64) { return "STEAM64_" + uint64.ToString(); }
return retVal;
}
}
}