This commit is contained in:
Evil Factory
2022-06-15 13:26:49 -03:00
410 changed files with 11140 additions and 5815 deletions
@@ -15,7 +15,8 @@ namespace Barotrauma.Items.Components
for (int i = 0; i < Connections.Count; i++)
{
wires[i] = new List<Wire>();
for (int j = 0; j < Connections[i].MaxWires; j++)
uint wireCount = msg.ReadVariableUInt32();
for (int j = 0; j < wireCount; j++)
{
ushort wireId = msg.ReadUInt16();
@@ -91,12 +92,8 @@ namespace Barotrauma.Items.Components
//go through existing wire links
for (int i = 0; i < Connections.Count; i++)
{
int j = -1;
foreach (Wire existingWire in Connections[i].Wires)
foreach (Wire existingWire in Connections[i].Wires.ToArray())
{
j++;
if (existingWire == null) { continue; }
//existing wire not in the list of new wires -> disconnect it
if (!wires[i].Contains(existingWire))
{
@@ -163,7 +160,7 @@ namespace Barotrauma.Items.Components
}*/
}
Connections[i].SetWire(j, null);
Connections[i].DisconnectWire(existingWire);
}
}
}
@@ -26,26 +26,34 @@ namespace Barotrauma.Items.Components
{
for (int i = 0; i < customInterfaceElementList.Count; i++)
{
if (customInterfaceElementList[i].HasPropertyName)
var element = customInterfaceElementList[i];
if (element.HasPropertyName)
{
if (!customInterfaceElementList[i].IsIntegerInput)
if (!element.IsNumberInput)
{
TextChanged(customInterfaceElementList[i], elementValues[i]);
TextChanged(element, elementValues[i]);
}
else
{
int.TryParse(elementValues[i], out int value);
ValueChanged(customInterfaceElementList[i], value);
switch (element.NumberType)
{
case NumberType.Int when int.TryParse(elementValues[i], out int value):
ValueChanged(element, value);
break;
case NumberType.Float when TryParseFloatInvariantCulture(elementValues[i], out float value):
ValueChanged(element, value);
break;
}
}
}
else if (customInterfaceElementList[i].ContinuousSignal)
else if (element.ContinuousSignal)
{
TickBoxToggled(customInterfaceElementList[i], elementStates[i]);
TickBoxToggled(element, elementStates[i]);
}
else if (elementStates[i])
{
clickedButton = customInterfaceElementList[i];
ButtonClicked(customInterfaceElementList[i]);
clickedButton = element;
ButtonClicked(element);
}
}
}
@@ -61,13 +69,14 @@ namespace Barotrauma.Items.Components
//extradata contains an array of buttons clicked by a client (or nothing if nothing was clicked)
for (int i = 0; i < customInterfaceElementList.Count; i++)
{
if (customInterfaceElementList[i].HasPropertyName)
var element = customInterfaceElementList[i];
if (element.HasPropertyName)
{
msg.Write(customInterfaceElementList[i].Signal);
msg.Write(element.Signal);
}
else if (customInterfaceElementList[i].ContinuousSignal)
else if(element.ContinuousSignal)
{
msg.Write(customInterfaceElementList[i].State);
msg.Write(element.State);
}
else
{