public Connected(int bId1, bool isP1, int bId2, bool isP2, Cable visual = null)
            {
                if (bId1 < bId2)
                {
                    t1 = new ConnectionTerminal {
                        batteryId = bId1, isPositive = isP1
                    };
                    t2 = new ConnectionTerminal {
                        batteryId = bId2, isPositive = isP2
                    };
                }
                else if (bId1 > bId2)
                {
                    t2 = new ConnectionTerminal {
                        batteryId = bId1, isPositive = isP1
                    };
                    t1 = new ConnectionTerminal {
                        batteryId = bId2, isPositive = isP2
                    };
                }
                else
                {
                    Debug.LogException(new Exception("Adding connection with both terminals on same battery"));
                }

                connection = visual;
            }
        private void MakeConnection(ClickableObject aOb, ClickableObject bOb)
        {
            Debug.Assert(newCable.objectFrom == aOb.transform, "MakeConnection: start connector doesn't match");

            newCable.objectTo = bOb.transform;
            newCable.UpdateConnection();

            bool shortCircuit = false, madeConnection = false;

            if (int.TryParse(aOb.transform.parent.name, out int idA) &&
                int.TryParse(bOb.transform.parent.name, out int idB))
            {
                bool isP1 = (aOb.name == "TerminalPositive");
                bool isP2 = (bOb.name == "TerminalPositive");

                madeConnection = true;

                if (idA != idB)
                {
                    Connected newCon = new Connected(idA, isP1, idB, isP2, newCable);
                    if (!connectedList.Contains(newCon))
                    {
                        connectedList.Add(newCon);
                    }
                    // Otherwise let it dangle
                }
                else
                {
                    shortCircuit = true; // Same battery means short
                    shortCircuitFx.SetActive(true);
                    Destroy(newCable);
                }
                connectedList.Sort();
            }
            else
            {
                Debug.LogError("Evaluating connectors without valid parent IDs convertable to integers");
            }

            if (madeConnection) // only if connection made, otherwise continue to look for endpoint
            {
                newCable = null;
            }

            if (shortCircuit)
            {
                ShortCircuit(idA);
            }
        }
        private void Select(ClickableObject obj)
        {
            ClickableObject prevSelected = selected;

            selected = obj;

            if (selected)
            {
                if (prevSelected)
                {
                    if (prevSelected == selected)
                    {
                        Destroy(newCable);
                        newCable = null;
                    }
                    else
                    {
                        MakeConnection(prevSelected, selected);
                    }

                    prevSelected = selected = null;
                }
                else
                {
                    // Start of connection
                    newCable = Instantiate(cableTemplate, connections) as Cable;
                    newCable.gameObject.SetActive(true);
                    newCable.objectFrom = obj.transform;

                    beamLengthAtTerminal = Vector3.Distance(obj.transform.position, ControllerInput.Instance.ControllerPosition);
                }
            }

            foreach (ClickableObject s in selectables)
            {
                s.Select(s == selected);
            }
        }