StretchyTanks.StretchyTanks.detectNewAttach C# (CSharp) Method

detectNewAttach() public method

public detectNewAttach ( ) : bool
return bool
        public bool detectNewAttach()
        {
            bool detected = false;
            if (part.findAttachNode("top").attachedPart != null)
            {
                if (attachTop == false)
                {
                    attachTop = true;
                    detected = true;
                }
            }
            else
            {
                attachTop = false;
            }
            if (part.findAttachNode("bottom").attachedPart != null)
            {
                if (attachBottom == false)
                {
                    attachBottom = true;
                    detected = true;
                }
            }
            else
            {
                attachBottom = false;
            }

            // update node list
            nodeList.RemoveAll(n => !part.children.Exists(p => p.uid == n.id));
            foreach (Part p in part.children)
            {
                if (p.attachMode == AttachModes.SRF_ATTACH)
                {
                    if (!nodeList.Exists(x => x.id == p.uid))
                    {
                        nodeList.Add(newSurfaceNode(p));
                        detected = true;
                    }
                }
            }
            return detected;
        }