v0.3.3
This commit is contained in:
@@ -913,6 +913,13 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (selectedCharacter != null) DeselectCharacter();
|
||||
selectedConstruction = null;
|
||||
closestItem = null;
|
||||
closestCharacter = null;
|
||||
}
|
||||
|
||||
DisableControls = false;
|
||||
}
|
||||
@@ -1393,7 +1400,7 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
message.Write((byte)0);
|
||||
message.WriteRangedInteger((int)lastAttackCauseOfDeath, 0, Enum.GetValues(typeof(CauseOfDeath)).Length);
|
||||
message.WriteRangedInteger(0, Enum.GetValues(typeof(CauseOfDeath)).Length, (int)lastAttackCauseOfDeath);
|
||||
}
|
||||
|
||||
if (AnimController.StunTimer<=0.0f && bleeding<=0.0f && oxygen>99.0f)
|
||||
|
||||
@@ -328,7 +328,11 @@ namespace Barotrauma
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
if (headSprite != null) headSprite.Remove();
|
||||
//if (headSprite != null)
|
||||
//{
|
||||
// headSprite.Remove();
|
||||
// headSprite = null;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,11 +265,12 @@ namespace Barotrauma
|
||||
}
|
||||
public void ReceiveCommandInput(char command)
|
||||
{
|
||||
if (Text == null) Text = "";
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case '\b': //backspace
|
||||
if (Text.Length > 0)
|
||||
Text = Text.Substring(0, Text.Length - 1);
|
||||
if (Text.Length > 0) Text = Text.Substring(0, Text.Length - 1);
|
||||
break;
|
||||
//case '\r': //return
|
||||
// if (OnEnterPressed != null)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Barotrauma.Networking;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -10,46 +12,98 @@ namespace Barotrauma
|
||||
|
||||
public TraitorManager(GameServer server)
|
||||
{
|
||||
server.NewTraitor(out traitorCharacter, out targetCharacter);
|
||||
Start(server);
|
||||
}
|
||||
|
||||
private void Start(GameServer server)
|
||||
{
|
||||
if (server == null) return;
|
||||
|
||||
List<Character> characters = new List<Character>();
|
||||
foreach (Client client in server.ConnectedClients)
|
||||
{
|
||||
if (!client.inGame || client.Character==null) continue;
|
||||
characters.Add(client.Character);
|
||||
}
|
||||
|
||||
if (server.Character!= null) characters.Add(server.Character);
|
||||
|
||||
if (characters.Count < 2)
|
||||
{
|
||||
traitorCharacter = null;
|
||||
targetCharacter = 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);
|
||||
}
|
||||
|
||||
traitorCharacter = characters[traitorIndex];
|
||||
targetCharacter = characters[targetIndex];
|
||||
|
||||
if (server.Character == null)
|
||||
{
|
||||
new GUIMessageBox("New traitor", traitorCharacter.Name + " is the traitor and the target is " + targetCharacter.Name+".");
|
||||
}
|
||||
else if (server.Character == traitorCharacter)
|
||||
{
|
||||
CreateStartPopUp(traitorCharacter.Name);
|
||||
return;
|
||||
}
|
||||
|
||||
server.NewTraitor(traitorCharacter, targetCharacter);
|
||||
}
|
||||
|
||||
public static void CreateStartPopUp(string targetName)
|
||||
{
|
||||
new GUIMessageBox("You are the Traitor!",
|
||||
"Your secret task is to assassinate " + targetName + "! Discretion is an utmost concern; sinking the submarine and killing the entire crew "
|
||||
+ "will arouse suspicion amongst the Fleet. If possible, make the death look like an accident.", 400, 350);
|
||||
}
|
||||
|
||||
public string GetEndMessage()
|
||||
{
|
||||
if (GameMain.Server == null || traitorCharacter == null || targetCharacter == null) return "";
|
||||
|
||||
if (targetCharacter.IsDead)
|
||||
string endMessage = "";
|
||||
|
||||
if (targetCharacter.IsDead && !traitorCharacter.IsDead)
|
||||
{
|
||||
string endMessage = traitorCharacter.Name + " was a traitor! ";
|
||||
endMessage = traitorCharacter.Name + " was a traitor! ";
|
||||
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "His" : "Her";
|
||||
endMessage += " task was to assassinate " + targetCharacter.Name + ". The task was successful.";
|
||||
//End(endMessage);
|
||||
}
|
||||
else if (targetCharacter.IsDead && traitorCharacter.IsDead)
|
||||
{
|
||||
endMessage = traitorCharacter.Name + " was a traitor! ";
|
||||
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "His" : "Her";
|
||||
endMessage += " task was to assassinate " + targetCharacter.Name + ". The task was successful, but luckily the bastard didn't make it out alive either.";
|
||||
}
|
||||
else if (traitorCharacter.IsDead)
|
||||
{
|
||||
string endMessage = traitorCharacter.Name + " was a traitor! ";
|
||||
endMessage = traitorCharacter.Name + " was a traitor! ";
|
||||
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "His" : "Her";
|
||||
endMessage += " task was to assassinate " + targetCharacter.Name + ", but ";
|
||||
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "he" : "she";
|
||||
endMessage += " got " + ((traitorCharacter.Info.Gender == Gender.Male) ? "himself" : "herself");
|
||||
endMessage += " killed before completing it.";
|
||||
|
||||
return endMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
string endMessage = traitorCharacter.Name + " was a traitor! ";
|
||||
endMessage = traitorCharacter.Name + " was a traitor! ";
|
||||
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "His" : "Her";
|
||||
endMessage += " task was to assassinate " + targetCharacter.Name + ". ";
|
||||
endMessage += (Submarine.Loaded.AtEndPosition) ?
|
||||
"The task was unsuccessful - the has submarine reached its destination." :
|
||||
"The task was unsuccessful.";
|
||||
|
||||
return endMessage;
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
|
||||
return endMessage;
|
||||
}
|
||||
|
||||
//public void CharacterLeft(Character character)
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
message.WriteRangedInteger(-10,10,(int)(flowPercentage/10.0f));
|
||||
message.WriteRangedInteger(-10, 10, (int)(flowPercentage / 10.0f));
|
||||
message.Write(IsActive);
|
||||
message.WritePadBits();
|
||||
|
||||
|
||||
@@ -64,7 +64,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
panelTexture = Sprite.LoadTexture("Content/Items/connectionpanel.png");
|
||||
|
||||
connector = new Sprite(panelTexture, new Rectangle(448, 80, 64, 64), new Vector2(-32.0f, -32.0f), 0.0f);
|
||||
connector = new Sprite(panelTexture, new Rectangle(448, 80, 64, 64), Vector2.Zero, 0.0f);
|
||||
connector.Origin = new Vector2(32.0f, 32.0f);
|
||||
wireCorner = new Sprite(panelTexture, new Rectangle(448, 0, 64, 64), new Vector2(-32.0f, -32.0f), 0.0f);
|
||||
wireVertical = new Sprite(panelTexture, new Rectangle(480, 64, 16, 16), new Vector2(-8.0f, -8.0f), 0.0f);
|
||||
wireHorizontal = new Sprite(panelTexture, new Rectangle(496, 64, 16, 16), new Vector2(-8.0f, -8.0f), 0.0f);
|
||||
|
||||
@@ -57,7 +57,8 @@ namespace Barotrauma
|
||||
float[] leftDelta;
|
||||
float[] rightDelta;
|
||||
|
||||
float lastSentVolume;
|
||||
private float lastSentVolume;
|
||||
private float lastNetworkUpdate;
|
||||
|
||||
public List<Gap> ConnectedGaps;
|
||||
|
||||
@@ -705,7 +706,7 @@ namespace Barotrauma
|
||||
message.WriteRangedSingle(MathHelper.Clamp(volume/FullVolume, 0.0f, 1.5f), 0.0f, 1.5f, 6);
|
||||
|
||||
message.Write((byte)fireSources.Count, 4);
|
||||
for (int i = 0; i < Math.Min(fireSources.Count, 16) ;i++ )
|
||||
for (int i = 0; i < Math.Min(fireSources.Count, 16); i++)
|
||||
{
|
||||
var fireSource = fireSources[i];
|
||||
|
||||
@@ -725,6 +726,8 @@ namespace Barotrauma
|
||||
{
|
||||
data = null;
|
||||
|
||||
if (sendingTime < lastNetworkUpdate) return;
|
||||
|
||||
float newVolume = this.volume;
|
||||
|
||||
try
|
||||
@@ -785,6 +788,8 @@ namespace Barotrauma
|
||||
toBeRemoved[i].Remove(true);
|
||||
}
|
||||
fireSources = newFireSources;
|
||||
|
||||
lastNetworkUpdate = sendingTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -711,6 +711,8 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
Vector2 center = (topLeft + bottomRight) / 2.0f;
|
||||
center.X -= center.X % GridSize.X;
|
||||
center.Y -= center.Y % GridSize.Y;
|
||||
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -103,17 +103,17 @@ namespace Barotrauma
|
||||
}
|
||||
if (Submarine.SavedSubmarines.Count > 0) mapList.Select(Submarine.SavedSubmarines[0]);
|
||||
|
||||
new GUITextBlock(new Rectangle((int)(mapList.Rect.Width + 30), 0, 100, 20),
|
||||
new GUITextBlock(new Rectangle((int)(mapList.Rect.Width + 20), 0, 100, 20),
|
||||
"Save name: ", GUI.Style, Alignment.Left, Alignment.Left, menuTabs[(int)Tab.NewGame]);
|
||||
|
||||
saveNameBox = new GUITextBox(new Rectangle((int)(mapList.Rect.Width + 20), 30, 180, 20),
|
||||
saveNameBox = new GUITextBox(new Rectangle((int)(mapList.Rect.Width + 30), 30, 180, 20),
|
||||
Alignment.TopLeft, GUI.Style, menuTabs[(int)Tab.NewGame]);
|
||||
saveNameBox.Text = SaveUtil.CreateSavePath();
|
||||
|
||||
new GUITextBlock(new Rectangle((int)(mapList.Rect.Width + 30), 60, 100, 20),
|
||||
new GUITextBlock(new Rectangle((int)(mapList.Rect.Width + 20), 60, 100, 20),
|
||||
"Map Seed: ", GUI.Style, Alignment.Left, Alignment.Left, menuTabs[(int)Tab.NewGame]);
|
||||
|
||||
seedBox = new GUITextBox(new Rectangle((int)(mapList.Rect.Width + 20), 90, 180, 20),
|
||||
seedBox = new GUITextBox(new Rectangle((int)(mapList.Rect.Width + 30), 90, 180, 20),
|
||||
Alignment.TopLeft, GUI.Style, menuTabs[(int)Tab.NewGame]);
|
||||
seedBox.Text = ToolBox.RandomSeed(8);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user