KAS.KASModulePort.strutConnected C# (CSharp) Method

strutConnected() public method

public strutConnected ( ) : bool
return bool
        public bool strutConnected()
        {
            KASModuleStrut moduleStrut = this.part.GetComponent<KASModuleStrut>();
            if (moduleStrut) {
              if (moduleStrut.linkedStrutModule) {
            return true;
              }
            }
            return false;
        }

Usage Example

Example #1
0
        public void PlugHead(KASModulePort portModule, PlugState plugMode, bool fromSave = false, bool fireSound = true, bool alreadyDocked = false)
        {
            if (plugMode == PlugState.Locked || plugMode == PlugState.Deployed) return;

            if (!alreadyDocked)
            {
                if (portModule.strutConnected())
                {
                    ScreenMessages.PostScreenMessage(portModule.part.partInfo.title + " is already used !", 5, ScreenMessageStyle.UPPER_CENTER);
                    return;
                }
                if (portModule.plugState == KASModulePort.KASPlugState.PlugDock || portModule.plugState == KASModulePort.KASPlugState.PlugUndock)
                {
                    ScreenMessages.PostScreenMessage(portModule.part.partInfo.title + " is already used !", 5, ScreenMessageStyle.UPPER_CENTER);
                    return;
                }
                if (this.part.vessel == portModule.part.vessel && fromSave == false)
                {
                    plugMode = PlugState.PlugUndocked;
                }
            }

            if (!cableJoint) Deploy();
            DropHead();

            if (plugMode == PlugState.PlugUndocked)
            {
                KAS_Shared.DebugLog("PlugHead(Winch) - Plug using undocked mode");
                headState = PlugState.PlugUndocked;
                if (fireSound) portModule.fxSndPlug.audio.Play();
            }
            if (plugMode == PlugState.PlugDocked)
            {
                KAS_Shared.DebugLog("PlugHead(Winch) - Plug using docked mode");  
                // This should be safe even if already connected
                AttachDocked(portModule);
                // Remove joints between connector and winch
                KAS_Shared.RemoveAttachJointBetween(this.part, portModule.part);
                headState = PlugState.PlugDocked;
                //nodeConnectedPort = portModule;
                if (fireSound) portModule.fxSndPlugDocked.audio.Play();
            }


            KAS_Shared.DebugLog("PlugHead(Winch) - Moving head...");
            headTransform.rotation = Quaternion.FromToRotation(headPortNode.forward, -portModule.portNode.forward) * headTransform.rotation;
            headTransform.position = headTransform.position - (headPortNode.position - portModule.portNode.position);

            SetHeadToPhysic(false);
            // Parent port to head for moving port with the head
            portModule.part.transform.parent = headTransform;
            // Set cable joint connected body to eva
            SetCableJointConnectedBody(portModule.part.rigidbody);
            // Unparent eva to head
            portModule.part.transform.parent = null;

            headTransform.parent = portModule.part.transform;
            cableJointLength = cableRealLenght + 0.01f;

            // Set variables
            connectedPortInfo.module = portModule;
            portModule.winchConnected = this;
        }
All Usage Examples Of KAS.KASModulePort::strutConnected