void CircuitPart_onWireDirectionChanged(Wire w, Wire.WireDirection v_old, Wire.WireDirection v_new) { Recalculate = true; }
private void UpdateWiresConnectivity() { Wires[0].IsConnected = connectedLeft && connectedUp && leftUp; Wires[1].IsConnected = connectedLeft && connectedRight && leftRight; Wires[2].IsConnected = connectedLeft && connectedDown && leftDown; Wires[3].IsConnected = connectedUp && connectedRight && upRight; Wires[4].IsConnected = connectedUp && connectedDown && upDown; Wires[5].IsConnected = connectedRight && connectedDown && rightDown; Wire.WireDirection d = Wire.WireDirection.Both; //Wires[0] d = Wire.WireDirection.Both; if ((left & PortState.Input) == 0 || (up & PortState.Output) == 0) { d ^= Wire.WireDirection.J1ToJ2; } if ((left & PortState.Output) == 0 || (up & PortState.Input) == 0) { d ^= Wire.WireDirection.J2ToJ1; } Wires[0].Direction = d; //Wires[1] d = Wire.WireDirection.Both; if ((left & PortState.Input) == 0 || (right & PortState.Output) == 0) { d ^= Wire.WireDirection.J1ToJ2; } if ((left & PortState.Output) == 0 || (right & PortState.Input) == 0) { d ^= Wire.WireDirection.J2ToJ1; } Wires[1].Direction = d; //Wires[2] d = Wire.WireDirection.Both; if ((left & PortState.Input) == 0 || (down & PortState.Output) == 0) { d ^= Wire.WireDirection.J1ToJ2; } if ((left & PortState.Output) == 0 || (down & PortState.Input) == 0) { d ^= Wire.WireDirection.J2ToJ1; } Wires[2].Direction = d; //Wires[3] d = Wire.WireDirection.Both; if ((up & PortState.Input) == 0 || (right & PortState.Output) == 0) { d ^= Wire.WireDirection.J1ToJ2; } if ((up & PortState.Output) == 0 || (right & PortState.Input) == 0) { d ^= Wire.WireDirection.J2ToJ1; } Wires[3].Direction = d; //Wires[4] d = Wire.WireDirection.Both; if ((up & PortState.Input) == 0 || (down & PortState.Output) == 0) { d ^= Wire.WireDirection.J1ToJ2; } if ((up & PortState.Output) == 0 || (down & PortState.Input) == 0) { d ^= Wire.WireDirection.J2ToJ1; } Wires[4].Direction = d; //Wires[5] d = Wire.WireDirection.Both; if ((right & PortState.Input) == 0 || (down & PortState.Output) == 0) { d ^= Wire.WireDirection.J1ToJ2; } if ((right & PortState.Output) == 0 || (down & PortState.Input) == 0) { d ^= Wire.WireDirection.J2ToJ1; } Wires[5].Direction = d; }