This commit is contained in:
Regalis
2016-02-20 21:52:05 +02:00
parent 619390ab72
commit 308ae7a8b0
19 changed files with 109 additions and 78 deletions
+1 -1
View File
@@ -527,7 +527,7 @@ namespace Barotrauma.Networking
case (byte)PacketTypes.Traitor:
string targetName = inc.ReadString();
new GUIMessageBox("You are the Traitor!", "Your secret task is to assassinate " + targetName + "!");
TraitorManager.CreateStartPopUp(targetName);
break;
case (byte)PacketTypes.ResendRequest:
+3 -48
View File
@@ -873,7 +873,7 @@ namespace Barotrauma.Networking
UpdateCrewFrame();
if (TraitorsEnabled == YesNoMaybe.Yes || (TraitorsEnabled == YesNoMaybe.Maybe && Rand.Range(0.0f, 1.0f)<0.5f))
if (TraitorsEnabled == YesNoMaybe.Yes || (TraitorsEnabled == YesNoMaybe.Maybe && Rand.Range(0.0f, 1.0f) < 0.5f))
{
TraitorManager = new TraitorManager(this);
}
@@ -1022,15 +1022,6 @@ namespace Barotrauma.Networking
if (gameStarted && client.Character != null)
{
if (GameMain.GameSession!=null && GameMain.GameSession.gameMode!=null)
{
//TraitorMode traitorMode = GameMain.GameSession.gameMode as TraitorMode;
//if (traitorMode!=null)
//{
// traitorMode.CharacterLeft(client.Character);
//}
}
client.Character.ClearInputs();
}
@@ -1106,45 +1097,9 @@ namespace Barotrauma.Networking
}
}
public void NewTraitor(out Character traitor, out Character target)
public void NewTraitor(Character traitor, Character target)
{
List<Character> characters = new List<Character>();
foreach (Client client in ConnectedClients)
{
if (!client.inGame || client.Character==null) continue;
characters.Add(client.Character);
}
if (myCharacter!= null) characters.Add(myCharacter);
if (characters.Count < 2)
{
traitor = null;
target = null;
return;
}
int traitorIndex = Rand.Range(0, characters.Count);
int targetIndex = Rand.Range(0, characters.Count);
while (targetIndex == traitorIndex)
{
targetIndex = Rand.Range(0, characters.Count);
}
traitor = characters[traitorIndex];
target = characters[targetIndex];
if (myCharacter==null)
{
new GUIMessageBox("New traitor", traitor.Info.Name + " is the traitor and the target is " + target.Info.Name+".");
}
else if (myCharacter == traitor)
{
new GUIMessageBox("You are the traitor!", "Your task is to assassinate " + target.Info.Name+".");
return;
}
Log(traitor.Info.Name + " is the traitor and the target is " + target.Info.Name, Color.Cyan);
Log(traitor.Name + " is the traitor and the target is " + target.Name, Color.Cyan);
Client traitorClient = null;
foreach (Client c in ConnectedClients)
+2 -2
View File
@@ -144,10 +144,10 @@ namespace Barotrauma.Networking
if (!e.FillNetworkData(eventType, message, data)) return false;
}
catch
catch (Exception exception)
{
#if DEBUG
DebugConsole.ThrowError("Failed to write network message for entity "+e.ToString());
DebugConsole.ThrowError("Failed to write network message for entity "+e.ToString(), exception);
#endif
return false;