Esempio n. 1
0
        public ModuleKISPickup GetActivePickupNearest(Vector3 position, bool canPartAttachOnly = false, bool canStaticAttachOnly = false)
        {
            ModuleKISPickup        nearestPModule  = null;
            float                  nearestDistance = Mathf.Infinity;
            List <ModuleKISPickup> pickupModules   = FlightGlobals.ActiveVessel.FindPartModulesImplementing <ModuleKISPickup>();

            foreach (ModuleKISPickup pickupModule in pickupModules)
            {
                float partDist = Vector3.Distance(pickupModule.part.transform.position, position);
                if (partDist <= nearestDistance)
                {
                    if (canPartAttachOnly == false && canStaticAttachOnly == false)
                    {
                        nearestDistance = partDist;
                        nearestPModule  = pickupModule;
                    }
                    else if (canPartAttachOnly == true && pickupModule.allowPartAttach)
                    {
                        nearestDistance = partDist;
                        nearestPModule  = pickupModule;
                    }
                    else if (canStaticAttachOnly == true && pickupModule.allowStaticAttach)
                    {
                        nearestDistance = partDist;
                        nearestPModule  = pickupModule;
                    }
                }
            }
            return(nearestPModule);
        }
Esempio n. 2
0
 public void Drop(Part part, Part fromPart)
 {
     if (!KISAddonPointer.isRunning)
     {
         ModuleKISPickup pickupModule = GetActivePickupNearest(fromPart);
         if (pickupModule)
         {
             KISAddonPointer.allowPart  = KISAddonPointer.allowEva = KISAddonPointer.allowMount = KISAddonPointer.allowStatic = true;
             KISAddonPointer.allowStack = pickupModule.allowPartStack;
             KISAddonPointer.maxDist    = pickupModule.maxDistance;
             if (draggedItem != null)
             {
                 KISAddonPointer.scale = draggedItem.GetScale();
             }
             else
             {
                 KISAddonPointer.scale = 1;
             }
             KISAddonPointer.StartPointer(part, OnPointerAction, OnPointerState, pickupModule.transform);
             pointerMode = PointerMode.Drop;
         }
         else
         {
             KIS_Shared.DebugError("No active pickup nearest !");
         }
     }
     KISAddonCursor.StopPartDetection();
 }
Esempio n. 3
0
        private void MoveDrop(Part tgtPart, Vector3 pos, Quaternion rot)
        {
            KIS_Shared.DebugLog("Move part");
            ModuleKISPickup modulePickup = GetActivePickupNearest(pos);

            if (modulePickup)
            {
                if (movingPart.parent)
                {
                    bool movingPartMounted   = false;
                    ModuleKISPartMount partM = movingPart.parent.GetComponent <ModuleKISPartMount>();
                    if (partM)
                    {
                        if (partM.PartIsMounted(movingPart))
                        {
                            movingPartMounted = true;
                        }
                    }
                    if (!movingPartMounted)
                    {
                        AudioSource.PlayClipAtPoint(GameDatabase.Instance.GetAudioClip(modulePickup.detachPartSndPath), movingPart.transform.position);
                    }
                }
                AudioSource.PlayClipAtPoint(GameDatabase.Instance.GetAudioClip(modulePickup.dropSndPath), pos);
            }
            KIS_Shared.DecoupleFromAll(movingPart);
            movingPart.transform.position = pos;
            movingPart.transform.rotation = rot;
            KIS_Shared.SendKISMessage(movingPart, KIS_Shared.MessageAction.DropEnd, KISAddonPointer.GetCurrentAttachNode(), tgtPart);
            KISAddonPointer.StopPointer();
            movingPart = null;
        }
