public override void OnStart(PartModule.StartState state)
        {
            mStrut = part.FindModelTransform(strutName);

            StrutX            = mStrut.localScale.x;
            StrutY            = mStrut.localScale.y;
            mStrut.localScale = Vector3.zero;

            if (state == StartState.Editor)
            {
                return;
            }

            mRCO = part.FindModelTransform(rayCastOriginName);
            mST  = part.FindModelTransform(strutTargetName);

            if (ID == Guid.Empty)
            {
                ID = Guid.NewGuid();
            }

            if (Targeted)
            {
                SetTargetDSAtLoad();
            }
            else
            {
                mode = DSMode.UNLINKED;
            }
            started = true;
        }
        public void Unlink()
        {
            Targeted = false;
            mode     = DSMode.UNLINKED;

            Events["Unlink"].active = Events["Unlink"].guiActive = false;
        }
        public void Link()
        {
            foreach (Part p in vessel.parts)
            {
                if (p != part && p.Modules.Contains("ModuleDockingStrut"))
                {
                    DSUtil.setPossibleTarget(this, (p.Modules["ModuleDockingStrut"] as ModuleDockingStrut));
                }
            }

            mode = DSMode.TARGETING;

            Events["Link"].active = Events["Link"].guiActive = false;
        }
        public void Abort()
        {
            Targeted = false;
            mode     = DSMode.UNLINKED;

            foreach (Part p in vessel.parts)
            {
                if (p.Modules.Contains("ModuleDockingStrut"))
                {
                    (p.Modules["ModuleDockingStrut"] as ModuleDockingStrut).revertGUI();
                }
            }

            Events["Abort"].active = Events["Abort"].guiActive = false;
        }
        public void revertGUI()
        {
            if (Targeted)
            {
                mode = DSMode.LINKED;
            }
            else
            {
                mode = DSMode.UNLINKED;
            }

            foreach (BaseEvent e in Events)
            {
                e.active = e.guiActive = false;
            }
        }
 public void SetErrorMessage(String s)
 {
     mode = DSMode.INVALID;
     foreach (BaseEvent e in Events)
     {
         if (e.name.Equals("ErrorMessage"))
         {
             e.active  = e.guiActive = true;
             e.guiName = s;
         }
         else
         {
             e.active = e.guiActive = false;
         }
     }
 }
        public void SetTargetDSAtLoad()
        {
            if (vessel.GetDS(TargetID, out TargetDS))
            {
                CLAS = true;
            }
            else
            {
                foreach (BaseEvent e in Events)
                {
                    e.active = e.guiActive = false;
                }

                mode     = DSMode.UNLINKED;
                Targeted = false;
            }
        }
        public void SetTarget(ModuleDockingStrut PosTarget)
        {
            if (!DSUtil.checkPossibleTarget(this, PosTarget))
            {
                mode     = DSMode.UNLINKED;
                Targeted = false;
                return;
            }

            foreach (BaseEvent e in Events)
            {
                e.active = e.guiActive = false;
            }

            TargetDS = PosTarget;
            TargetID = TargetDS.ID;
            Targeted = true;
            mode     = DSMode.LINKED;

            SetStrutEnd(TargetDS.strutTarget);
        }
        public void Unlink()
        {
            Targeted = false;
            mode = DSMode.UNLINKED;

            Events["Unlink"].active = Events["Unlink"].guiActive = false;
        }
        public void SetTarget(ModuleDockingStrut PosTarget)
        {
            if (!DSUtil.checkPossibleTarget(this, PosTarget)) {
                mode = DSMode.UNLINKED;
                Targeted = false;
                return;
            }

            foreach (BaseEvent e in Events)
                e.active = e.guiActive = false;

            TargetDS = PosTarget;
            TargetID = TargetDS.ID;
            Targeted = true;
            mode = DSMode.LINKED;

            SetStrutEnd(TargetDS.strutTarget);
        }
        public void SetTargetDSAtLoad()
        {
            if (vessel.GetDS(TargetID, out TargetDS)){
                CLAS = true;
            } else {
                foreach (BaseEvent e in Events)
                    e.active = e.guiActive = false;

                mode = DSMode.UNLINKED;
                Targeted = false;
            }
        }
 public void SetErrorMessage(String s)
 {
     mode = DSMode.INVALID;
     foreach (BaseEvent e in Events) {
         if (e.name.Equals("ErrorMessage")) {
             e.active = e.guiActive = true;
             e.guiName = s;
         } else
             e.active = e.guiActive = false;
     }
 }
        public void revertGUI()
        {
            if (Targeted)
                mode = DSMode.LINKED;
            else
                mode = DSMode.UNLINKED;

            foreach (BaseEvent e in Events)
                e.active = e.guiActive = false;
        }
        public override void OnStart(PartModule.StartState state)
        {
            mStrut = part.FindModelTransform(strutName);

            StrutX = mStrut.localScale.x;
            StrutY = mStrut.localScale.y;
            mStrut.localScale = Vector3.zero;

            if (state == StartState.Editor) return;

            mRCO = part.FindModelTransform(rayCastOriginName);
            mST = part.FindModelTransform(strutTargetName);

            if (ID == Guid.Empty)
                ID = Guid.NewGuid();

            if (Targeted)
                SetTargetDSAtLoad();
            else
                mode = DSMode.UNLINKED;
            started = true;
        }
        public void Link()
        {
            foreach (Part p in vessel.parts) {
                if (p != part && p.Modules.Contains("ModuleDockingStrut"))
                    DSUtil.setPossibleTarget(this, (p.Modules["ModuleDockingStrut"] as ModuleDockingStrut));
            }

            mode = DSMode.TARGETING;

            Events["Link"].active = Events["Link"].guiActive = false;
        }
        public void Abort()
        {
            Targeted = false;
            mode = DSMode.UNLINKED;

            foreach (Part p in vessel.parts) {
                if (p.Modules.Contains("ModuleDockingStrut"))
                    (p.Modules["ModuleDockingStrut"] as ModuleDockingStrut).revertGUI();
            }

            Events["Abort"].active = Events["Abort"].guiActive = false;
        }