(bcb06cc5c) Unstable v0.9.9.0
This commit is contained in:
@@ -233,7 +233,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
writeStream?.Write(msg, 0, msg.Length);
|
||||
}
|
||||
catch (IOException e)
|
||||
catch (IOException)
|
||||
{
|
||||
shutDown = true;
|
||||
break;
|
||||
@@ -263,7 +263,7 @@ namespace Barotrauma.Networking
|
||||
lengthBytes[1] = (byte)0;
|
||||
writeStream?.Write(lengthBytes, 0, 2);
|
||||
}
|
||||
catch (IOException e)
|
||||
catch (IOException)
|
||||
{
|
||||
shutDown = true;
|
||||
break;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "command") continue;
|
||||
if (!subElement.Name.ToString().Equals("command", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
string commandName = subElement.GetAttributeString("name", "");
|
||||
|
||||
DebugConsole.Command command = DebugConsole.FindCommand(commandName);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -63,15 +63,14 @@ namespace Barotrauma.Networking
|
||||
|
||||
public Submarine RespawnShuttle { get; private set; }
|
||||
|
||||
public RespawnManager(NetworkMember networkMember, Submarine shuttle)
|
||||
: base(shuttle)
|
||||
public RespawnManager(NetworkMember networkMember, SubmarineInfo shuttleInfo)
|
||||
: base(null)
|
||||
{
|
||||
this.networkMember = networkMember;
|
||||
|
||||
if (shuttle != null)
|
||||
if (shuttleInfo != null)
|
||||
{
|
||||
RespawnShuttle = new Submarine(shuttle.FilePath, shuttle.MD5Hash.Hash, true);
|
||||
RespawnShuttle.Load(false);
|
||||
RespawnShuttle = new Submarine(shuttleInfo, true);
|
||||
RespawnShuttle.PhysicsBody.FarseerBody.OnCollision += OnShuttleCollision;
|
||||
|
||||
//prevent wifi components from communicating between the respawn shuttle and other subs
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
return (a == null) == (b == null);
|
||||
}
|
||||
return a.ToString().Equals(b.ToString(), StringComparison.InvariantCulture);
|
||||
return a.ToString().Equals(b.ToString(), StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,6 +608,13 @@ namespace Barotrauma.Networking
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(false, true)]
|
||||
public bool DisableBotConversations
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float SelectedLevelDifficulty
|
||||
{
|
||||
get { return selectedLevelDifficulty; }
|
||||
@@ -759,7 +766,7 @@ namespace Barotrauma.Networking
|
||||
private set;
|
||||
}
|
||||
|
||||
[Serialize(120.0f, true)]
|
||||
[Serialize(600.0f, true)]
|
||||
public float KickAFKTime
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace Barotrauma.Steam
|
||||
|
||||
public const string MetadataFileName = "filelist.xml";
|
||||
|
||||
public const string CopyIndicatorFileName = ".copying";
|
||||
|
||||
private static readonly Dictionary<string, int> tagCommonness = new Dictionary<string, int>()
|
||||
{
|
||||
{ "submarine", 10 },
|
||||
@@ -70,27 +72,28 @@ namespace Barotrauma.Steam
|
||||
return Steamworks.SteamClient.Name;
|
||||
}
|
||||
|
||||
public static void OverlayCustomURL(string url)
|
||||
{
|
||||
if (!isInitialized || !Steamworks.SteamClient.IsValid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Steamworks.SteamFriends.OpenWebOverlay(url);
|
||||
}
|
||||
|
||||
public static bool UnlockAchievement(string achievementName)
|
||||
public static bool OverlayCustomURL(string url)
|
||||
{
|
||||
if (!isInitialized || !Steamworks.SteamClient.IsValid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DebugConsole.Log("Unlocked achievement \"" + achievementName + "\"");
|
||||
Steamworks.SteamFriends.OpenWebOverlay(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool UnlockAchievement(string achievementIdentifier)
|
||||
{
|
||||
if (!isInitialized || !Steamworks.SteamClient.IsValid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DebugConsole.Log("Unlocked achievement \"" + achievementIdentifier + "\"");
|
||||
|
||||
var achievements = Steamworks.SteamUserStats.Achievements.ToList();
|
||||
int achIndex = achievements.FindIndex(ach => ach.Name == achievementName);
|
||||
int achIndex = achievements.FindIndex(ach => ach.Identifier == achievementIdentifier);
|
||||
bool unlocked = achIndex >= 0 ? achievements[achIndex].Trigger() : false;
|
||||
if (!unlocked)
|
||||
{
|
||||
@@ -99,7 +102,7 @@ namespace Barotrauma.Steam
|
||||
//(discovered[whateverbiomewasentered], kill[withwhateveritem], kill[somemonster] etc) so that we can add
|
||||
//some types of new achievements without the need for client-side changes.
|
||||
#if DEBUG
|
||||
DebugConsole.NewMessage("Failed to unlock achievement \"" + achievementName + "\".");
|
||||
DebugConsole.NewMessage("Failed to unlock achievement \"" + achievementIdentifier + "\".");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -159,8 +162,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 +183,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user