Esempio n. 4
0
        public override void OnUnEquip(KIS_Item item)
        {
            ModuleKISPickup pickupModule = item.inventory.part.GetComponent <ModuleKISPickup>();

            if (pickupModule)
            {
                pickupModule.allowPartAttach   = orgToolPartAttach;
                pickupModule.allowStaticAttach = orgToolStaticAttach;
                pickupModule.allowPartStack    = orgToolPartStack;

                pickupModule.attachPartSndPath = orgAttachPartSndPath;
                pickupModule.detachPartSndPath = orgDetachPartSndPath;

                pickupModule.attachStaticSndPath = orgAttachStaticSndPath;
                pickupModule.detachStaticSndPath = orgDetachStaticSndPath;
            }
        }
Esempio n. 5
0
        private Part CreateDrop(Part tgtPart, Vector3 pos, Quaternion rot)
        {
            KIS_Shared.DebugLog("Create & drop part");
            ModuleKISPickup modulePickup = GetActivePickupNearest(pos);

            draggedItem.StackRemove(1);
            Part newPart = KIS_Shared.CreatePart(draggedItem.partNode, pos, rot, draggedItem.inventory.part);

            KIS_Shared.SendKISMessage(newPart, KIS_Shared.MessageAction.DropEnd, KISAddonPointer.GetCurrentAttachNode(), tgtPart);
            KISAddonPointer.StopPointer();
            draggedItem = null;
            draggedPart = null;
            if (modulePickup)
            {
                AudioSource.PlayClipAtPoint(GameDatabase.Instance.GetAudioClip(modulePickup.dropSndPath), pos);
            }
            return(newPart);
        }
Esempio n. 6
0
 public void GroundDetach()
 {
     if (staticAttached)
     {
         KIS_Shared.DebugLog("Removing static rigidbody and fixed joint on " + this.part.partInfo.title);
         if (fixedJoint)
         {
             Destroy(fixedJoint);
         }
         if (connectedGameObject)
         {
             Destroy(connectedGameObject);
         }
         fixedJoint          = null;
         connectedGameObject = null;
         staticAttached      = false;
         ModuleKISPickup modulePickup = KISAddonPickup.instance.GetActivePickupNearest(this.transform.position);
         if (modulePickup)
         {
             KIS_Shared.PlaySoundAtPoint(modulePickup.detachStaticSndPath, this.transform.position);
         }
     }
 }
Esempio n. 7
0
        public void GroundAttach()
        {
            KIS_Shared.DebugLog("Create kinematic rigidbody");
            if (connectedGameObject)
            {
                Destroy(connectedGameObject);
            }
            GameObject obj = new GameObject("KISBody");

            obj.AddComponent <Rigidbody>();
            obj.rigidbody.mass        = 100;
            obj.rigidbody.isKinematic = true;
            obj.transform.position    = this.part.transform.position;
            obj.transform.rotation    = this.part.transform.rotation;
            connectedGameObject       = obj;

            KIS_Shared.DebugLog("Create fixed joint on the kinematic rigidbody");
            if (fixedJoint)
            {
                Destroy(fixedJoint);
            }
            FixedJoint CurJoint = this.part.gameObject.AddComponent <FixedJoint>();

            CurJoint.breakForce     = staticAttachBreakForce;
            CurJoint.breakTorque    = staticAttachBreakForce;
            CurJoint.connectedBody  = obj.rigidbody;
            fixedJoint              = CurJoint;
            this.part.vessel.Landed = true;
            staticAttached          = true;
            ModuleKISPickup modulePickup = KISAddonPickup.instance.GetActivePickupNearest(this.transform.position);

            if (modulePickup)
            {
                KIS_Shared.PlaySoundAtPoint(modulePickup.attachStaticSndPath, this.transform.position);
            }
        }
