- fixed light components throwing errors when receiving an invalid color value to the "set_color" input

- fixed it being possible to connect wires to more than two items by selecting another item while dragging the wire
- relay components break if too much power is directed through them
- relay components are active by default and the can be toggled on/off in the editor
- bool properties show as checkboxes in the editor
This commit is contained in:
Regalis
2016-03-17 19:16:21 +02:00
parent d6a57f9533
commit 20d61b0647
6 changed files with 120 additions and 60 deletions
@@ -86,13 +86,15 @@ namespace Barotrauma.Items.Components
if (connection == connections[1]) connections[1] = null;
}
public void Connect(Connection newConnection, bool addNode = true, bool loading = false)
public bool Connect(Connection newConnection, bool addNode = true, bool loading = false)
{
for (int i = 0; i < 2; i++)
{
if (connections[i] == newConnection) return;
if (connections[i] == newConnection) return false;
}
if (!connections.Any(c => c == null)) return false;
for (int i = 0; i < 2; i++)
{
if (connections[i] != null && connections[i].Item == newConnection.Item)
@@ -144,6 +146,8 @@ namespace Barotrauma.Items.Components
}
if (!loading) Item.NewComponentEvent(this, true, true);
return true;
}
public override void Equip(Character character)
@@ -163,8 +167,9 @@ namespace Barotrauma.Items.Components
public override void Drop(Character dropper)
{
ClearConnections();
IsActive = false;
IsActive = false;
}
public override void Update(float deltaTime, Camera cam)
@@ -329,6 +334,7 @@ namespace Barotrauma.Items.Components
}
if (!editing || !PlayerInput.MouseInsideWindow || !GameMain.EditMapScreen.WiringMode ) return;
if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null) return;
for (int i = 0; i < Nodes.Count; i++)
{