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

@@ -125,10 +125,9 @@ namespace Barotrauma.Items.Components
{
Wire[] wires = Array.FindAll(c.Wires, w => w != null);
message.Write((byte)wires.Length);
for (int i = 0 ; i < c.Wires.Length; i++)
for (int i = 0 ; i < wires.Length; i++)
{
if (c.Wires[i] == null) continue;
message.Write(c.Wires[i].Item.ID);
message.Write(wires[i].Item.ID);
}
}
}
@@ -140,26 +139,22 @@ namespace Barotrauma.Items.Components
{
//int wireCount = c.Wires.Length;
c.ClearConnections();
try
byte wireCount = message.ReadByte();
for (int i = 0; i < wireCount; i++)
{
byte wireCount = message.ReadByte();
for (int i = 0; i < wireCount; i++)
{
ushort wireId = message.ReadUInt16();
ushort wireId = message.ReadUInt16();
Item wireItem = MapEntity.FindEntityByID(wireId) as Item;
if (wireItem == null) continue;
Item wireItem = MapEntity.FindEntityByID(wireId) as Item;
if (wireItem == null) continue;
Wire wireComponent = wireItem.GetComponent<Wire>();
if (wireComponent == null) continue;
Wire wireComponent = wireItem.GetComponent<Wire>();
if (wireComponent == null) continue;
c.Wires[i] = wireComponent;
wireComponent.Connect(c, false);
}
c.Wires[i] = wireComponent;
wireComponent.Connect(c, false);
}
catch { }
}
}
}