Esempio n. 8
0
        void OnMouseDetachPartClick(Part part)
        {
            if (KISAddonPointer.isRunning)
            {
                return;
            }
            if (hoverInventoryGui())
            {
                return;
            }
            if (!HighLogic.LoadedSceneIsFlight)
            {
                return;
            }
            if (!detachOk)
            {
                return;
            }
            if (!HasActivePickupInRange(part))
            {
                return;
            }
            detachActive = false;
            KISAddonCursor.StopPartDetection();
            KISAddonCursor.CursorDefault();
            ModuleKISItem item = part.GetComponent <ModuleKISItem>();

            if (item)
            {
                if (item.staticAttached)
                {
                    item.GroundDetach();
                    if (item.allowPartAttach == 1)
                    {
                        ModuleKISPickup pickupModule = GetActivePickupNearest(part);
                        KIS_Shared.PlaySoundAtPoint(pickupModule.detachStaticSndPath, pickupModule.part.transform.position);
                    }
                    if (item.allowPartAttach == 2)
                    {
                        ModuleKISPickup pickupModule = GetActivePickupNearest(part, canStaticAttachOnly: true);
                        KIS_Shared.PlaySoundAtPoint(pickupModule.detachStaticSndPath, pickupModule.part.transform.position);
                    }
                    return;
                }
            }

            part.decouple();

            if (item)
            {
                if (item.allowPartAttach == 1)
                {
                    ModuleKISPickup pickupModule = GetActivePickupNearest(part);
                    KIS_Shared.PlaySoundAtPoint(pickupModule.detachPartSndPath, pickupModule.part.transform.position);
                }
                if (item.allowPartAttach == 2)
                {
                    ModuleKISPickup pickupModule = GetActivePickupNearest(part, canPartAttachOnly: true);
                    KIS_Shared.PlaySoundAtPoint(pickupModule.detachPartSndPath, pickupModule.part.transform.position);
                }
            }
            else
            {
                ModuleKISPickup pickupModule = GetActivePickupNearest(part, canPartAttachOnly: true);
                KIS_Shared.PlaySoundAtPoint(pickupModule.detachPartSndPath, pickupModule.part.transform.position);
            }
        }
Esempio n. 9
0
        void OnMouseDetachEnterPart(Part part)
        {
            if (!detachActive)
            {
                return;
            }
            detachOk = false;
            if (!HighLogic.LoadedSceneIsFlight)
            {
                return;
            }
            if (KISAddonPointer.isRunning)
            {
                return;
            }
            if (hoverInventoryGui())
            {
                return;
            }
            if (draggedPart)
            {
                return;
            }
            ModuleKISPartDrag  pDrag       = part.GetComponent <ModuleKISPartDrag>();
            ModuleKISItem      item        = part.GetComponent <ModuleKISItem>();
            ModuleKISPartMount parentMount = null;

            if (part.parent)
            {
                parentMount = part.parent.GetComponent <ModuleKISPartMount>();
            }

            // Do nothing if part is EVA
            if (part.vessel.isEVA)
            {
                return;
            }

            // Check part distance
            if (!HasActivePickupInRange(part))
            {
                KISAddonCursor.CursorEnable("KIS/Textures/tooFar", "Too far", "(Move closer to the part)");
                return;
            }


            // Check if part is static attached
            if (item)
            {
                if (item.staticAttached)
                {
                    ModuleKISPickup pickupModule = GetActivePickupNearest(part, canStaticAttachOnly: true);
                    if ((item.allowStaticAttach == 1) || (pickupModule && item.allowStaticAttach == 2))
                    {
                        part.SetHighlightColor(XKCDColors.Periwinkle);
                        part.SetHighlight(true, false);
                        KISAddonCursor.CursorEnable("KIS/Textures/detachOk", "Detach from ground", '(' + part.partInfo.title + ')');
                        detachOk = true;
                        return;
                    }
                    else
                    {
                        if (FlightGlobals.ActiveVessel.isEVA)
                        {
                            KISAddonCursor.CursorEnable("KIS/Textures/needtool", "Tool needed", "(This part can't be detached from the ground without a tool)");
                            return;
                        }
                        else
                        {
                            KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Not supported", "(Detach from ground function is not supported on this part)");
                            return;
                        }
                    }
                }
            }


            // Check if part can be detached
            if (!parentMount)
            {
                if (part.children.Count > 0 || part.parent)
                {
                    //Part with a child or a parent
                    if (item)
                    {
                        if (item.allowPartAttach == 0)
                        {
                            KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Can't detach", "(This part can't be detached)");
                            return;
                        }
                        else if (item.allowPartAttach == 2)
                        {
                            ModuleKISPickup pickupModule = GetActivePickupNearest(part, canPartAttachOnly: true);
                            if (!pickupModule)
                            {
                                if (FlightGlobals.ActiveVessel.isEVA)
                                {
                                    KISAddonCursor.CursorEnable("KIS/Textures/needtool", "Tool needed", "(Part can't be detached without a tool)");
                                    return;
                                }
                                else
                                {
                                    KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Not supported", "(Detach function is not supported on this part)");
                                    return;
                                }
                            }
                        }
                    }
                    else
                    {
                        ModuleKISPickup pickupModule = GetActivePickupNearest(part, canPartAttachOnly: true);
                        if (!pickupModule)
                        {
                            if (FlightGlobals.ActiveVessel.isEVA)
                            {
                                KISAddonCursor.CursorEnable("KIS/Textures/needtool", "Tool needed", "(Part can't be detached without a tool)");
                                return;
                            }
                            else
                            {
                                KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Not supported", "(Detach function is not supported on this part)");
                                return;
                            }
                        }
                    }
                }
                else
                {
                    // Part without childs and parent
                    return;
                }
            }

            // Check if part is a root
            if (!part.parent)
            {
                KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Root part", "(Cannot detach a root part)");
                return;
            }

            // Detach icon
            part.SetHighlightColor(XKCDColors.Periwinkle);
            part.SetHighlight(true, false);
            part.parent.SetHighlightColor(XKCDColors.Periwinkle);
            part.parent.SetHighlight(true, false);
            KISAddonCursor.CursorEnable("KIS/Textures/detachOk", "Detach", '(' + part.partInfo.title + ')');
            detachOk = true;
        }
