diff --git a/DSUtil.cs b/DSUtil.cs
index 7cf501c..f73fc5c 100644
--- a/DSUtil.cs
+++ b/DSUtil.cs
@@ -1,7 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using UnityEngine;
namespace DockingStrut
diff --git a/Docking-Strut.zip b/Docking-Strut.zip
new file mode 100644
index 0000000..8ddead4
Binary files /dev/null and b/Docking-Strut.zip differ
diff --git a/Docking-Strut/Parts/DockingStrut/model.mu b/Docking-Strut/Parts/DockingStrut/model.mu
new file mode 100644
index 0000000..b129b5c
Binary files /dev/null and b/Docking-Strut/Parts/DockingStrut/model.mu differ
diff --git a/Docking-Strut/Parts/DockingStrut/model000.mbm b/Docking-Strut/Parts/DockingStrut/model000.mbm
new file mode 100644
index 0000000..fa43c4e
Binary files /dev/null and b/Docking-Strut/Parts/DockingStrut/model000.mbm differ
diff --git a/Docking-Strut/Parts/DockingStrut/part.cfg b/Docking-Strut/Parts/DockingStrut/part.cfg
new file mode 100644
index 0000000..e77f3f8
--- /dev/null
+++ b/Docking-Strut/Parts/DockingStrut/part.cfg
@@ -0,0 +1,64 @@
+// this is a sample config file, for determining a good file format for defining part parameters
+// comment line - ignored by cfg parser
+// empty lines, or lines without a '=' sign are also ignored
+// all other lines are split at the '=' sign, and the left operand is used to know what parameter we are setting
+// diferent parameters require data in different formats (see docs), and each module has it's own parameters (again, see docs)
+// each assignment must be in a single line. Lines without assignments will be ignored. (You CAN turn on word wrap, though)
+// each keyword here relates to an existing variable in the assigned module. If the keyword isn't found, it is ignored.
+// conversely, if a keyword is left unassigned (as in not in the file), it will be initialized with it's default value
+// This is done automatically, so any public variable defined in the loaded module can be accessed this way (provided it's value can be parsed)--
+
+PART
+{
+ // --- general parameters ---
+ name = DockingStrut
+ module = Part
+ author = HarvesteR || JDP
+
+ // --- asset parameters ---
+ mesh = model.mu
+ scale = 0.1
+
+ // --- editor parameters ---
+ cost = 250
+ category = Structural
+ subcategory = 0
+ title = EAS-5 Docking Strut
+ manufacturer = Kerlington Model Rockets and Paper Products Inc.
+ description = The Strut Connector is highly regarded by many spacecraft engineers as it helps in constructing more stable spacecraft. This update to the popular EAS-4 Strut is configurable in flight and can thus be used to stabilize docked ships.
+
+ // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
+ attachRules = 0,1,0,0,1
+
+ // --- node definitions ---
+ // definition format is Position X, Position Y, Position Z, Up X, Up Y, Up Z
+ node_attach = 0.0, 0.0, 0.0, -1.0, 0.0, 0.0
+
+
+ // --- standard part parameters ---
+ mass = 0.05
+ dragModelType = default
+ maximum_drag = 0.02
+ minimum_drag = 0.02
+ angularDrag = 1
+ crashTolerance = 12
+ breakingForce = 200
+ breakingTorque = 200
+ maxTemp = 3600
+ explosionPotential = 0
+
+
+
+ MODULE
+ {
+ name = ModuleDockingStrut
+ MaxDistance = 10
+ breakingForce = 200
+ breakingTorque = 200
+ }
+
+}
+
+
+// ----- DO NOT EDIT BELOW THIS POINT ------
+
diff --git a/Docking-Strut/Plugins/DockingStrut.dll b/Docking-Strut/Plugins/DockingStrut.dll
new file mode 100644
index 0000000..4148367
Binary files /dev/null and b/Docking-Strut/Plugins/DockingStrut.dll differ
diff --git a/DockingStrut.csproj b/DockingStrut.csproj
new file mode 100644
index 0000000..1e47e87
--- /dev/null
+++ b/DockingStrut.csproj
@@ -0,0 +1,71 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {7A0868B5-18C4-49FC-9587-7ED2170D91F0}
+ Library
+ Properties
+ DockingStrut
+ DockingStrut
+ v3.5
+ 512
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ False
+ ..\..\KSPDLLs\Assembly-CSharp.dll
+
+
+ ..\..\KSPDLLs\KSPUtil.dll
+
+
+
+
+
+
+
+
+ False
+ ..\..\KSPDLLs\UnityEngine.dll
+
+
+ ..\..\KSPDLLs\UnityEngine.UI.dll
+
+
+
+
+
+
+
+
+
+ cd "$(TargetDir)"
+"C:\Program Files (x86)\mono\bin\mono.exe" "C:\Program Files (x86)\mono\lib\mono\4.5\pdb2mdb.exe" "$(TargetFileName)"
+
+
+
\ No newline at end of file
diff --git a/ModuleDockingStrut.cs b/ModuleDockingStrut.cs
index dff3ea6..a1f94d7 100644
--- a/ModuleDockingStrut.cs
+++ b/ModuleDockingStrut.cs
@@ -16,16 +16,19 @@ This code is free to use and modify as long as the original author is credited.
- Reworked joint linkage to get rid of phantom forces.
- Added new ID system.
- Reworked the way the visual strut is rescaled.
+
+ 1.0.2.0
+ - Updated for KSP 1.0.5 (JPLRepo)
+
+ 1.0.3.0
+ - Updated for KSP 1.1 (JPLRepo)
*/
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using UnityEngine;
namespace DockingStrut {
public class ModuleDockingStrut : PartModule {
- float StrutX, StrutY;
+ float StrutX, StrutY, StrutZ;
[KSPField]
int ticksToCheckForLinkAtStart = 100;
@@ -33,7 +36,7 @@ public class ModuleDockingStrut : PartModule {
[KSPField]
public float MaxDistance = 10;
- [KSPField(isPersistant = true, guiActive = true)]
+ [KSPField(isPersistant = true, guiActive = false)]
public string TargetIDs = Guid.Empty.ToString(), IDs = Guid.Empty.ToString();
public Guid TargetID {
@@ -213,10 +216,10 @@ void updateLink() {
}
}
- if (jointCreated != Targeted && !part.rigidbody.isKinematic && TargetDS != null && !TargetDS.part.rigidbody.isKinematic) {
+ if (jointCreated != Targeted && !part.Rigidbody.isKinematic && TargetDS != null && !TargetDS.part.Rigidbody.isKinematic) {
if (Targeted) {
- joint = part.rigidbody.gameObject.AddComponent();
- joint.connectedBody = TargetDS.part.rigidbody;
+ joint = part.Rigidbody.gameObject.AddComponent();
+ joint.connectedBody = TargetDS.part.Rigidbody;
joint.breakForce = joint.breakTorque = float.PositiveInfinity;
joint.xMotion = ConfigurableJointMotion.Locked;
joint.yMotion = ConfigurableJointMotion.Locked;
@@ -224,6 +227,9 @@ void updateLink() {
joint.angularXMotion = ConfigurableJointMotion.Locked;
joint.angularYMotion = ConfigurableJointMotion.Locked;
joint.angularZMotion = ConfigurableJointMotion.Locked;
+ joint.projectionAngle = 0f;
+ joint.projectionDistance = 0f;
+ joint.anchor = TargetDS.strutTarget;
} else {
Destroy(joint);
joint = null;
@@ -254,7 +260,7 @@ public void SetTarget(ModuleDockingStrut PosTarget) {
if (!DSUtil.checkPossibleTarget(this, PosTarget)) {
mode = DSMode.UNLINKED;
Targeted = false;
- return;
+ return;
}
foreach (BaseEvent e in Events)
@@ -268,10 +274,11 @@ public void SetTarget(ModuleDockingStrut PosTarget) {
SetStrutEnd(TargetDS.strutTarget);
}
- void SetStrutEnd(Vector3 position) {
- mStrut.LookAt(position);
- mStrut.localScale = new Vector3(StrutX, StrutY, 1);
- mStrut.localScale = new Vector3(StrutX, StrutY, Vector3.Distance(Vector3.zero, mStrut.InverseTransformPoint(position)));
+ void SetStrutEnd(Vector3 target) {
+ mStrut.LookAt(target);
+ mStrut.localScale = new Vector3(StrutX, StrutY, 1);
+ var distance = (Vector3.Distance(Vector3.zero, mStrut.InverseTransformPoint(target)));
+ mStrut.localScale = new Vector3(StrutX, StrutY, distance * StrutZ);
}
bool started = false;
@@ -280,6 +287,7 @@ public override void OnStart(PartModule.StartState state) {
StrutX = mStrut.localScale.x;
StrutY = mStrut.localScale.y;
+ StrutZ = mStrut.localScale.z;
mStrut.localScale = Vector3.zero;
if (state == StartState.Editor) return;
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..dd1cc07
--- /dev/null
+++ b/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("DockingStrut")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("DockingStrut")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7a0868b5-18c4-49fc-9587-7ed2170d91f0")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.3.0")]
+[assembly: AssemblyFileVersion("1.0.3.0")]