Wire nodes are synced when a player adds a new node and when the wire is connected to something

This commit is contained in:
Joonas Rikkonen
2017-07-25 23:27:30 +03:00
parent 431e5bb9b8
commit f062ca0e4d
2 changed files with 7 additions and 4 deletions

View File

@@ -228,7 +228,7 @@ namespace Barotrauma.Items.Components
if (Connections[i].Wires.Contains(newWire)) continue;
Connections[i].TryAddLink(newWire);
newWire.Connect(Connections[i]);
newWire.Connect(Connections[i], true, true);
var otherConnection = newWire.OtherConnection(Connections[i]);

View File

@@ -227,14 +227,17 @@ namespace Barotrauma.Items.Components
{
if (character == Character.Controlled && character.SelectedConstruction != null) return false;
if (newNodePos!= Vector2.Zero && nodes.Count>0 && Vector2.Distance(newNodePos, nodes[nodes.Count - 1]) > nodeDistance)
if (newNodePos != Vector2.Zero && nodes.Count > 0 && Vector2.Distance(newNodePos, nodes[nodes.Count - 1]) > nodeDistance)
{
nodes.Add(newNodePos);
UpdateSections();
Drawable = true;
newNodePos = Vector2.Zero;
if (GameMain.Server != null)
{
item.CreateServerEvent(this);
}
}
return true;
}