Esempio n. 10
0
        void OnMouseGrabEnterPart(Part part)
        {
            if (!grabActive)
            {
                return;
            }
            grabOk = false;
            if (!HighLogic.LoadedSceneIsFlight)
            {
                return;
            }
            if (KISAddonPointer.isRunning)
            {
                return;
            }
            if (hoverInventoryGui())
            {
                return;
            }
            if (draggedPart == part)
            {
                return;
            }
            ModuleKISPartDrag  pDrag       = part.GetComponent <ModuleKISPartDrag>();
            ModuleKISPartMount parentMount = null;

            if (part.parent)
            {
                parentMount = part.parent.GetComponent <ModuleKISPartMount>();
            }
            ModuleKISItem item = part.GetComponent <ModuleKISItem>();

            // Drag part over another one if possible (ex : mount)
            if (draggedPart && pDrag)
            {
                KISAddonCursor.CursorEnable(pDrag.dragIconPath, pDrag.dragText, '(' + pDrag.dragText2 + ')');
                return;
            }

            if (draggedPart)
            {
                KISAddonCursor.CursorDisable();
                return;
            }

            // Do nothing if part is EVA
            if (part.vessel.isEVA)
            {
                return;
            }

            // Check part distance
            if (!HasActivePickupInRange(part))
            {
                KISAddonCursor.CursorEnable("KIS/Textures/tooFar", "Too far", "(Move closer to the part)");
                return;
            }

            // Check part mass
            float pMass         = (part.mass + part.GetResourceMass());
            float pickupMaxMass = GetAllPickupMaxMassInRange(part);

            if (pMass > pickupMaxMass)
            {
                KISAddonCursor.CursorEnable("KIS/Textures/tooHeavy", "Too heavy", "(Bring more kerbal [" + pMass + " > " + pickupMaxMass + ")");
                return;
            }

            // Check if part can be detached and grabbed
            if (!parentMount)
            {
                if (part.children.Count > 0 || part.parent)
                {
                    //Part with a child or a parent
                    if (item)
                    {
                        if (item.allowPartAttach == 0)
                        {
                            KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Can't grab", "(This part can't be detached)");
                            return;
                        }
                        else if (item.allowPartAttach == 2)
                        {
                            ModuleKISPickup pickupModule = GetActivePickupNearest(part, canPartAttachOnly: true);
                            if (!pickupModule)
                            {
                                if (FlightGlobals.ActiveVessel.isEVA)
                                {
                                    KISAddonCursor.CursorEnable("KIS/Textures/needtool", "Tool needed", "(This part can't be detached without a tool)");
                                    return;
                                }
                                else
                                {
                                    KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Not supported", "(Detach function is not supported on this part)");
                                    return;
                                }
                            }
                        }
                    }
                    else
                    {
                        ModuleKISPickup pickupModule = GetActivePickupNearest(part, canPartAttachOnly: true);
                        if (!pickupModule)
                        {
                            if (FlightGlobals.ActiveVessel.isEVA)
                            {
                                KISAddonCursor.CursorEnable("KIS/Textures/needtool", "Tool needed", "(This part can't be detached without a tool)");
                                return;
                            }
                            else
                            {
                                KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Not supported", "(Detach function is not supported on this part)");
                                return;
                            }
                        }
                    }
                }
                else
                {
                    // Part without childs and parent
                    if (item)
                    {
                        if (item.staticAttached && item.allowStaticAttach == 2)
                        {
                            ModuleKISPickup pickupModule = GetActivePickupNearest(part, canStaticAttachOnly: true);
                            if (!pickupModule)
                            {
                                if (FlightGlobals.ActiveVessel.isEVA)
                                {
                                    KISAddonCursor.CursorEnable("KIS/Textures/needtool", "Tool needed", "(This part can't be detached from the ground without a tool)");
                                    return;
                                }
                                else
                                {
                                    KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Not supported", "(Detach from ground function is not supported on this part)");
                                    return;
                                }
                            }
                        }
                    }
                }
            }

            // check number of part attached
            if (part.parent)
            {
                if (part.children.Count > 0)
                {
                    KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Can't grab", "(" + (part.children.Count + 1) + " parts is attached to it)");
                    return;
                }
            }
            else
            {
                if (part.children.Count > 1)
                {
                    KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Can't grab", "(" + part.children.Count + " parts is attached to it)");
                    return;
                }
            }

            // Grab icon
            if (part.children.Count > 0 || part.parent)
            {
                KISAddonCursor.CursorEnable("KIS/Textures/grabOk", "Detach & Grab", '(' + part.partInfo.title + ')');
            }
            else
            {
                KISAddonCursor.CursorEnable("KIS/Textures/grabOk", "Grab", '(' + part.partInfo.title + ')');
            }

            part.SetHighlight(true, false);
            grabOk = true;
        }
