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:
@@ -280,7 +280,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (!PlayerInput.LeftButtonDown())
|
||||
{
|
||||
panel.Item.NewComponentEvent(panel, true);
|
||||
panel.Item.NewComponentEvent(panel, true, true);
|
||||
draggingConnected = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Barotrauma.Items.Components
|
||||
CleanNodes();
|
||||
}
|
||||
|
||||
if (!loading) Item.NewComponentEvent(this, true);
|
||||
if (!loading) Item.NewComponentEvent(this, true, true);
|
||||
}
|
||||
|
||||
public override void Equip(Character character)
|
||||
@@ -200,7 +200,7 @@ namespace Barotrauma.Items.Components
|
||||
if (Nodes.Count > 1)
|
||||
{
|
||||
Nodes.RemoveAt(Nodes.Count - 1);
|
||||
item.NewComponentEvent(this, true);
|
||||
item.NewComponentEvent(this, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,8 +409,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
{
|
||||
message.Write(Nodes.Count);
|
||||
for (int i = 0; i < Nodes.Count; i++)
|
||||
message.Write((byte)Math.Min(Nodes.Count, 10));
|
||||
for (int i = 0; i < Math.Min(Nodes.Count,10); i++)
|
||||
{
|
||||
message.Write(Nodes[i].X);
|
||||
message.Write(Nodes[i].Y);
|
||||
@@ -420,8 +420,8 @@ namespace Barotrauma.Items.Components
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
{
|
||||
Nodes.Clear();
|
||||
int nodeCount = message.ReadInt32();
|
||||
for (int i = 0; i < nodeCount; i++)
|
||||
int nodeCount = message.ReadByte();
|
||||
for (int i = 0; i<nodeCount; i++)
|
||||
{
|
||||
Nodes.Add(new Vector2(message.ReadFloat(), message.ReadFloat()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user