Banning players, networkevent refactoring, wire syncing bugfixes, wrenches can be used as a melee weapon, proper error message for invalid IPs, drawing held items in correct position, fixed client crashing if sending a chatmessage while connection is lost

This commit is contained in:
Regalis
2015-10-22 01:04:42 +03:00
parent 313d16d886
commit 51e68f0949
28 changed files with 520 additions and 154 deletions

View File

@@ -73,12 +73,12 @@ namespace Barotrauma.Networking
spriteBatch.DrawString(GUI.SmallFont,
"Peak received: "+graphs[(int)NetStatType.ReceivedBytes].LargestValue()+" bytes/s " +
"Avg received: " + graphs[(int)NetStatType.ReceivedBytes].LargestValue()/Graph.ArraySize + " bytes/s",
"Avg received: " + graphs[(int)NetStatType.ReceivedBytes].Average() + " bytes/s",
new Vector2(rect.X + 10, rect.Y+10), Color.Cyan);
spriteBatch.DrawString(GUI.SmallFont, "Peak sent: " + graphs[(int)NetStatType.SentBytes].LargestValue() + " bytes/s " +
"Avg sent: " + graphs[(int)NetStatType.SentBytes].LargestValue()/Graph.ArraySize + " bytes/s",
"Avg sent: " + graphs[(int)NetStatType.SentBytes].Average() + " bytes/s",
new Vector2(rect.X + 10, rect.Y + 30), Color.Orange);
spriteBatch.DrawString(GUI.SmallFont, "Peak resent: " + graphs[(int)NetStatType.ResentMessages].LargestValue() + " messages/s",
@@ -107,6 +107,11 @@ namespace Barotrauma.Networking
return maxValue;
}
public float Average()
{
return values.Average();
}
public void Update(float newValue)
{
for (int i = values.Length-1; i > 0; i--)