Esempio n. 11
0
        private void OnPointerAction(KISAddonPointer.PointerTarget pointerTarget, Vector3 pos, Quaternion rot, Part tgtPart, string srcAttachNodeID = null, AttachNode tgtAttachNode = null)
        {
            if (pointerTarget == KISAddonPointer.PointerTarget.PartMount)
            {
                if (movingPart)
                {
                    MoveAttach(tgtPart, pos, rot, srcAttachNodeID, tgtAttachNode);
                }
                else
                {
                    CreateAttach(tgtPart, pos, rot, srcAttachNodeID, tgtAttachNode);
                }
                ModuleKISPartMount pMount = tgtPart.GetComponent <ModuleKISPartMount>();
                if (pMount)
                {
                    pMount.sndFxStore.audio.Play();
                }
            }

            if (pointerTarget == KISAddonPointer.PointerTarget.Part ||
                pointerTarget == KISAddonPointer.PointerTarget.PartNode ||
                pointerTarget == KISAddonPointer.PointerTarget.Static ||
                pointerTarget == KISAddonPointer.PointerTarget.KerbalEva)
            {
                if (pointerMode == PointerMode.Drop)
                {
                    if (movingPart)
                    {
                        MoveDrop(tgtPart, pos, rot);
                    }
                    else
                    {
                        CreateDrop(tgtPart, pos, rot);
                    }
                }
                if (pointerMode == PointerMode.Attach)
                {
                    if (movingPart)
                    {
                        MoveAttach(tgtPart, pos, rot, srcAttachNodeID, tgtAttachNode);
                    }
                    else
                    {
                        CreateAttach(tgtPart, pos, rot, srcAttachNodeID, tgtAttachNode);
                    }
                    // sound
                    ModuleKISPickup modulePickup = GetActivePickupNearest(pos);
                    if (tgtPart)
                    {
                        if (modulePickup)
                        {
                            AudioSource.PlayClipAtPoint(GameDatabase.Instance.GetAudioClip(modulePickup.attachPartSndPath), pos);
                        }
                    }
                }
            }
            draggedItem = null;
            draggedPart = null;
            movingPart  = null;
            KISAddonCursor.CursorDefault();
        }
