From 76ca2cd2c5fae469817e17ad04538a4c1d9adc5a Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 13 Apr 2014 17:35:03 +0400 Subject: [PATCH 01/22] Fix NRE when grabbing a stateful part from a container. Unlike Destroy(foo), foo.DestroyJoint() will crash if foo is null. --- Plugin/KASModuleGrab.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugin/KASModuleGrab.cs b/Plugin/KASModuleGrab.cs index 32145046..c8a07ca0 100644 --- a/Plugin/KASModuleGrab.cs +++ b/Plugin/KASModuleGrab.cs @@ -290,7 +290,8 @@ public void Grab(Vessel kerbalEvaVessel) } //Destroy joint to avoid buggy eva move - this.part.attachJoint.DestroyJoint(); + if (this.part.attachJoint) + this.part.attachJoint.DestroyJoint(); this.part.rigidbody.velocity = kerbalEvaVessel.rootPart.rigidbody.velocity; From 8d095d0fb6a6387d89c86e07483c7e7f55f956a9 Mon Sep 17 00:00:00 2001 From: KospY Date: Wed, 21 May 2014 22:14:26 +0200 Subject: [PATCH 02/22] Update LICENSE.md --- LICENSE.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 196bd20d..5456cf3e 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -6,19 +6,14 @@ * Config files, shaders, source code and compiled binaries are under copyright retained by KospY. **YOU MAY**: -- Distribute your own parts using the following part modules: - - `KASModuleGrab` - - `KASModuleContainer` - - `KASModulePartBay` - - `KASModulePort` +- Distribute your own parts using any part modules included in KAS. - Distribute video, screenshots or other media portraying unmodified versions of KAS in action. - Distribute modified or unmodified versions of the KAS plugin source code on condition that a link to this license is included. - Modify KAS in any way for personal use. - Request a waiver of any of these terms. **All other rights are reserved.** In particular, **YOU MAY NOT**: -- Distribute unmodified versions of KAS, in part or whole. -- Distribute modified versions of KAS, in part or whole, including the packaged models, textures, plugins, part configurations and any other component, with exception of plugin source code. +- Distribute modified or unmodified versions of KAS, in part or whole. - Use models, animations, textures or other assets from KAS, including by reference. - Use components of the KAS plugin, including parts and part modules, except where explicitly allowed. - Distribute a byte patch or other difference file or patcher intended to modify KAS files without directly distributing them. From cabef5dc33c59a68b9ec63598e94285bc5c2bbb5 Mon Sep 17 00:00:00 2001 From: Corey Cossentino Date: Sun, 31 Aug 2014 01:35:56 -0400 Subject: [PATCH 03/22] Spelling/grammar fixes for part descriptions --- Parts/cPort1/cPort1.cfg | 2 +- Parts/cPort2/cPort2.cfg | 2 +- Parts/hook_anchor/anchor.cfg | 2 +- Parts/hook_grapplingHook/grapplingHook.cfg | 2 +- Parts/hook_magnet/magnet.cfg | 2 +- Parts/pipe1/pipe1.cfg | 2 +- Parts/strut1/strut1.cfg | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Parts/cPort1/cPort1.cfg b/Parts/cPort1/cPort1.cfg index e689034f..fe3a8af0 100644 --- a/Parts/cPort1/cPort1.cfg +++ b/Parts/cPort1/cPort1.cfg @@ -21,7 +21,7 @@ category = Utility subcategory = 0 title = Radial connector port manufacturer = K.A.S. Manufacturing -description = A port for connecting a winch connector. Can be used for ressource transfer or towing. +description = A port for connecting a winch connector. Can be used for resource transfer or towing. attachRules = 1,1,0,0,1 TechRequired = advConstruction diff --git a/Parts/cPort2/cPort2.cfg b/Parts/cPort2/cPort2.cfg index 5f82dc0a..40507f97 100644 --- a/Parts/cPort2/cPort2.cfg +++ b/Parts/cPort2/cPort2.cfg @@ -20,7 +20,7 @@ category = Utility subcategory = 0 title = Stack connector port (0.5m) manufacturer = K.A.S. Manufacturing -description = A destination port for a connector. Use it for ressource transfer or towing heavy objects. Can also be used to lock parts when a winch cable is fully retracted. +description = A destination port for a connector. Use it for resource transfer or towing heavy objects. Can also be used to lock parts when a winch cable is fully retracted. // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision, allowDock, allowRotate attachRules = 1,0,1,1,0 diff --git a/Parts/hook_anchor/anchor.cfg b/Parts/hook_anchor/anchor.cfg index 077f60bb..ec382a14 100644 --- a/Parts/hook_anchor/anchor.cfg +++ b/Parts/hook_anchor/anchor.cfg @@ -20,7 +20,7 @@ category = Utility subcategory = 0 title = Anchor manufacturer = K.A.S. Manufacturing -description = An anchor to be used for boat, airship or everything else. In addition to its weight, it also provide drag and friction when touching the ground. +description = An anchor to be used for boat, airship or everything else. In addition to its weight, it also provides drag and friction when touching the ground. TechRequired = specializedControl entryCost = 50 diff --git a/Parts/hook_grapplingHook/grapplingHook.cfg b/Parts/hook_grapplingHook/grapplingHook.cfg index 14e7de15..21a3ce35 100644 --- a/Parts/hook_grapplingHook/grapplingHook.cfg +++ b/Parts/hook_grapplingHook/grapplingHook.cfg @@ -21,7 +21,7 @@ category = Utility subcategory = 0 title = Grappling hook manufacturer = K.A.S. Manufacturing -description = This hook will attach to everything it collide, as long as the impact is strong enough. Can be mounted on a winch. To be used with the winch eject function. +description = This hook will attach to everything it collides with, as long as the impact is strong enough. Can be mounted on a winch. To be used with the winch eject function. TechRequired = metaMaterials entryCost = 50 diff --git a/Parts/hook_magnet/magnet.cfg b/Parts/hook_magnet/magnet.cfg index b23424ef..d75d1f81 100644 --- a/Parts/hook_magnet/magnet.cfg +++ b/Parts/hook_magnet/magnet.cfg @@ -21,7 +21,7 @@ category = Utility subcategory = 0 title = Electro-Magnet manufacturer = K.A.S. Manufacturing -description = This electro-magnet is perfect for grabing heavy objects without a connector or a docking port. Can be mounted on a winch or on a hook support. +description = This electro-magnet is perfect for grabbing heavy objects without a connector or a docking port. Can be mounted on a winch or on a hook support. TechRequired = nanolathing entryCost = 50 diff --git a/Parts/pipe1/pipe1.cfg b/Parts/pipe1/pipe1.cfg index bf0bda2a..f384c6c3 100644 --- a/Parts/pipe1/pipe1.cfg +++ b/Parts/pipe1/pipe1.cfg @@ -21,7 +21,7 @@ category = Utility subcategory = 0 title = Pipe end point manufacturer = K.A.S. Manufacturing -description = End point for building pipes from eva. Can be used for linking different vessels. Usefull for making ground bases and transfering ressources. +description = End point for building pipes from EVA. Can be used for linking different vessels. Useful for making ground bases and transferring resources. // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision, allowDock, allowRotate attachRules = 1,1,0,0,1 diff --git a/Parts/strut1/strut1.cfg b/Parts/strut1/strut1.cfg index 4663ace8..2a363607 100644 --- a/Parts/strut1/strut1.cfg +++ b/Parts/strut1/strut1.cfg @@ -19,7 +19,7 @@ category = Utility subcategory = 0 title = Strut end point manufacturer = K.A.S. Manufacturing -description = End point for building a strut from eva. Links are restricted to the same vessel. Usefull for strengthen a vessel. +description = End point for building a strut from EVA. Links are restricted to the same vessel. Useful for strengthening a vessel. // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision, allowDock, allowRotate attachRules = 0,1,0,0,1 From f7ec89ccdcae07fabfc3fde6f0b810eac278b65c Mon Sep 17 00:00:00 2001 From: Corey Cossentino Date: Sun, 31 Aug 2014 02:58:29 -0400 Subject: [PATCH 04/22] Spelling fixes --- Plugin/KASAddonPointer.cs | 2 +- Plugin/KASModuleStrut.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugin/KASAddonPointer.cs b/Plugin/KASAddonPointer.cs index d7d71e96..f3624d73 100644 --- a/Plugin/KASAddonPointer.cs +++ b/Plugin/KASAddonPointer.cs @@ -415,7 +415,7 @@ private static void RotatePointer(float dist) public static void ShowAttachHelpMsg() { - ScreenMessages.PostScreenMessage("Attach pointer enabled. Press " + KASAddonControlKey.rotateLeftKey + "/" + KASAddonControlKey.rotateRightKey + " to rotate and mouse click to attach. Press echap, space, mouse2 or " + KASAddonControlKey.attachKey + " to cancel.", 5, ScreenMessageStyle.UPPER_CENTER); + ScreenMessages.PostScreenMessage("Attach pointer enabled. Press " + KASAddonControlKey.rotateLeftKey + "/" + KASAddonControlKey.rotateRightKey + " to rotate and mouse click to attach. Press escape, space, mouse2 or " + KASAddonControlKey.attachKey + " to cancel.", 5, ScreenMessageStyle.UPPER_CENTER); } } diff --git a/Plugin/KASModuleStrut.cs b/Plugin/KASModuleStrut.cs index 08954a1b..18fc803a 100644 --- a/Plugin/KASModuleStrut.cs +++ b/Plugin/KASModuleStrut.cs @@ -315,7 +315,7 @@ private bool LinkTo(KASModuleStrut tgtModule, bool checkCondition = true, bool s { if (!CheckLink(this.strutTransform, tgtModule.strutTransform, true)) { - ScreenMessages.PostScreenMessage("Max angle or lenght reached, cannot link !", 5, ScreenMessageStyle.UPPER_CENTER); + ScreenMessages.PostScreenMessage("Max angle or length reached, cannot link !", 5, ScreenMessageStyle.UPPER_CENTER); return false; } @@ -555,7 +555,7 @@ public void ContextMenuLink() else { SetEvaLink(); - ScreenMessages.PostScreenMessage("Link mode enabled, press Echap or Enter to cancel", 10, ScreenMessageStyle.UPPER_CENTER); + ScreenMessages.PostScreenMessage("Link mode enabled, press Escape or Enter to cancel", 10, ScreenMessageStyle.UPPER_CENTER); } } From ef2ba6da4085f82d48a6d74570a7f1232e1c072f Mon Sep 17 00:00:00 2001 From: KospY Date: Sun, 31 Aug 2014 12:17:10 +0200 Subject: [PATCH 05/22] 0.24.2 fix --- Plugin/CompatibilityChecker.cs | 4 ++-- Plugin/KAS_Shared.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugin/CompatibilityChecker.cs b/Plugin/CompatibilityChecker.cs index ccae1421..106d26c7 100644 --- a/Plugin/CompatibilityChecker.cs +++ b/Plugin/CompatibilityChecker.cs @@ -53,8 +53,8 @@ public static bool IsCompatible() \*-----------------------------------------------*/ const int compatibleMajor = 0; - const int compatibleMinor = 23; - const int compatibleRevision = 5; + const int compatibleMinor = 24; + const int compatibleRevision = 2; return (Versioning.version_major == compatibleMajor) && (Versioning.version_minor == compatibleMinor) && (Versioning.Revision == compatibleRevision); diff --git a/Plugin/KAS_Shared.cs b/Plugin/KAS_Shared.cs index 50c9b2e1..6ad4c2bb 100644 --- a/Plugin/KAS_Shared.cs +++ b/Plugin/KAS_Shared.cs @@ -554,7 +554,7 @@ public static Part CreatePart(AvailablePart avPart, Vector3 position, Quaternion { ConfigNode node = new ConfigNode(); node.AddValue("name", newPart.Modules[i].moduleName); - newPart.LoadModule(node, i); + newPart.LoadModule(node, ref i); } return newPart; From 675c3ceaedc4da67e722ca965544b26a82f9e46c Mon Sep 17 00:00:00 2001 From: KospY Date: Sun, 31 Aug 2014 12:21:51 +0200 Subject: [PATCH 06/22] Fix grab for KSP x64 On KSP x64, a coroutine is needed for waiting decouple action to finish. Grab function has been redone to reflect that. (+ others minor fix) --- Plugin/KASModuleGrab.cs | 139 +++++++++++++++++++++++++++++++--------- 1 file changed, 108 insertions(+), 31 deletions(-) diff --git a/Plugin/KASModuleGrab.cs b/Plugin/KASModuleGrab.cs index c8a07ca0..22a3ce16 100644 --- a/Plugin/KASModuleGrab.cs +++ b/Plugin/KASModuleGrab.cs @@ -56,7 +56,6 @@ public class KASModuleGrab : KASModuleAttachCore private List keepTriggers; private bool grab_pending = false; - public override string GetInfo() { var sb = new StringBuilder(); @@ -99,6 +98,29 @@ public override void OnStart(StartState state) KAS_Shared.createFXSound(this.part, fxSndDetach, detachSndPath, false); KAS_Shared.createFXSound(this.part, fxSndAttachStatic, attachStaticSndPath, false); RefreshContextMenu(); + + //Get attach node + if (attachNodeName == null || attachNodeName == "") + { + if (this.part.srfAttachNode == null) + { + KAS_Shared.DebugError("Grab - surface attach node cannot be found on the part !"); + return; + } + KAS_Shared.AddNodeTransform(this.part, this.part.srfAttachNode); + partNode = this.part.srfAttachNode; + } + else + { + AttachNode an = this.part.findAttachNode(attachNodeName); + if (an == null) + { + KAS_Shared.DebugError("Grab - " + attachNodeName + " node cannot be found on the part !"); + return; + } + KAS_Shared.AddNodeTransform(this.part, an); + partNode = an; + } } void OnCrewBoardVessel(GameEvents.FromToAction fromToAction) @@ -241,26 +263,20 @@ internal bool GrabPending() return true; } - public void Grab(Vessel kerbalEvaVessel) + private void SetEvaNode(Vessel kerbalEvaVessel) { - KAS_Shared.DebugLog("Grab - Grabbing part :" + this.part.partInfo.name); - - if (!AlignEvaPosition(kerbalEvaVessel)) - { - return; - } - - //Grab winch connected head if any - KASModuleWinch moduleWinch = KAS_Shared.GetConnectedWinch(this.part); - if (moduleWinch) - { - KASModulePort modulePort = this.part.GetComponent(); - moduleWinch.UnplugHead(false); - moduleWinch.GrabHead(kerbalEvaVessel, modulePort); - } + //Get eva transform + evaCollider = KAS_Shared.GetEvaCollider(kerbalEvaVessel, evaTransformName); + if (evaNodeTransform) Destroy(evaNodeTransform.gameObject); + evaNodeTransform = new GameObject("KASEvaNode").transform; + evaNodeTransform.parent = evaCollider.transform; + evaNodeTransform.localPosition = evaPartPos; + evaNodeTransform.rotation = KAS_Shared.DirectionToQuaternion(evaCollider.transform, evaPartDir); + } + private void DisableColliders() + { keepTriggers = new List(); - List allColliders = new List(this.part.GetComponentsInChildren() as Collider[]); foreach (Collider col in allColliders) { @@ -271,30 +287,82 @@ public void Grab(Vessel kerbalEvaVessel) col.isTrigger = true; } + } + + public void Grab(Vessel kerbalEvaVessel) + { + //Validation + KASModuleGrab grabbedPartModule = KAS_Shared.GetGrabbedPartModule(kerbalEvaVessel); + if (grabbedPartModule) + { + if (grabbedPartModule.part.packed) + { + KAS_Shared.DebugWarning("Grab - cannot drop the current grabbed part ! (packed)"); + return; + } + } + //Start grab + StartCoroutine(GrabCoroutine(kerbalEvaVessel)); + } - Detach(); + private IEnumerator GrabCoroutine(Vessel kerbalEvaVessel) + { + KAS_Shared.DebugLog("Grab - Grabbing part :" + this.part.partInfo.name); + //Send message to other modules + base.SendMessage("OnPartGrab", kerbalEvaVessel, SendMessageOptions.DontRequireReceiver); + + //Set attach node on EVA + SetEvaNode(kerbalEvaVessel); - if (this.part.vessel != kerbalEvaVessel) + //Drop grabbed eva part if any + KASModuleGrab grabbbedPartModule = KAS_Shared.GetGrabbedPartModule(kerbalEvaVessel); + if (grabbbedPartModule) { - KAS_Shared.DecoupleFromAll(this.part); - this.part.Couple(kerbalEvaVessel.rootPart); + grabbbedPartModule.Drop(); } - else + + //Unplug winch connected head if any + KASModuleWinch moduleWinch = KAS_Shared.GetConnectedWinch(this.part); + if (moduleWinch) { - if (this.part.parent != kerbalEvaVessel.rootPart) - { - this.part.setParent(null); - this.part.setParent(kerbalEvaVessel.rootPart); - } - this.part.PromoteToPhysicalPart(); + moduleWinch.UnplugHead(false); } + //Disable all colliders on part + DisableColliders(); + + //Detach if needed + Detach(); + + //Decouple part + KAS_Shared.DecoupleFromAll(this.part); + + //Wait decouple action (x64 fix) + yield return new WaitForFixedUpdate(); + + //Move part to eva node + KAS_Shared.MoveAlign(this.part.transform, partNode.nodeTransform, evaNodeTransform); + + //Grab winch connected head if any + if (moduleWinch) + { + KASModulePort modulePort = this.part.GetComponent(); + moduleWinch.GrabHead(kerbalEvaVessel, modulePort); + } + + //Couple part to eva + this.part.Couple(kerbalEvaVessel.rootPart); + //Destroy joint to avoid buggy eva move if (this.part.attachJoint) + { this.part.attachJoint.DestroyJoint(); - + } + + //Set part velocity to kerbal velocity this.part.rigidbody.velocity = kerbalEvaVessel.rootPart.rigidbody.velocity; + //Set part to physic join or kinematic with parent if (physicJoint) { if (evaJoint) Destroy(evaJoint); @@ -319,17 +387,22 @@ public void Grab(Vessel kerbalEvaVessel) kerbalEvaVessel.rootPart.mass += this.part.mass; } + //Add event GameEvents.onCrewBoardVessel.Add(new EventData>.OnEvent(this.OnCrewBoardVessel)); + //Set variables evaHolderVesselName = kerbalEvaVessel.vesselName; evaHolderPart = kerbalEvaVessel.rootPart; grabbed = true; grab_pending = false; + //Refresh Context Menu RefreshContextMenu(); //Play grab sound fxSndGrab.audio.Play(); + + //Send message to other modules base.SendMessage("OnPartGrabbed", kerbalEvaVessel, SendMessageOptions.DontRequireReceiver); } @@ -338,6 +411,7 @@ public void Drop(bool forAttach = false) if (grabbed) { KAS_Shared.DebugLog("Drop - Dropping part :" + this.part.partInfo.name); + base.SendMessage("OnPartDrop", SendMessageOptions.DontRequireReceiver); if (this.part.rigidbody) @@ -469,7 +543,10 @@ public void RefreshContextMenu() [KSPEvent(name = "ContextMenuGrab", active = true, guiActiveUnfocused = false, guiActive = false, unfocusedRange = 2f, guiName = "Grab")] public void ContextMenuGrab() { - Grab(FlightGlobals.ActiveVessel); + if (!part.packed) + { + Grab(FlightGlobals.ActiveVessel); + } } [KSPEvent(name = "ContextMenuDrop", active = true, guiActiveUnfocused = false, guiActive = false, unfocusedRange = 2f, guiName = "Drop")] From da6d357dc115e4850e1ad4ba9b4d913ae5760308 Mon Sep 17 00:00:00 2001 From: KospY Date: Sun, 31 Aug 2014 17:31:17 +0200 Subject: [PATCH 07/22] Fix grab relative velocity immediately becomes zero Changed the method for attaching the part to the kerbal. Setting iskinematic to true and/or physicalSignificance to none mess up things at some velocity/orbit (ex orbiting moon). Now the part is updating is position every frame when grabbed. --- Plugin/KASModuleGrab.cs | 123 ++++++++-------------------------------- 1 file changed, 24 insertions(+), 99 deletions(-) diff --git a/Plugin/KASModuleGrab.cs b/Plugin/KASModuleGrab.cs index 22a3ce16..fd09695f 100644 --- a/Plugin/KASModuleGrab.cs +++ b/Plugin/KASModuleGrab.cs @@ -55,6 +55,7 @@ public class KASModuleGrab : KASModuleAttachCore private FixedJoint evaJoint; private List keepTriggers; private bool grab_pending = false; + private bool syncGrab = false; public override string GetInfo() { @@ -173,93 +174,15 @@ public override void OnPartUnpack() Grab(this.vessel); grab_pending = false; } - else - { - if (!physicJoint) this.part.rigidbody.isKinematic = true; - } } } - private bool AlignEvaPosition(Vessel kerbalEvaVessel) - { - //Get eva transform - evaCollider = KAS_Shared.GetEvaCollider(kerbalEvaVessel, evaTransformName); - if (!evaCollider) - { - KAS_Shared.DebugLog("Grab - " + evaTransformName + "transform not found on eva !"); - return false; - } - - //Get attach node - if (attachNodeName == null || attachNodeName == "") - { - if (this.part.srfAttachNode == null) - { - KAS_Shared.DebugLog("Grab - surface attach node cannot be found on the part !"); - return false; - } - KAS_Shared.AddNodeTransform(this.part, this.part.srfAttachNode); - partNode = this.part.srfAttachNode; - } - else - { - AttachNode an = this.part.findAttachNode(attachNodeName); - if (an == null) - { - KAS_Shared.DebugLog("Grab - " + attachNodeName + " node cannot be found on the part !"); - return false; - } - KAS_Shared.AddNodeTransform(this.part, an); - partNode = an; - } - - //Send message to other modules - base.SendMessage("OnPartGrab", kerbalEvaVessel, SendMessageOptions.DontRequireReceiver); - - //Drop grabbed part on eva if needed - KASModuleGrab tmpGrabbbedPartModule = KAS_Shared.GetGrabbedPartModule(kerbalEvaVessel); - if (tmpGrabbbedPartModule) - { - if (tmpGrabbbedPartModule.part.packed) - { - KAS_Shared.DebugWarning("Grab - cannot drop an incompletely grabbed part!"); - return false; - } - - KAS_Shared.DebugWarning("Grab - Drop current grabbed part"); - tmpGrabbbedPartModule.Drop(); - } - - if (evaNodeTransform) Destroy(evaNodeTransform.gameObject); - - evaNodeTransform = new GameObject("KASEvaNode").transform; - evaNodeTransform.parent = evaCollider.transform; - evaNodeTransform.localPosition = evaPartPos; - evaNodeTransform.rotation = KAS_Shared.DirectionToQuaternion(evaCollider.transform, evaPartDir); - - KAS_Shared.MoveAlign(this.part.transform, partNode.nodeTransform, evaNodeTransform); - - if (this.part.vessel == kerbalEvaVessel) - { - this.part.UpdateOrgPosAndRot(kerbalEvaVessel.rootPart); - } - - return true; - } - internal bool GrabPending() { KAS_Shared.DebugLog("GrabPending - Preparing To Grab part :" + this.part.partInfo.name); - - if (!AlignEvaPosition(this.vessel)) - { - return false; - } - evaHolderVesselName = this.vessel.vesselName; evaHolderPart = this.vessel.rootPart; grabbed = grab_pending = true; - return true; } @@ -289,6 +212,15 @@ private void DisableColliders() } } + void FixedUpdate() + { + if (syncGrab) + { + KAS_Shared.MoveAlign(this.part.transform, partNode.nodeTransform, evaNodeTransform); + this.part.rigidbody.velocity = FlightGlobals.ActiveVessel.rootPart.rigidbody.velocity; + } + } + public void Grab(Vessel kerbalEvaVessel) { //Validation @@ -333,9 +265,12 @@ private IEnumerator GrabCoroutine(Vessel kerbalEvaVessel) //Detach if needed Detach(); - - //Decouple part - KAS_Shared.DecoupleFromAll(this.part); + + //Decouple part (if not already done, in case of loading after a save with the part grabbed) + if (this.part.vessel != kerbalEvaVessel) + { + KAS_Shared.DecoupleFromAll(this.part); + } //Wait decouple action (x64 fix) yield return new WaitForFixedUpdate(); @@ -350,8 +285,11 @@ private IEnumerator GrabCoroutine(Vessel kerbalEvaVessel) moduleWinch.GrabHead(kerbalEvaVessel, modulePort); } - //Couple part to eva - this.part.Couple(kerbalEvaVessel.rootPart); + //Couple part to eva (if not already done, in case of loading after a save with the part grabbed) + if (this.part.vessel != kerbalEvaVessel) + { + this.part.Couple(kerbalEvaVessel.rootPart); + } //Destroy joint to avoid buggy eva move if (this.part.attachJoint) @@ -359,9 +297,6 @@ private IEnumerator GrabCoroutine(Vessel kerbalEvaVessel) this.part.attachJoint.DestroyJoint(); } - //Set part velocity to kerbal velocity - this.part.rigidbody.velocity = kerbalEvaVessel.rootPart.rigidbody.velocity; - //Set part to physic join or kinematic with parent if (physicJoint) { @@ -374,12 +309,10 @@ private IEnumerator GrabCoroutine(Vessel kerbalEvaVessel) } else { - this.part.physicalSignificance = Part.PhysicalSignificance.NONE; - this.part.transform.parent = evaNodeTransform; - this.part.rigidbody.isKinematic = true; + syncGrab = true; KAS_Shared.ResetCollisionEnhancer(this.part, false); } - + //Add grabbed part mass to eva if (addPartMass && !physicJoint) { @@ -414,12 +347,6 @@ public void Drop(bool forAttach = false) base.SendMessage("OnPartDrop", SendMessageOptions.DontRequireReceiver); - if (this.part.rigidbody) - { - this.part.transform.parent = null; - this.part.physicalSignificance = Part.PhysicalSignificance.FULL; - } - if (this.part.vessel.isEVA || grab_pending) { this.part.decouple(); @@ -458,9 +385,6 @@ public void Drop(bool forAttach = false) if (evaNodeTransform) Destroy(evaNodeTransform.gameObject); if (evaJoint) Destroy(evaJoint); - this.part.transform.parent = null; - this.part.rigidbody.isKinematic = false; - this.part.physicalSignificance = Part.PhysicalSignificance.FULL; this.part.rigidbody.velocity = evaHolderPart.rigidbody.velocity; this.part.rigidbody.angularVelocity = evaHolderPart.rigidbody.angularVelocity; @@ -489,6 +413,7 @@ public void Drop(bool forAttach = false) GameEvents.onCrewBoardVessel.Remove(new EventData>.OnEvent(this.OnCrewBoardVessel)); + syncGrab = false; keepTriggers = null; evaJoint = null; evaNodeTransform = null; From 7a1e117f62577a918d211dbd0a3d582fc240406c Mon Sep 17 00:00:00 2001 From: KospY Date: Sun, 31 Aug 2014 22:24:53 +0200 Subject: [PATCH 08/22] Update LICENSE.md --- LICENSE.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 5456cf3e..4fd6c662 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,21 +1,19 @@ **Copyright Overview** -* Models and textures of connector, ports, winches and magnet parts was created by Winn75, who retains the copyright. -* Models and textures of containers, bays, strut, pipe and pylon was created by zzz, who retains the copyright. -* Models for all remaining parts were created by KospY, who retains the copyrights. -* Config files, shaders, source code and compiled binaries are under copyright retained by KospY. +- Models and textures of connector, ports, winches and magnet parts was created by Winn75, who retains the copyright. +- Models and textures of containers, bays, strut, pipe and pylon was created by zzz, who retains the copyright. +- Models for all remaining parts were created by KospY, who retains the copyrights. +- Config files, shaders, source code and compiled binaries are under copyright retained by KospY. + + +**YOU MAY :** -**YOU MAY**: - Distribute your own parts using any part modules included in KAS. +- Distribute fixes in case of a compatibility problem with a new version of KSP (.dll only). - Distribute video, screenshots or other media portraying unmodified versions of KAS in action. -- Distribute modified or unmodified versions of the KAS plugin source code on condition that a link to this license is included. +- Distribute modified or unmodified versions of the KAS plugin source code on condition that a link to this license is - included. - Modify KAS in any way for personal use. - Request a waiver of any of these terms. + -**All other rights are reserved.** In particular, **YOU MAY NOT**: -- Distribute modified or unmodified versions of KAS, in part or whole. -- Use models, animations, textures or other assets from KAS, including by reference. -- Use components of the KAS plugin, including parts and part modules, except where explicitly allowed. -- Distribute a byte patch or other difference file or patcher intended to modify KAS files without directly distributing them. -- Use any part of the KAS source or package, or other KAS branding, for any commercial purpose. -- Relicense any part of KAS. +**All other rights are reserved.** From 1da5de3bba22b420d02397f6b64794deeb17cdc7 Mon Sep 17 00:00:00 2001 From: KospY Date: Mon, 1 Sep 2014 18:04:37 +0200 Subject: [PATCH 09/22] Set fixedupdate to public in case of inheritance --- Plugin/KASModuleGrab.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugin/KASModuleGrab.cs b/Plugin/KASModuleGrab.cs index fd09695f..b2d51ef6 100644 --- a/Plugin/KASModuleGrab.cs +++ b/Plugin/KASModuleGrab.cs @@ -212,7 +212,7 @@ private void DisableColliders() } } - void FixedUpdate() + public void FixedUpdate() { if (syncGrab) { From cbcf311f1fbd56465da8648e8e0c4250589b90c7 Mon Sep 17 00:00:00 2001 From: KospY Date: Wed, 24 Sep 2014 23:31:05 +0200 Subject: [PATCH 10/22] Fixed grapple bug when the join is broken Fixed grapple not being correctly detached when a joint is broken. Added new methods to check if a static or fixed joint is broken --- Plugin/KASModuleAttachCore.cs | 45 ++++++++++++++++++++++++++++---- Plugin/KASModuleGrapplingHook.cs | 5 ++++ Plugin/KASModuleMagnet.cs | 5 ++-- Plugin/KASModuleStrut.cs | 3 +-- 4 files changed, 48 insertions(+), 10 deletions(-) diff --git a/Plugin/KASModuleAttachCore.cs b/Plugin/KASModuleAttachCore.cs index d18ebcc3..f6a53a74 100644 --- a/Plugin/KASModuleAttachCore.cs +++ b/Plugin/KASModuleAttachCore.cs @@ -1,5 +1,7 @@ using System; +using System.Linq; using System.Collections.Generic; +using System.Collections; using System.Text; using UnityEngine; @@ -221,10 +223,41 @@ public virtual void OnPartUnpack() } } - protected virtual void OnJointBreak(float breakForce) + private void OnJointBreak(float breakForce) { KAS_Shared.DebugWarning("OnJointBreak(Core) A joint broken on " + part.partInfo.title + " !, force: " + breakForce); - Detach(); + StartCoroutine(WaitAndCheckJoint()); + } + + private IEnumerator WaitAndCheckJoint() + { + yield return new WaitForFixedUpdate(); + if (attachMode.StaticJoint) + { + if (StaticAttach.fixedJoint == null) + { + KAS_Shared.DebugWarning("WaitAndCheckJoint(Core) Static join broken !"); + OnJointBreakStatic(); + } + } + if (attachMode.FixedJoint) + { + if (FixedAttach.fixedJoint == null) + { + KAS_Shared.DebugWarning("WaitAndCheckJoint(Core) Fixed join broken !"); + OnJointBreakFixed(); + } + } + } + + public virtual void OnJointBreakStatic() + { + Detach(AttachType.StaticJoint); + } + + public virtual void OnJointBreakFixed() + { + Detach(AttachType.FixedJoint); } protected virtual void OnDestroy() @@ -328,10 +361,10 @@ public void AttachStatic(float breakForce = 10) KAS_Shared.DebugLog("JointToStatic(Base) Create fixed joint on the kinematic rigidbody"); if (StaticAttach.fixedJoint) Destroy(StaticAttach.fixedJoint); - FixedJoint CurJoint = obj.AddComponent(); + FixedJoint CurJoint = this.part.gameObject.AddComponent(); CurJoint.breakForce = breakForce; CurJoint.breakTorque = breakForce; - CurJoint.connectedBody = this.part.rigidbody; + CurJoint.connectedBody = obj.rigidbody; StaticAttach.fixedJoint = CurJoint; attachMode.StaticJoint = true; } @@ -455,6 +488,7 @@ private Vessel GetDominantVessel(Vessel v1, Vessel v2) public void Detach() { + //KAS_Shared.DebugLog("Detach(Base) Attach mode is Docked:" + attachMode.Docked + ",Coupled:" + attachMode.Coupled + ",FixedJoint:" + attachMode.FixedJoint + ",StaticJoint:" + attachMode.StaticJoint); if (attachMode.Docked) Detach(AttachType.Docked); if (attachMode.Coupled) Detach(AttachType.Coupled); if (attachMode.FixedJoint) Detach(AttachType.FixedJoint); @@ -483,7 +517,8 @@ private void UndockVessel() public void Detach(AttachType attachType) { - KAS_Shared.DebugLog("Detach(Base) Attach type is : " + attachMode); + KAS_Shared.DebugLog("Detach(Base) Attach mode is Docked:" + attachMode.Docked + ",Coupled:" + attachMode.Coupled + ",FixedJoint:" + attachMode.FixedJoint + ",StaticJoint:" + attachMode.StaticJoint); + KAS_Shared.DebugLog("Detach(Base) Attach type is : " + attachType); // Docked if (attachType == AttachType.Docked) diff --git a/Plugin/KASModuleGrapplingHook.cs b/Plugin/KASModuleGrapplingHook.cs index 2fa254ac..9af0e279 100644 --- a/Plugin/KASModuleGrapplingHook.cs +++ b/Plugin/KASModuleGrapplingHook.cs @@ -59,6 +59,11 @@ public override void OnStart(StartState state) KAS_Shared.createFXSound(this.part, fxSndDetach, detachSndPath, false); } + public override void OnJointBreakStatic() + { + DetachGrapple(); + } + public override void OnPartUnpack() { base.OnPartUnpack(); diff --git a/Plugin/KASModuleMagnet.cs b/Plugin/KASModuleMagnet.cs index d55cd74b..7c3ecdb6 100644 --- a/Plugin/KASModuleMagnet.cs +++ b/Plugin/KASModuleMagnet.cs @@ -87,12 +87,11 @@ public override void OnUpdate() UpdateMagnet(); } - protected override void OnJointBreak(float breakForce) + public override void OnJointBreakFixed() { - base.OnJointBreak(breakForce); - KAS_Shared.DebugWarning("A joint broken on " + part.partInfo.title + " !, force: " + breakForce); KAS_Shared.DebugWarning("Disable magnet..."); MagnetActive = false; + base.OnJointBreakFixed(); } public void OnPartGrab(Vessel kerbalEvaVessel) diff --git a/Plugin/KASModuleStrut.cs b/Plugin/KASModuleStrut.cs index 18fc803a..79fbc5e9 100644 --- a/Plugin/KASModuleStrut.cs +++ b/Plugin/KASModuleStrut.cs @@ -248,12 +248,11 @@ protected override void OnPartDie() } } - protected override void OnJointBreak(float breakForce) + public override void OnJointBreakFixed() { KAS_Shared.DebugWarning("OnJointBreak(Strut) A joint broken on " + part.partInfo.title + " !, force: " + breakForce); Unlink(); fxSndBroke.audio.Play(); - base.OnJointBreak(breakForce); } public void OnPartGrab(Vessel kerbalEvaVessel) From 715b2f41a22b09de554d8fd4c6b814e603a9209d Mon Sep 17 00:00:00 2001 From: KospY Date: Thu, 25 Sep 2014 00:11:17 +0200 Subject: [PATCH 11/22] Ejection fix for KSPx64 On KSP X64, ejection force are not applied on winches. Delayed the addforce method to one frame after to fix the problem. --- Plugin/KASModuleWinch.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Plugin/KASModuleWinch.cs b/Plugin/KASModuleWinch.cs index a401ab3b..4207303d 100644 --- a/Plugin/KASModuleWinch.cs +++ b/Plugin/KASModuleWinch.cs @@ -1165,7 +1165,8 @@ public void Eject() Vector3 force = winchAnchorNode.TransformDirection(Vector3.forward) * ejectForce; if (connectedPortInfo.module) { - connectedPortInfo.module.part.Rigidbody.AddForce(force, ForceMode.Force); + //connectedPortInfo.module.part.Rigidbody.AddForce(force, ForceMode.Force); + StartCoroutine(WaitAndApplyForce(force)); } else { @@ -1176,6 +1177,13 @@ public void Eject() } } + // X64 fix for eject + private IEnumerator WaitAndApplyForce(Vector3 force) + { + yield return new WaitForFixedUpdate(); + connectedPortInfo.module.part.Rigidbody.AddForce(force, ForceMode.Force); + } + private bool IsLockable() { float distance = Vector3.Distance(winchAnchorNode.position, headAnchorNode.position); From 88cf14a125b6a67e1ea771b61a476e17a83672b9 Mon Sep 17 00:00:00 2001 From: KospY Date: Thu, 25 Sep 2014 00:45:03 +0200 Subject: [PATCH 12/22] Fixed retract after eject It's now possible to retract directly after an ejection without using extend first --- Plugin/KASModuleWinch.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugin/KASModuleWinch.cs b/Plugin/KASModuleWinch.cs index 4207303d..fc7f2f1c 100644 --- a/Plugin/KASModuleWinch.cs +++ b/Plugin/KASModuleWinch.cs @@ -1161,6 +1161,7 @@ public void Eject() if (headState == PlugState.Locked && ejectEnabled) { Deploy(); + retract.full = false; cableJointLength = maxLenght; Vector3 force = winchAnchorNode.TransformDirection(Vector3.forward) * ejectForce; if (connectedPortInfo.module) From 140f159a43fe6bbdfb1a4001cb9f058fa996ed6e Mon Sep 17 00:00:00 2001 From: KospY Date: Thu, 25 Sep 2014 00:46:58 +0200 Subject: [PATCH 13/22] Fixed headlock Winches head can't lock sometimes, raising lockMinDist to avoid it --- Parts/winch1/winch1.cfg | 2 +- Parts/winch2/winch2.cfg | 2 +- Parts/winch3/winch3.cfg | 2 +- Parts/winch4/winch4.cfg | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Parts/winch1/winch1.cfg b/Parts/winch1/winch1.cfg index 15d9dae4..bd1036fa 100644 --- a/Parts/winch1/winch1.cfg +++ b/Parts/winch1/winch1.cfg @@ -57,7 +57,7 @@ MODULE evaGrabHeadDir = (0,0,1) evaDropHeadPos = (0.05, 0.01, -0.16) evaDropHeadRot = (180.0, 0.0, 0.0) - lockMinDist = 0.08 + lockMinDist = 0.12 lockMinFwdDot = 0.90 } diff --git a/Parts/winch2/winch2.cfg b/Parts/winch2/winch2.cfg index 8e899bad..e38d0aaf 100644 --- a/Parts/winch2/winch2.cfg +++ b/Parts/winch2/winch2.cfg @@ -60,7 +60,7 @@ MODULE evaDropHeadRot = (180.0, 0.0, 0.0) ejectEnabled = true ejectForce = 20 - lockMinDist = 0.08 + lockMinDist = 0.12 lockMinFwdDot = 0.90 } diff --git a/Parts/winch3/winch3.cfg b/Parts/winch3/winch3.cfg index eba5d293..a1c32b9b 100644 --- a/Parts/winch3/winch3.cfg +++ b/Parts/winch3/winch3.cfg @@ -59,7 +59,7 @@ MODULE evaDropHeadRot = (180.0, 0.0, 0.0) ejectEnabled = true ejectForce = 20 - lockMinDist = 0.08 + lockMinDist = 0.12 lockMinFwdDot = 0.90 } diff --git a/Parts/winch4/winch4.cfg b/Parts/winch4/winch4.cfg index b0f72c9d..eb580242 100644 --- a/Parts/winch4/winch4.cfg +++ b/Parts/winch4/winch4.cfg @@ -58,7 +58,7 @@ MODULE evaDropHeadRot = (180.0, 0.0, 0.0) ejectEnabled = true ejectForce = 20 - lockMinDist = 0.08 + lockMinDist = 0.12 lockMinFwdDot = 0.90 } From b097656ea70b6806e1552200d3e3121f9ef4d539 Mon Sep 17 00:00:00 2001 From: KospY Date: Thu, 25 Sep 2014 21:17:58 +0200 Subject: [PATCH 14/22] Parts purchase costs adjustment --- Parts/cPort1/cPort1.cfg | 4 ++-- Parts/cPort2/cPort2.cfg | 4 ++-- Parts/container1/container1.cfg | 2 +- Parts/container2/container2.cfg | 2 +- Parts/hookSupport/hookSupport.cfg | 2 +- Parts/hook_anchor/anchor.cfg | 4 ++-- Parts/hook_grapplingHook/grapplingHook.cfg | 4 ++-- Parts/hook_magnet/magnet.cfg | 4 ++-- Parts/pipe1/pipe1.cfg | 4 ++-- Parts/strut1/strut1.cfg | 4 ++-- Parts/winch1/winch1.cfg | 2 +- Parts/winch2/winch2.cfg | 2 +- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Parts/cPort1/cPort1.cfg b/Parts/cPort1/cPort1.cfg index fe3a8af0..6eb8a759 100644 --- a/Parts/cPort1/cPort1.cfg +++ b/Parts/cPort1/cPort1.cfg @@ -16,12 +16,12 @@ node_stack_top = 0.0, 0.0362, 0.0, 0.0, 1.0, 0.0, 0 node_stack_bottom = 0.0, -0.0400, 0.0, 0.0, 1.0, 0.0, 0 node_attach = 0.0, -0.04, 0.0, 0.0, -1.0, 0.0 -cost = 200 +cost = 350 category = Utility subcategory = 0 title = Radial connector port manufacturer = K.A.S. Manufacturing -description = A port for connecting a winch connector. Can be used for resource transfer or towing. +description = A port for connecting a winch connector. Can be used for ressource transfer or towing. attachRules = 1,1,0,0,1 TechRequired = advConstruction diff --git a/Parts/cPort2/cPort2.cfg b/Parts/cPort2/cPort2.cfg index 40507f97..5d67c886 100644 --- a/Parts/cPort2/cPort2.cfg +++ b/Parts/cPort2/cPort2.cfg @@ -15,12 +15,12 @@ mesh = portStack1.mu node_stack_top = 0.0, 0.00082, 0.0, 0.0, 1.0, 0.0, 0 node_stack_bottom = 0.0, -0.0424, 0.0, 0.0, 1.0, 0.0, 0 -cost = 200 +cost = 450 category = Utility subcategory = 0 title = Stack connector port (0.5m) manufacturer = K.A.S. Manufacturing -description = A destination port for a connector. Use it for resource transfer or towing heavy objects. Can also be used to lock parts when a winch cable is fully retracted. +description = A destination port for a connector. Use it for ressource transfer or towing heavy objects. Can also be used to lock parts when a winch cable is fully retracted. // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision, allowDock, allowRotate attachRules = 1,0,1,1,0 diff --git a/Parts/container1/container1.cfg b/Parts/container1/container1.cfg index 7bcbebd3..5bb73697 100644 --- a/Parts/container1/container1.cfg +++ b/Parts/container1/container1.cfg @@ -18,7 +18,7 @@ rescaleFactor = 0.50 node_stack_bottom = 0.0, -0.3968, 0.0, 0.0, 1.0, 0.0, 0 // --- editor parameters --- -cost = 680 +cost = 550 category = Utility subcategory = 0 title = Container Type A diff --git a/Parts/container2/container2.cfg b/Parts/container2/container2.cfg index 5d44b509..a8d01457 100644 --- a/Parts/container2/container2.cfg +++ b/Parts/container2/container2.cfg @@ -18,7 +18,7 @@ rescaleFactor = 0.50 node_stack_bottom = 0.0, -0.7596, 0.0, 0.0, 1.0, 0.0, 0 // --- editor parameters --- -cost = 680 +cost = 700 category = Utility subcategory = 0 title = Container Type B diff --git a/Parts/hookSupport/hookSupport.cfg b/Parts/hookSupport/hookSupport.cfg index 134b9ec1..e4c578a2 100644 --- a/Parts/hookSupport/hookSupport.cfg +++ b/Parts/hookSupport/hookSupport.cfg @@ -15,7 +15,7 @@ mesh = hookSupport.mu node_stack_top = 0.0, 0.0264, 0, 0.0, 1.0, 0.0, 0 node_stack_bottom = 0.0, -0.1493, 0, 0.0, 1.0, 0.0, 0 -cost = 200 +cost = 150 category = Utility subcategory = 0 title = Hook Support diff --git a/Parts/hook_anchor/anchor.cfg b/Parts/hook_anchor/anchor.cfg index ec382a14..3fc678ca 100644 --- a/Parts/hook_anchor/anchor.cfg +++ b/Parts/hook_anchor/anchor.cfg @@ -15,12 +15,12 @@ mesh = anchor.mu node_stack_top = -0.0, 0.05606, -0.0, 0.0, 1.0, 0.0, 0 -cost = 200 +cost = 250 category = Utility subcategory = 0 title = Anchor manufacturer = K.A.S. Manufacturing -description = An anchor to be used for boat, airship or everything else. In addition to its weight, it also provides drag and friction when touching the ground. +description = An anchor to be used for boat, airship or everything else. In addition to its weight, it also provide drag and friction when touching the ground. TechRequired = specializedControl entryCost = 50 diff --git a/Parts/hook_grapplingHook/grapplingHook.cfg b/Parts/hook_grapplingHook/grapplingHook.cfg index 21a3ce35..3ce9e7ea 100644 --- a/Parts/hook_grapplingHook/grapplingHook.cfg +++ b/Parts/hook_grapplingHook/grapplingHook.cfg @@ -16,12 +16,12 @@ scale = 1 node_stack_top = -0.0, 0.05606, -0.0, 0.0, 1.0, 0.0, 0 node_attach = 0.0, -0.0651, 0.0, 0.0, -1.0, 0.0 -cost = 500 +cost = 700 category = Utility subcategory = 0 title = Grappling hook manufacturer = K.A.S. Manufacturing -description = This hook will attach to everything it collides with, as long as the impact is strong enough. Can be mounted on a winch. To be used with the winch eject function. +description = This hook will attach to everything it collide, as long as the impact is strong enough. Can be mounted on a winch. To be used with the winch eject function. TechRequired = metaMaterials entryCost = 50 diff --git a/Parts/hook_magnet/magnet.cfg b/Parts/hook_magnet/magnet.cfg index d75d1f81..398805cb 100644 --- a/Parts/hook_magnet/magnet.cfg +++ b/Parts/hook_magnet/magnet.cfg @@ -16,12 +16,12 @@ scale = 1 node_stack_top = -0.0, 0.1005, -0.0, 0.0, 1.0, 0.0, 0 node_attach = 0.0, -0.0021, 0.0, 0.0, -1.0, 0.0 -cost = 500 +cost = 1100 category = Utility subcategory = 0 title = Electro-Magnet manufacturer = K.A.S. Manufacturing -description = This electro-magnet is perfect for grabbing heavy objects without a connector or a docking port. Can be mounted on a winch or on a hook support. +description = This electro-magnet is perfect for grabing heavy objects without a connector or a docking port. Can be mounted on a winch or on a hook support. TechRequired = nanolathing entryCost = 50 diff --git a/Parts/pipe1/pipe1.cfg b/Parts/pipe1/pipe1.cfg index f384c6c3..ae7d4fc2 100644 --- a/Parts/pipe1/pipe1.cfg +++ b/Parts/pipe1/pipe1.cfg @@ -16,12 +16,12 @@ mesh = pipe1.mu node_stack_bottom = 0.0, -0.0578, 0.0, 0.0, 1.0, 0.0, 0 node_attach = 0.0, -0.0578, 0.0, 0.0, -1.0, 0.0 -cost = 200 +cost = 250 category = Utility subcategory = 0 title = Pipe end point manufacturer = K.A.S. Manufacturing -description = End point for building pipes from EVA. Can be used for linking different vessels. Useful for making ground bases and transferring resources. +description = End point for building pipes from eva. Can be used for linking different vessels. Usefull for making ground bases and transfering ressources. // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision, allowDock, allowRotate attachRules = 1,1,0,0,1 diff --git a/Parts/strut1/strut1.cfg b/Parts/strut1/strut1.cfg index 2a363607..33194e1e 100644 --- a/Parts/strut1/strut1.cfg +++ b/Parts/strut1/strut1.cfg @@ -14,12 +14,12 @@ mesh = strut1.mu node_attach = 0.0, -0.0315, 0.0, 0.0, -1.0, 0.0 -cost = 200 +cost = 150 category = Utility subcategory = 0 title = Strut end point manufacturer = K.A.S. Manufacturing -description = End point for building a strut from EVA. Links are restricted to the same vessel. Useful for strengthening a vessel. +description = End point for building a strut from eva. Links are restricted to the same vessel. Usefull for strengthen a vessel. // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision, allowDock, allowRotate attachRules = 0,1,0,0,1 diff --git a/Parts/winch1/winch1.cfg b/Parts/winch1/winch1.cfg index bd1036fa..6349b090 100644 --- a/Parts/winch1/winch1.cfg +++ b/Parts/winch1/winch1.cfg @@ -17,7 +17,7 @@ node_stack_front = -0.155, 0.00, -0.241805, 0.0, 0.0, 1.0, 0 node_stack_top = 0.0, 0.1, 0.0, 0.0, 1.0, 0.0, 0 node_stack_bottom = 0.0, -0.1, 0.0, 0.0, 1.0, 0.0, 0 -cost = 800 +cost = 350 category = Utility subcategory = 0 title = Horizontal stack winch (0.5m) diff --git a/Parts/winch2/winch2.cfg b/Parts/winch2/winch2.cfg index e38d0aaf..b2c57f0b 100644 --- a/Parts/winch2/winch2.cfg +++ b/Parts/winch2/winch2.cfg @@ -17,7 +17,7 @@ node_stack_bottom = 0.0, -0.2850344, 0.0, 0.0, 1.0, 0.0, 0 node_stack_top = 0.0, 0.1, 0.0, 0.0, 1.0, 0.0, 0 //node_attach = 0.0, 0.1, 0.0, 0.0, 1.0, 0.0, 0 -cost = 800 +cost = 600 category = Utility subcategory = 0 title = Vertical stack winch (0.5m) From 0bd878e52733292058e7d830d693f8f8bd69d583 Mon Sep 17 00:00:00 2001 From: Eric Harris Date: Mon, 29 Sep 2014 22:58:49 -0400 Subject: [PATCH 15/22] Implemented IPartCostModifier. --- Plugin/KASModuleContainer.cs | 74 +++++++++++++++++++++++++++++++++++- Plugin/KAS_Shared.cs | 13 ++++++- 2 files changed, 84 insertions(+), 3 deletions(-) diff --git a/Plugin/KASModuleContainer.cs b/Plugin/KASModuleContainer.cs index f673eb48..078327bc 100644 --- a/Plugin/KASModuleContainer.cs +++ b/Plugin/KASModuleContainer.cs @@ -7,7 +7,7 @@ namespace KAS { - public class KASModuleContainer : PartModule + public class KASModuleContainer : PartModule, IPartCostModifier { [KSPField] public float maxSize = 10f; [KSPField] public float maxOpenDistance = 2f; @@ -292,6 +292,8 @@ private void Add(AvailablePart avPart, int qty) item.pristine_count += qty; RefreshTotalSize(); } + + GameEvents.onEditorShipModified.Fire(EditorLogic.fetch.ship); } private void Remove(AvailablePart avPart, int qty) @@ -301,6 +303,8 @@ private void Remove(AvailablePart avPart, int qty) { item.pristine_count = Math.Max(0, item.pristine_count - qty); RefreshTotalSize(); + + GameEvents.onEditorShipModified.Fire(EditorLogic.fetch.ship); } else { @@ -809,6 +813,7 @@ private Vector2 GuiContentList(Dictionary contentsList, Show GUILayout.Label(new GUIContent("Weight : " + actionContainer.part.mass.ToString("0.000"), "Total weight of the container with contents"), guiRightWhiteStyle); GUILayout.Label(new GUIContent(" | Space : " + actionContainer.totalSize.ToString("0.0") + " / " + actionContainer.maxSize.ToString("0.0"), "Space used / Max space"), guiRightWhiteStyle); + GUILayout.Label(new GUIContent(" | Cost : √" + actionContainer.GetModuleCost().ToString("0.00"), "Total cost of the container's contents"), guiRightWhiteStyle); GUILayout.EndHorizontal(); GUILayout.EndVertical(); } @@ -828,5 +833,72 @@ public void ContextMenuOpenContainer() ViewContents(); } } + + #region IPartCostModifier Implementation + + private float CalculateResourceCost(PartResourceDefinition resourceDefinition, float amount, float maxAmount) + { + float result = 0.0f; + + // A part's cost is dry + resources. Remove the total resource cost and then add + // the cost for the actual amount of the resource in the part. (This will yield a negative + // result if amount < maxAmount.) + result -= resourceDefinition.unitCost * maxAmount; + result += resourceDefinition.unitCost * amount; + + return result; + } + + public float GetModuleCost() + { + float result = 0.0f; + + Dictionary contents = this.GetContent(); + + // Iterate through the contents, of which there may be multiple of each part. + foreach(PartContent partContent in contents.Values) + { + // Iterate through all of the instances of this part. (stateless = false) + foreach(ConfigNode partConfigNode in partContent.instances) + { + ProtoPartSnapshot partSnapshot = KAS_Shared.LoadProtoPartSnapshot(partConfigNode); + + // Add the base cost and the calculated module costs for this specific instance, in case one or more modules need to + // adjust the part's cost based on this instance's saved state. + float instancedPartCost = partContent.part.cost + partSnapshot.moduleCosts; + + foreach(ProtoPartResourceSnapshot resourceSnapshot in partSnapshot.resources) + { + float amount = float.Parse(resourceSnapshot.resourceValues.GetValue("amount")); + float maxAmount = float.Parse(resourceSnapshot.resourceValues.GetValue("maxAmount")); + + PartResourceDefinition resourceDefinition = PartResourceLibrary.Instance.GetDefinition(resourceSnapshot.resourceName); + + // Add the resource cost, which if amount != maxAmount will actually be a negative number because the base part cost + // includes the cost of maxAmount of the resource. + instancedPartCost += this.CalculateResourceCost(resourceDefinition, amount, maxAmount); + } + + result += instancedPartCost; + } + + // The rest of the parts are pristine and have a common base cost. + float singlePartCost = partContent.part.cost + partContent.part.partPrefab.GetModuleCosts(); + + // And the pristine parts have a common resource cost. + foreach(PartResource partResource in partContent.part.partPrefab.Resources) + { + // NOTE: See comment on the above CalculateResourceCost call. + singlePartCost += this.CalculateResourceCost(partResource.info, (float)partResource.amount, (float)partResource.maxAmount); + } + + // Tack on the total cost of the pristine parts. + result += singlePartCost * partContent.pristine_count; + } + + return result; + } + + #endregion } } diff --git a/Plugin/KAS_Shared.cs b/Plugin/KAS_Shared.cs index 6ad4c2bb..c5e5d0d3 100644 --- a/Plugin/KAS_Shared.cs +++ b/Plugin/KAS_Shared.cs @@ -647,14 +647,23 @@ public void Restore(Rigidbody rb) } } - public static Part LoadPartSnapshot(Vessel vessel, ConfigNode node, Vector3 position, Quaternion rotation) + public static ProtoPartSnapshot LoadProtoPartSnapshot(ConfigNode node) { + ProtoPartSnapshot result = null; + ConfigNode node_copy = new ConfigNode(); node.CopyTo(node_copy); node_copy.RemoveValues("kas_total_mass"); - ProtoPartSnapshot snapshot = new ProtoPartSnapshot(node_copy, null, HighLogic.CurrentGame); + result = new ProtoPartSnapshot(node_copy, null, HighLogic.CurrentGame); + + return result; + } + + public static Part LoadPartSnapshot(Vessel vessel, ConfigNode node, Vector3 position, Quaternion rotation) + { + ProtoPartSnapshot snapshot = KAS_Shared.LoadProtoPartSnapshot(node); if (HighLogic.CurrentGame.flightState.ContainsFlightID(snapshot.flightID)) snapshot.flightID = ShipConstruction.GetUniqueFlightID(HighLogic.CurrentGame.flightState); From 96a4a3242e8510dbb5a6ac81db03e17b2a9612ac Mon Sep 17 00:00:00 2001 From: Eric Harris Date: Tue, 7 Oct 2014 21:14:07 -0400 Subject: [PATCH 16/22] Implemented science recovery. Fixed minor UI glitch in container editor. --- Plugin/KASModuleContainer.cs | 104 ++++++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 3 deletions(-) diff --git a/Plugin/KASModuleContainer.cs b/Plugin/KASModuleContainer.cs index 078327bc..5f156d33 100644 --- a/Plugin/KASModuleContainer.cs +++ b/Plugin/KASModuleContainer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Collections.Generic; using System.Collections; @@ -7,7 +7,7 @@ namespace KAS { - public class KASModuleContainer : PartModule, IPartCostModifier + public class KASModuleContainer : PartModule, IPartCostModifier, IScienceDataContainer { [KSPField] public float maxSize = 10f; [KSPField] public float maxOpenDistance = 2f; @@ -123,7 +123,7 @@ public ConfigNode PopInstance() public Dictionary availableContents = new Dictionary(); public Dictionary contents = new Dictionary(); - + private KASModuleContainer exchangeContainer = null; public float totalSize = 0; private bool waitAndGrabRunning = false; @@ -179,12 +179,24 @@ public override void OnSave(ConfigNode node) { item.Save(node); } + + List scienceData = this.RecoverScienceContent(); + + // We save the data in case the vessel is recovered, but in OnLoad, we don't care about "recovered" science data - the contents + // of this containerwill be restored and retain the data. We'll recover it again in future calls to OnSave. + foreach(ScienceData scienceDataItem in scienceData) + { + scienceDataItem.Save(node.AddNode("ScienceData")); + } } public override void OnLoad(ConfigNode node) { base.OnLoad(node); + // Do not load ScienceData nodes for this module's host part (a KAS container) as they were only stored in case the vessel was + // recovered. The original parts still contain the science data. (See OnSave.) + if (node.HasNode("CONTENT") || node.HasNode("CONTENT_PART")) { contents.Clear(); @@ -232,6 +244,48 @@ void OnVesselChange(Vessel vess) } } + private List RecoverScienceContent() + { + List result = new List(); + + Dictionary contents = this.GetContent(); + + // Iterate through the contents, of which there may be multiple of each part. + foreach(PartContent partContent in contents.Values) + { + // Iterate through all of the instances of this part. (stateless = false) + foreach(ConfigNode partConfigNode in partContent.instances) + { + ProtoPartSnapshot partSnapshot = KAS_Shared.LoadProtoPartSnapshot(partConfigNode); + + foreach(ProtoPartModuleSnapshot moduleSnapshot in partSnapshot.modules) + { + // In order to load the state of the module, it must be added to a part. Temporarily add it to this + // module's host part and then remove it after it is evaluated. + int moduleIndex = this.part.Modules.Count; + part.AddModule(moduleSnapshot.moduleName); + + PartModule module = moduleSnapshot.Load(this.part, ref moduleIndex); + + // ModuleScienceExperiment and ModuleScienceContainer implement IScienceDataContainer. Also, because KASModuleContainer + // now implements IScienceDataContainer, it is conceivable that nested KAS containers with science data will be properly + // recovered. + if(module is IScienceDataContainer) + { + IScienceDataContainer scienceDataContainer = (IScienceDataContainer)module; + + // Duplicate science experiments are OK, the science awards are evaluated correctly by KSP. + result.AddRange(scienceDataContainer.GetData()); + } + + this.part.RemoveModule(module); + } + } + } + + return result; + } + void OnDestroy() { GameEvents.onVesselChange.Remove(new EventData.OnEvent(this.OnVesselChange)); @@ -649,6 +703,7 @@ private void GuiMainWindow(int windowID) GUILayout.BeginHorizontal(); if (GUILayout.Button(new GUIContent("Close", "Close container"), guiButtonStyle, GUILayout.Width(60f))) { + this.activeEditTab = EditTab.All; CloseAllGUI(); fxSndClose.audio.Play(); } @@ -900,5 +955,48 @@ public float GetModuleCost() } #endregion + + #region IScienceDataContainer Implementation + + // IScienceDataContainer is implemented so that KASModuleContainer is a IScienceDataContainer to ensure it gets + // evaluated during vessel recovery. However, during vessel recovery the GetData() method is not called to retrieve + // the actual science from the module. Rather, the vessel's saved state is used with a ProtoVessel and science is + // recovered by examining the ScienceData ConfigNode(s). (See OnSave().) + + public void DumpData(ScienceData data) + { + // Not called during vessel recovery and a KAS container doesn't expose container services to the player. + } + + public ScienceData[] GetData() + { + List scienceData = this.RecoverScienceContent(); + + return scienceData.ToArray(); + } + + public int GetScienceCount() + { + List scienceData = this.RecoverScienceContent(); + + return scienceData.Count; + } + + public bool IsRerunnable() + { + return false; + } + + public void ReviewData() + { + // Not called during vessel recovery and a KAS container doesn't expose container services to the player. + } + + public void ReviewDataItem(ScienceData data) + { + // Not called during vessel recovery and a KAS container doesn't expose container services to the player. + } + + #endregion } } From ccdec0aa10c798da6ad9b62ab379fc4bf67bc867 Mon Sep 17 00:00:00 2001 From: Eric Harris Date: Tue, 7 Oct 2014 21:18:04 -0400 Subject: [PATCH 17/22] Converted addModule.cfg to Module Manager patches; renamed file. Added a patch to fixup any 3rd party storable science parts for recovery from containers. --- MM_Science.cfg | 15 ++ MM_Squad.cfg | 489 +++++++++++++++++++++++++++++++++++++++++++++++++ addModule.cfg | 385 -------------------------------------- 3 files changed, 504 insertions(+), 385 deletions(-) create mode 100644 MM_Science.cfg create mode 100644 MM_Squad.cfg delete mode 100644 addModule.cfg diff --git a/MM_Science.cfg b/MM_Science.cfg new file mode 100644 index 00000000..b39df588 --- /dev/null +++ b/MM_Science.cfg @@ -0,0 +1,15 @@ +@PART[*]:HAS[@MODULE[KASModuleGrab],@MODULE[ModuleScienceExperiment]]:FOR[KAS] +{ + @MODULE[KASModuleGrab]:HAS[#storable[true]] + { + %stateless = false + } +} + +@PART[*]:HAS[@MODULE[KASModuleGrab],@MODULE[ModuleScienceContainer]]:FOR[KAS] +{ + @MODULE[KASModuleGrab]:HAS[#storable[true]] + { + %stateless = false + } +} diff --git a/MM_Squad.cfg b/MM_Squad.cfg new file mode 100644 index 00000000..121f45ea --- /dev/null +++ b/MM_Squad.cfg @@ -0,0 +1,489 @@ +@PART[KAS_ContainerBay1]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.40, -0.10) + evaPartDir = (0,0,-1) + attachNodeName = bottom + attachOnPart = True + attachOnEva = False + attachOnStatic = True + attachSendMsgOnly = False + } +} + +@PART[linearRcs]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.21) + evaPartDir = (0,0,-1) + dropAtGroundPos = false + dropPartPos = (0.0, -0.1, -0.65) + dropPartRot = (0.0, 90.0, 0.0) + addPartMass = true + storable = true + storedSize = 4 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[RCSBlock]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.18) + evaPartDir = (0,0,-1) + storable = true + storedSize = 6 + attachOnPart = True + attachOnEva = True + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[roverWheel2]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.48, -0.14) + evaPartDir = (0,-0.3,-1) + storable = true + storedSize = 30 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[batteryPack]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.15) + evaPartDir = (0,0,-1) + storable = true + stateless = false + storedSize = 10 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[spotLight1]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.15) + evaPartDir = (0,0,-1) + storable = true + storedSize = 8 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[spotLight2]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.15) + evaPartDir = (0,0,-1) + storable = true + storedSize = 8 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[ladder1]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, -0.03, -0.1) + evaPartDir = (0,0,-1) + storable = true + storedSize = 5 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[telescopicLadder]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, -0.07, -0.34) + evaPartDir = (0,0,-1) + storable = true + storedSize = 25 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[telescopicLadderBay]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, -0.07, -0.34) + evaPartDir = (0,0,-1) + storable = true + storedSize = 30 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[solarPanels1]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.22) + evaPartDir = (0,0,-1) + storable = true + storedSize = 10 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[solarPanels2]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.22) + evaPartDir = (0,0,-1) + storable = true + storedSize = 10 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[solarPanels3]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.22) + evaPartDir = (0,0,-1) + storable = true + storedSize = 10 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[solarPanels4]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.22) + evaPartDir = (0,0,-1) + storable = true + storedSize = 10 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[solarPanels5]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.12, -0.14) + evaPartDir = (0,0,-1) + storable = true + storedSize = 10 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False} +} + +@PART[rtg]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.10) + evaPartDir = (0,0,-1) + storable = true + storedSize = 20 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[seatExternalCmd]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.15) + evaPartDir = (0,0,-1) + storable = true + storedSize = 20 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[smallRadialEngine]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.12, -0.14) + evaPartDir = (0,0,-1) + storable = true + storedSize = 15 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[radialEngineMini]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.15) + evaPartDir = (0,0,-1) + storable = true + storedSize = 10 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[radialRCSTank]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.29) + evaPartDir = (0,0,-1) + storable = true + stateless = false + storedSize = 30 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[xenonTankRadial]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.15) + evaPartDir = (0,0,-1) + storable = true + stateless = false + storedSize = 25 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[strutCube]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.11) + evaPartDir = (0,0,-1) + storable = true + storedSize = 5 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[sensorAccelerometer]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.12) + evaPartDir = (0,0,-1) + storable = true + stateless = false + storedSize = 5 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[sensorBarometer]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.12) + evaPartDir = (0,0,-1) + storable = true + stateless = false + storedSize = 5 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[sensorGravimeter]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.12) + evaPartDir = (0,0,-1) + storable = true + stateless = false + storedSize = 5 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[sensorThermometer]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.12) + evaPartDir = (0,0,-1) + storable = true + stateless = false + storedSize = 5 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[commDish]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.35) + evaPartDir = (0,0,-1) + storable = true + storedSize = 10 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[mediumDishAntenna]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.15, -0.18) + evaPartDir = (0,-0.15,-1) + storable = true + storedSize = 8 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[longAntenna]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.00, -0.09) + evaPartDir = (0,0,-1) + storable = true + storedSize = 5 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} + +@PART[parachuteRadial]:FOR[KAS] +{ + MODULE + { + name = KASModuleGrab + evaPartPos = (0.0, 0.09, -0.23) + evaPartDir = (0,0,-1) + physicJoint = true + storable = true + storedSize = 5 + attachOnPart = True + attachOnEva = False + attachOnStatic = False + attachSendMsgOnly = False + } +} \ No newline at end of file diff --git a/addModule.cfg b/addModule.cfg deleted file mode 100644 index 39e236f2..00000000 --- a/addModule.cfg +++ /dev/null @@ -1,385 +0,0 @@ -///////// linearRcs /////// -GRAB -{ - stockPartName = linearRcs - evaPartPos = (0.0, 0.00, -0.21) - evaPartDir = (0,0,-1) - dropAtGroundPos = false - dropPartPos = (0.0, -0.1, -0.65) - dropPartRot = (0.0, 90.0, 0.0) - addPartMass = true - storable = true - storedSize = 4 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// RCSBlock /////// -GRAB -{ - stockPartName = RCSBlock - evaPartPos = (0.0, 0.00, -0.18) - evaPartDir = (0,0,-1) - storable = true - storedSize = 6 - attachOnPart = True - attachOnEva = True - attachOnStatic = False - attachSendMsgOnly = False -} -///////// roverWheel2 /////// -GRAB -{ - stockPartName = roverWheel2 - evaPartPos = (0.0, 0.48, -0.14) - evaPartDir = (0,-0.3,-1) - storable = true - storedSize = 30 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// batteryPack /////// -GRAB -{ - stockPartName = batteryPack - evaPartPos = (0.0, 0.00, -0.15) - evaPartDir = (0,0,-1) - storable = true - stateless = false - storedSize = 10 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// spotLight1 /////// -GRAB -{ - stockPartName = spotLight1 - evaPartPos = (0.0, 0.00, -0.15) - evaPartDir = (0,0,-1) - storable = true - storedSize = 8 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// spotLight2 /////// -GRAB -{ - stockPartName = spotLight2 - evaPartPos = (0.0, 0.00, -0.15) - evaPartDir = (0,0,-1) - storable = true - storedSize = 8 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// ladder1 /////// -GRAB -{ - stockPartName = ladder1 - evaPartPos = (0.0, -0.03, -0.1) - evaPartDir = (0,0,-1) - storable = true - storedSize = 5 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// telescopicLadder /////// -GRAB -{ - stockPartName = telescopicLadder - evaPartPos = (0.0, -0.07, -0.34) - evaPartDir = (0,0,-1) - storable = true - storedSize = 25 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// telescopicLadderBay /////// -GRAB -{ - stockPartName = telescopicLadderBay - evaPartPos = (0.0, -0.07, -0.34) - evaPartDir = (0,0,-1) - storable = true - storedSize = 30 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// solarPanels1 /////// -GRAB -{ - stockPartName = solarPanels1 - evaPartPos = (0.0, 0.00, -0.22) - evaPartDir = (0,0,-1) - storable = true - storedSize = 10 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// solarPanels2 /////// -GRAB -{ - stockPartName = solarPanels2 - evaPartPos = (0.0, 0.00, -0.22) - evaPartDir = (0,0,-1) - storable = true - storedSize = 10 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// solarPanels3 /////// -GRAB -{ - stockPartName = solarPanels3 - evaPartPos = (0.0, 0.00, -0.22) - evaPartDir = (0,0,-1) - storable = true - storedSize = 10 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// solarPanels4 /////// -GRAB -{ - stockPartName = solarPanels4 - evaPartPos = (0.0, 0.00, -0.22) - evaPartDir = (0,0,-1) - storable = true - storedSize = 10 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// solarPanels5 /////// -GRAB -{ - stockPartName = solarPanels5 - evaPartPos = (0.0, 0.12, -0.14) - evaPartDir = (0,0,-1) - storable = true - storedSize = 10 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// rtg /////// -GRAB -{ - stockPartName = rtg - evaPartPos = (0.0, 0.00, -0.10) - evaPartDir = (0,0,-1) - storable = true - storedSize = 20 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// seatExternalCmd /////// -GRAB -{ - stockPartName = seatExternalCmd - evaPartPos = (0.0, 0.00, -0.15) - evaPartDir = (0,0,-1) - storable = true - storedSize = 20 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// smallRadialEngine /////// -GRAB -{ - stockPartName = smallRadialEngine - evaPartPos = (0.0, 0.12, -0.14) - evaPartDir = (0,0,-1) - storable = true - storedSize = 15 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// radialEngineMini /////// -GRAB -{ - stockPartName = radialEngineMini - evaPartPos = (0.0, 0.00, -0.15) - evaPartDir = (0,0,-1) - storable = true - storedSize = 10 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// radialRCSTank /////// -GRAB -{ - stockPartName = radialRCSTank - evaPartPos = (0.0, 0.00, -0.29) - evaPartDir = (0,0,-1) - storable = true - stateless = false - storedSize = 30 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// xenonTankRadial /////// -GRAB -{ - stockPartName = xenonTankRadial - evaPartPos = (0.0, 0.00, -0.15) - evaPartDir = (0,0,-1) - storable = true - stateless = false - storedSize = 25 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// strutCube /////// -GRAB -{ - stockPartName = strutCube - evaPartPos = (0.0, 0.00, -0.11) - evaPartDir = (0,0,-1) - storable = true - storedSize = 5 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// sensorAccelerometer /////// -GRAB -{ - stockPartName = sensorAccelerometer - evaPartPos = (0.0, 0.00, -0.12) - evaPartDir = (0,0,-1) - storable = true - storedSize = 5 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// sensorBarometer /////// -GRAB -{ - stockPartName = sensorBarometer - evaPartPos = (0.0, 0.00, -0.12) - evaPartDir = (0,0,-1) - storable = true - storedSize = 5 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// sensorGravimeter /////// -GRAB -{ - stockPartName = sensorGravimeter - evaPartPos = (0.0, 0.00, -0.12) - evaPartDir = (0,0,-1) - storable = true - storedSize = 5 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// sensorThermometer /////// -GRAB -{ - stockPartName = sensorThermometer - evaPartPos = (0.0, 0.00, -0.12) - evaPartDir = (0,0,-1) - storable = true - storedSize = 5 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// commDish /////// -GRAB -{ - stockPartName = commDish - evaPartPos = (0.0, 0.00, -0.35) - evaPartDir = (0,0,-1) - storable = true - storedSize = 10 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// mediumDishAntenna /////// -GRAB -{ - stockPartName = mediumDishAntenna - evaPartPos = (0.0, 0.15, -0.18) - evaPartDir = (0,-0.15,-1) - storable = true - storedSize = 8 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// longAntenna /////// -GRAB -{ - stockPartName = longAntenna - evaPartPos = (0.0, 0.00, -0.09) - evaPartDir = (0,0,-1) - storable = true - storedSize = 5 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} -///////// parachuteRadial /////// -GRAB -{ - stockPartName = parachuteRadial - evaPartPos = (0.0, 0.09, -0.23) - evaPartDir = (0,0,-1) - physicJoint = true - storable = true - storedSize = 5 - attachOnPart = True - attachOnEva = False - attachOnStatic = False - attachSendMsgOnly = False -} \ No newline at end of file From 7a12ea9110883e4f544102ef8f357e8cb97485ae Mon Sep 17 00:00:00 2001 From: KospY Date: Wed, 8 Oct 2014 13:41:43 +0200 Subject: [PATCH 18/22] KSP 0.25 Compatibility fix --- Plugin/CompatibilityChecker.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugin/CompatibilityChecker.cs b/Plugin/CompatibilityChecker.cs index 106d26c7..09098a00 100644 --- a/Plugin/CompatibilityChecker.cs +++ b/Plugin/CompatibilityChecker.cs @@ -53,8 +53,8 @@ public static bool IsCompatible() \*-----------------------------------------------*/ const int compatibleMajor = 0; - const int compatibleMinor = 24; - const int compatibleRevision = 2; + const int compatibleMinor = 25; + const int compatibleRevision = 0; return (Versioning.version_major == compatibleMajor) && (Versioning.version_minor == compatibleMinor) && (Versioning.Revision == compatibleRevision); From 7324e6137f9482eb37ce1463d7288425025c8442 Mon Sep 17 00:00:00 2001 From: KospY Date: Wed, 8 Oct 2014 13:42:08 +0200 Subject: [PATCH 19/22] Project file update --- Plugin/KAS.csproj | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Plugin/KAS.csproj b/Plugin/KAS.csproj index e77711df..b929d0b8 100644 --- a/Plugin/KAS.csproj +++ b/Plugin/KAS.csproj @@ -30,10 +30,14 @@ 4 - + + ..\..\..\Games\KSP\KSP_Data\Managed\Assembly-CSharp.dll + - + + ..\..\..\Games\KSP\KSP_Data\Managed\UnityEngine.dll + @@ -63,9 +67,8 @@ - IF EXIST "D:\ServerFolders" xcopy "$(TargetPath)" "D:\ServerFolders\Softwares\SyncFolder\KSP_0.20\GameData\KAS\Plugins\" /Y -IF EXIST "c:\games\KSP" xcopy "$(TargetPath)" "c:\games\KSP\GameData\KAS\Plugins\" /Y -IF EXIST "D:\games\KSP" xcopy "$(TargetPath)" "D:\games\KSP\GameData\KAS\Plugins\" /Y + IF EXIST "D:\games\KSP" xcopy "$(TargetPath)" "D:\games\KSP\GameData\KAS\Plugins\" /Y +IF EXIST "E:\games\KSP" xcopy "$(TargetPath)" "E:\games\KSP\GameData\KAS\Plugins\" /Y