Esempio n. 12
0
        public void Awake()
        {
            // Set inventory module for every eva kerbal
            KIS_Shared.DebugLog("Set KIS config...");
            ConfigNode nodeSettings = GameDatabase.Instance.GetConfigNode("KIS/settings/KISConfig");

            if (nodeSettings == null)
            {
                KIS_Shared.DebugError("KIS settings.cfg not found or invalid !");
                return;
            }

            // Set global settings
            ConfigNode nodeGlobal = nodeSettings.GetNode("Global");

            if (nodeGlobal.HasValue("itemDebug"))
            {
                ModuleKISInventory.debugContextMenu = bool.Parse(nodeGlobal.GetValue("itemDebug"));
            }
            if (nodeGlobal.HasValue("breathableAtmoPressure"))
            {
                breathableAtmoPressure = float.Parse(nodeGlobal.GetValue("breathableAtmoPressure"));
            }

            ConfigNode nodeEvaInventory    = nodeSettings.GetNode("EvaInventory");
            ConfigNode nodeEvaPickup       = nodeSettings.GetNode("EvaPickup");
            ConfigNode nodeStackable       = nodeSettings.GetNode("StackableItemOverride");
            ConfigNode nodeStackableModule = nodeSettings.GetNode("StackableModule");

            // Set stackable items list
            stackableList.Clear();
            foreach (string partName in nodeStackable.GetValues("partName"))
            {
                stackableList.Add(partName);
            }

            // Set stackable module list
            stackableModules.Clear();
            foreach (string moduleName in nodeStackableModule.GetValues("moduleName"))
            {
                stackableModules.Add(moduleName);
            }

            //-------Male Kerbal
            // Adding module to EVA cause an unknown error but work
            Part evaPrefab = PartLoader.getPartInfoByName("kerbalEVA").partPrefab;

            try { evaPrefab.AddModule("ModuleKISInventory"); }
            catch {}
            try { evaPrefab.AddModule("ModuleKISPickup"); }
            catch { }

            // Set inventory module for eva
            ModuleKISInventory evaInventory = evaPrefab.GetComponent <ModuleKISInventory>();

            if (evaInventory)
            {
                if (nodeGlobal.HasValue("kerbalDefaultMass"))
                {
                    evaInventory.kerbalDefaultMass = float.Parse(nodeGlobal.GetValue("kerbalDefaultMass"));
                }
                SetInventoryConfig(nodeEvaInventory, evaInventory);
                evaInventory.invType = ModuleKISInventory.InventoryType.Eva;
                KIS_Shared.DebugLog("Eva inventory module loaded successfully");
            }

            // Set pickup module for eva
            ModuleKISPickup evaPickup = evaPrefab.GetComponent <ModuleKISPickup>();

            if (evaPickup)
            {
                if (nodeEvaPickup.HasValue("grabKey"))
                {
                    KISAddonPickup.grabKey = nodeEvaPickup.GetValue("grabKey");
                }
                if (nodeEvaPickup.HasValue("attachKey"))
                {
                    KISAddonPickup.attachKey = nodeEvaPickup.GetValue("attachKey");
                }
                if (nodeEvaPickup.HasValue("allowPartAttach"))
                {
                    evaPickup.allowPartAttach = bool.Parse(nodeEvaPickup.GetValue("allowPartAttach"));
                }
                if (nodeEvaPickup.HasValue("allowStaticAttach"))
                {
                    evaPickup.allowStaticAttach = bool.Parse(nodeEvaPickup.GetValue("allowStaticAttach"));
                }
                if (nodeEvaPickup.HasValue("allowPartStack"))
                {
                    evaPickup.allowPartStack = bool.Parse(nodeEvaPickup.GetValue("allowPartStack"));
                }
                if (nodeEvaPickup.HasValue("maxDistance"))
                {
                    evaPickup.maxDistance = float.Parse(nodeEvaPickup.GetValue("maxDistance"));
                }
                if (nodeEvaPickup.HasValue("grabMaxMass"))
                {
                    evaPickup.grabMaxMass = float.Parse(nodeEvaPickup.GetValue("grabMaxMass"));
                }
                if (nodeEvaPickup.HasValue("dropSndPath"))
                {
                    evaPickup.dropSndPath = nodeEvaPickup.GetValue("dropSndPath");
                }
                if (nodeEvaPickup.HasValue("attachPartSndPath"))
                {
                    evaPickup.attachPartSndPath = nodeEvaPickup.GetValue("attachPartSndPath");
                }
                if (nodeEvaPickup.HasValue("detachPartSndPath"))
                {
                    evaPickup.detachPartSndPath = nodeEvaPickup.GetValue("detachPartSndPath");
                }
                if (nodeEvaPickup.HasValue("attachStaticSndPath"))
                {
                    evaPickup.attachStaticSndPath = nodeEvaPickup.GetValue("attachStaticSndPath");
                }
                if (nodeEvaPickup.HasValue("detachStaticSndPath"))
                {
                    evaPickup.detachStaticSndPath = nodeEvaPickup.GetValue("detachStaticSndPath");
                }
                if (nodeEvaPickup.HasValue("draggedIconResolution"))
                {
                    KISAddonPickup.draggedIconResolution = int.Parse(nodeEvaPickup.GetValue("draggedIconResolution"));
                }
                KIS_Shared.DebugLog("Eva pickup module loaded successfully");
            }

            //-------Female Kerbal
            // Adding module to EVA cause an unknown error but work
            Part evaFemalePrefab = PartLoader.getPartInfoByName("kerbalEVAfemale").partPrefab;

            try { evaFemalePrefab.AddModule("ModuleKISInventory"); }
            catch { }
            try { evaFemalePrefab.AddModule("ModuleKISPickup"); }
            catch { }

            // Set inventory module for eva
            ModuleKISInventory evaFemaleInventory = evaFemalePrefab.GetComponent <ModuleKISInventory>();

            if (evaFemaleInventory)
            {
                if (nodeGlobal.HasValue("kerbalDefaultMass"))
                {
                    evaFemaleInventory.kerbalDefaultMass = float.Parse(nodeGlobal.GetValue("kerbalDefaultMass"));
                }
                SetInventoryConfig(nodeEvaInventory, evaFemaleInventory);
                evaFemaleInventory.invType = ModuleKISInventory.InventoryType.Eva;
                KIS_Shared.DebugLog("Eva inventory module loaded successfully");
            }

            // Set pickup module for eva
            ModuleKISPickup evaFemalePickup = evaFemalePrefab.GetComponent <ModuleKISPickup>();

            if (evaFemalePickup)
            {
                if (nodeEvaPickup.HasValue("grabKey"))
                {
                    KISAddonPickup.grabKey = nodeEvaPickup.GetValue("grabKey");
                }
                if (nodeEvaPickup.HasValue("attachKey"))
                {
                    KISAddonPickup.attachKey = nodeEvaPickup.GetValue("attachKey");
                }
                if (nodeEvaPickup.HasValue("allowPartAttach"))
                {
                    evaFemalePickup.allowPartAttach = bool.Parse(nodeEvaPickup.GetValue("allowPartAttach"));
                }
                if (nodeEvaPickup.HasValue("allowStaticAttach"))
                {
                    evaFemalePickup.allowStaticAttach = bool.Parse(nodeEvaPickup.GetValue("allowStaticAttach"));
                }
                if (nodeEvaPickup.HasValue("allowPartStack"))
                {
                    evaFemalePickup.allowPartStack = bool.Parse(nodeEvaPickup.GetValue("allowPartStack"));
                }
                if (nodeEvaPickup.HasValue("maxDistance"))
                {
                    evaFemalePickup.maxDistance = float.Parse(nodeEvaPickup.GetValue("maxDistance"));
                }
                if (nodeEvaPickup.HasValue("grabMaxMass"))
                {
                    evaFemalePickup.grabMaxMass = float.Parse(nodeEvaPickup.GetValue("grabMaxMass"));
                }
                if (nodeEvaPickup.HasValue("dropSndPath"))
                {
                    evaFemalePickup.dropSndPath = nodeEvaPickup.GetValue("dropSndPath");
                }
                if (nodeEvaPickup.HasValue("attachPartSndPath"))
                {
                    evaFemalePickup.attachPartSndPath = nodeEvaPickup.GetValue("attachPartSndPath");
                }
                if (nodeEvaPickup.HasValue("detachPartSndPath"))
                {
                    evaFemalePickup.detachPartSndPath = nodeEvaPickup.GetValue("detachPartSndPath");
                }
                if (nodeEvaPickup.HasValue("attachStaticSndPath"))
                {
                    evaFemalePickup.attachStaticSndPath = nodeEvaPickup.GetValue("attachStaticSndPath");
                }
                if (nodeEvaPickup.HasValue("detachStaticSndPath"))
                {
                    evaFemalePickup.detachStaticSndPath = nodeEvaPickup.GetValue("detachStaticSndPath");
                }
                if (nodeEvaPickup.HasValue("draggedIconResolution"))
                {
                    KISAddonPickup.draggedIconResolution = int.Parse(nodeEvaPickup.GetValue("draggedIconResolution"));
                }
                KIS_Shared.DebugLog("Eva pickup module loaded successfully");
            }

            // Set inventory module for every pod with crew capacity
            KIS_Shared.DebugLog("Loading pod inventory...");
            foreach (AvailablePart avPart in PartLoader.LoadedPartsList)
            {
                if (avPart.name == "kerbalEVA")
                {
                    continue;
                }
                if (avPart.name == "kerbalEVA_RD")
                {
                    continue;
                }
                if (avPart.name == "kerbalEVAfemale")
                {
                    continue;
                }
                if (!avPart.partPrefab)
                {
                    continue;
                }
                if (avPart.partPrefab.CrewCapacity < 1)
                {
                    continue;
                }
                KIS_Shared.DebugLog("Found part with CrewCapacity : " + avPart.name);


                for (int i = 0; i < avPart.partPrefab.CrewCapacity; i++)
                {
                    try
                    {
                        ModuleKISInventory moduleInventory = avPart.partPrefab.AddModule("ModuleKISInventory") as ModuleKISInventory;
                        SetInventoryConfig(nodeEvaInventory, moduleInventory);
                        moduleInventory.podSeat = i;
                        moduleInventory.invType = ModuleKISInventory.InventoryType.Pod;
                        KIS_Shared.DebugLog("Pod inventory module(s) for seat " + i + " loaded successfully");
                    }
                    catch
                    {
                        KIS_Shared.DebugWarning("Pod inventory module(s) for seat " + i + " can't be loaded !");
                    }
                }
            }
        }