Skip to content

Commit

Permalink
Merge pull request #215 from ihsoft/next-1.0
Browse files Browse the repository at this point in the history
Beta7
  • Loading branch information
ihsoft authored Oct 26, 2017
2 parents b2e8aa8 + 51f7f21 commit 2bec15c
Show file tree
Hide file tree
Showing 41 changed files with 2,463 additions and 1,674 deletions.
Binary file removed Binaries/KSPDev_Utils.0.26.dll
Binary file not shown.
Binary file added Binaries/KSPDev_Utils.0.29.dll
Binary file not shown.
1,693 changes: 1,068 additions & 625 deletions Binaries/KSPDev_Utils.0.26.xml → Binaries/KSPDev_Utils.0.29.xml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions KAS-1.0.version
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"NAME": "KAS-1.0",
"URL": "https://raw.githubusercontent.com/ihsoft/KAS/KAS-v1.0/KAS-1.0.version",
"VERSION": {
"BUILD": 42780,
"BUILD": 42858,
"MAJOR": 1,
"MINOR": 0,
"PATCH": 6436
"PATCH": 6507
}
}
5 changes: 3 additions & 2 deletions Parts/CableBrace/part_PCB1.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ PART
attachNodePosition = 0.0, 0.1191, 0.0
attachNodeOrientation = 0.0, 1.0, 0.0
// KASModuleInteractiveJointSource
plugSndPath = KAS-1.0/Sounds/grappleAttachEva
unplugSndPath = KAS-1.0/Sounds/grappleDetach
sndPathPlug = KAS-1.0/Sounds/grappleAttachEva
sndPathUnplug = KAS-1.0/Sounds/grappleDetach
sndPathBroken = KAS-1.0/Sounds/broke
startLinkMenu = Link
breakLinkMenu = Unlink
}
Expand Down
12 changes: 8 additions & 4 deletions Parts/JS1/part.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ PART
cost = 750
category = Structural
subcategory = 0
title = #KAS_TJ1_Part_title //#KAS_TJ1_Part_title = TJ-1 Fixed Telescopic Joint
manufacturer = #KAS_TJ1_Part_manufacturer //#KAS_TJ1_Part_manufacturer = KAS
description = #KAS_TJ1_Part_description //#KAS_TJ1_Part_description = A simple telescopic pipe to rigidly connect two vessels.
title = #KAS_JS1_Part_title //#KAS_JS1_Part_title = JS-1 Joint Socket
manufacturer = #KAS_JS1_Part_manufacturer //#KAS_JS1_Part_manufacturer = KAS
description = #KAS_JS1_Part_description //#KAS_JS1_Part_description = A socket for joint parts. Doesn't require tools to connect parts as long as the other part supports connecting.
attachRules = 1,1,1,0,1
mass = 0.08
dragModelType = default
Expand All @@ -26,7 +26,7 @@ PART
breakingTorque = 200
maxTemp = 2000
bulkheadProfiles = srf
tags = #KAS_TJ1_Part_tags //#KAS_TJ1_Part_tags = KIS KAS pipe tube cck-kas
tags = #KAS_JS1_Part_tags //#KAS_JS1_Part_tags = KIS KAS pipe tube cck-kas
MODULE
{
name = KASModuleLinkTargetBase
Expand All @@ -43,4 +43,8 @@ PART
attachNodePosition = 0.0, 0.0362, 0.0
attachNodeOrientation = 0.0, 1.0, 0.0
}
MODULE
{
name = KASModuleVesselInfo
}
}
5 changes: 3 additions & 2 deletions Parts/TB60/part.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ PART
attachNodePosition = 0.0, 0.1616, 0.0 // see: attachNodePosition.Y in logs
attachNodeOrientation = 0.0, 1.0, 0.0
// KASModuleInteractiveJointSource
plugSndPath = KAS-1.0/Sounds/plugdocked
unplugSndPath = KAS-1.0/Sounds/unplugdocked
sndPathPlug = KAS-1.0/Sounds/plug
sndPathUnplug = KAS-1.0/Sounds/unplug
sndPathBroken = KAS-1.0/Sounds/broke
startLinkMenu = Attach to a vessel
breakLinkMenu = Disconnect vessels
}
Expand Down
16 changes: 12 additions & 4 deletions Parts/TJ1/part.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,32 @@ PART
name = KASModuleInteractiveLinkSource
// KASModuleLinkSourceBase
linkType = MdStrut
linkMode = DockVessels
linkMode = TieAnyParts
attachNodeName = kas0
attachNodePosition = 0.0, 0.1616, 0.0 // see: attachNodePosition.Y in logs
attachNodeOrientation = 0.0, 1.0, 0.0
// KASModuleInteractiveJointSource
plugSndPath = KAS-1.0/Sounds/plugdocked
unplugSndPath = KAS-1.0/Sounds/unplugdocked
allowChanginDockingMode = true
sndPathPlug = KAS-1.0/Sounds/plug
sndPathUnplug = KAS-1.0/Sounds/unplug
sndPathDock = KAS-1.0/Sounds/plugdocked
sndPathUndock = KAS-1.0/Sounds/unplugdocked
sndPathBroken = KAS-1.0/Sounds/broke
startLinkMenu = Attach to a vessel
breakLinkMenu = Disconnect vessels
}
MODULE
{
name = KASModuleStockJoint
name = KASModuleJointBase
// see: minLinkLength in logs
minLinkLength = 0.8027648
// see: maxLinkLength in logs
maxLinkLength = 2.164459
sourceLinkAngleLimit = 90
targetLinkAngleLimit = 90
}
MODULE
{
name = KASModuleVesselInfo
}
}
14 changes: 11 additions & 3 deletions Parts/TJ2/part.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ PART
name = KASModuleInteractiveLinkSource
// KASModuleLinkSourceBase
linkType = MdStrut
linkMode = DockVessels
linkMode = TieAnyParts
attachNodeName = kas0
attachNodePosition = 0.0, 0.1616, 0.0 // see: attachNodePosition.Y in logs
attachNodeOrientation = 0.0, 1.0, 0.0
// KASModuleInteractiveJointSource
plugSndPath = KAS-1.0/Sounds/plugdocked
unplugSndPath = KAS-1.0/Sounds/unplugdocked
allowChanginDockingMode = true
sndPathPlug = KAS-1.0/Sounds/plug
sndPathUnplug = KAS-1.0/Sounds/unplug
sndPathDock = KAS-1.0/Sounds/plugdocked
sndPathUndock = KAS-1.0/Sounds/unplugdocked
sndPathBroken = KAS-1.0/Sounds/broke
startLinkMenu = Attach to a vessel
breakLinkMenu = Disconnect vessels
}
Expand All @@ -70,4 +74,8 @@ PART
sourceLinkAngleLimit = 90
targetLinkAngleLimit = 90
}
MODULE
{
name = KASModuleVesselInfo
}
}
10 changes: 5 additions & 5 deletions Source/KAS-1.0.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
<HintPath>Q:\KSP_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="KSPDev_Utils.0.26">
<HintPath>..\Binaries\KSPDev_Utils.0.26.dll</HintPath>
<Reference Include="KSPDev_Utils.0.29">
<HintPath>..\Binaries\KSPDev_Utils.0.29.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>Q:\KSP_x64_Data\Managed\System.dll</HintPath>
Expand Down Expand Up @@ -95,12 +95,12 @@
<Compile Include="api_v1\IKasJointEventsListener.cs" />
<Compile Include="api_v1\ILinkCableJoint.cs" />
<Compile Include="api_v1\ILinkJoint.cs" />
<Compile Include="api_v1\ILinkJointBase.cs" />
<Compile Include="api_v1\ILinkRenderer.cs" />
<Compile Include="api_v1\ILinkSource.cs" />
<Compile Include="api_v1\ILinkStateEventListener.cs" />
<Compile Include="api_v1\ILinkTarget.cs" />
<Compile Include="api_v1\IKasPropertyChangeListener.cs" />
<Compile Include="api_v1\ILinkVesselInfo.cs" />
<Compile Include="api_v1\KASAPI.cs" />
<Compile Include="api_v1\KASEvents.cs" />
<Compile Include="api_v1\LinkActorType.cs" />
Expand All @@ -112,7 +112,7 @@
<Compile Include="api_v1\Utils\IPhysicsUtils.cs" />
<Compile Include="modules\InternalKASModulePhysicalConnector.cs" />
<Compile Include="modules\KASModuleCableJointBase.cs" />
<Compile Include="modules\AbstractJointModule.cs" />
<Compile Include="modules\KASModuleJointBase.cs" />
<Compile Include="modules\AbstractProceduralModel.cs" />
<Compile Include="modules\BrokenJointListener.cs" />
<Compile Include="modules\KASModuleCableJoint.cs" />
Expand All @@ -121,11 +121,11 @@
<Compile Include="modules\KASModuleLinkSourceBase.cs" />
<Compile Include="modules\KASModuleLinkTargetBase.cs" />
<Compile Include="modules\KASModulePipeRendererWithHead.cs" />
<Compile Include="modules\KASModuleStockJoint.cs" />
<Compile Include="modules\KASModuleTelescopicPipeModel.cs" />
<Compile Include="modules\KASModuleTowBarActiveJoint.cs" />
<Compile Include="modules\KASModulePipeRenderer.cs" />
<Compile Include="modules\KASModuleTwoEndsSphereJoint.cs" />
<Compile Include="modules\KASModuleVesselInfo.cs" />
<Compile Include="modules\KASModuleWinchNew.cs" />
<Compile Include="modules\KSPDev_candidates.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
28 changes: 14 additions & 14 deletions Source/LOCALIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ _Every_ KAS module **must** explicitly reserve a module number here. The descend
not use the same namespace as the parent. No modules are allowed to define own values for the tags within the
`#kasLOC_00000` - `#kasLOC_99999` namespace.

Module name | Module number | Namespace start | Namespace end |
------------|---------------|-----------------|---------------|
AbstractJointModule | 0 | #kasLOC_00000 | #kasLOC_00999
KASModuleInteractiveLinkSource | 1 | #kasLOC_01000 | #kasLOC_01999
KASModuleLinkSourceBase | 2 | #kasLOC_02000 | #kasLOC_02999
KASModuleLinkTargetBase | 3 | #kasLOC_03000 | #kasLOC_03999
KASModuleTelescopicPipeModel | 4 | #kasLOC_04000 | #kasLOC_04999
KASModuleTowBarActiveJoint | 5 | #kasLOC_05000 | #kasLOC_05999
KASModuleCableJoint | 6 | #kasLOC_06000 | #kasLOC_06999
KASModulePipeRenderer | 7 | #kasLOC_07000 | #kasLOC_07999
KASModuleWinchNew | 8 | #kasLOC_08000 | #kasLOC_08999
AbstractCableJointModule | 9 | #kasLOC_09000 | #kasLOC_09999
KASModuleKerbalLinkTarget | 10 | #kasLOC_10000 | #kasLOC_10999
_Next available value_ | 11 | #kasLOC_10000 | #kasLOC_10999
| Module name | Module | Namespace start | Namespace end |
| ------------------------------ | ------ | --------------- | ------------- |
| AbstractJointModule | 0 | #kasLOC_00000 | #kasLOC_00999 |
| KASModuleInteractiveLinkSource | 1 | #kasLOC_01000 | #kasLOC_01999 |
| KASModuleLinkSourceBase | 2 | #kasLOC_02000 | #kasLOC_02999 |
| KASModuleLinkTargetBase | 3 | #kasLOC_03000 | #kasLOC_03999 |
| KASModuleTelescopicPipeModel | 4 | #kasLOC_04000 | #kasLOC_04999 |
| KASModuleTowBarActiveJoint | 5 | #kasLOC_05000 | #kasLOC_05999 |
| KASModuleCableJoint | 6 | #kasLOC_06000 | #kasLOC_06999 |
| KASModulePipeRenderer | 7 | #kasLOC_07000 | #kasLOC_07999 |
| KASModuleWinchNew | 8 | #kasLOC_08000 | #kasLOC_08999 |
| AbstractCableJointModule | 9 | #kasLOC_09000 | #kasLOC_09999 |
| KASModuleKerbalLinkTarget | 10 | #kasLOC_10000 | #kasLOC_10999 |
| _Next available value_ | 11 | #kasLOC_11000 | #kasLOC_11999 |
2 changes: 1 addition & 1 deletion Source/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyInformationalVersion("1.0 Beta6 for KSP 1.3")]
[assembly: AssemblyInformationalVersion("1.0 Beta7-pre for KSP 1.3")]
[assembly: KSPAssembly("KAS", 1, 0)]
[assembly: AssemblyFlags(AssemblyNameFlags.PublicKey)]
11 changes: 5 additions & 6 deletions Source/api_impl/AttachNodesUtilsImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// API design and implemenation: igor.zavoychinskiy@gmail.com
// License: Public Domain

using KSPDev.LogUtils;
using System;
using UnityEngine;

Expand All @@ -14,8 +15,7 @@ class AttachNodesUtilsImpl : KASAPIv1.IAttachNodesUtils {
public AttachNode CreateAttachNode(Part part, string nodeName, Transform nodeTransform) {
var attachNode = part.FindAttachNode(nodeName);
if (attachNode != null) {
Debug.LogWarningFormat(
"Not creating attach node {0} for {1} - already exists", nodeName, part.name);
DebugEx.Warning("Not creating attach node {0} for {1} - already exists", nodeName, part);
} else {
attachNode = new AttachNode(nodeName, nodeTransform, 0, AttachNodeMethod.FIXED_JOINT,
crossfeed: true, rigid: false);
Expand All @@ -32,14 +32,13 @@ public AttachNode CreateAttachNode(Part part, string nodeName, Transform nodeTra
public void DropAttachNode(Part part, string nodeName) {
var attachNode = part.FindAttachNode(nodeName);
if (attachNode == null) {
Debug.LogWarningFormat(
"Not dropping attach node {0} on {1} - not found", nodeName, part.name);
DebugEx.Warning("Not dropping attach node {0} on {1} - not found", nodeName, part);
return;
}
if (attachNode.attachedPart != null) {
Debug.LogWarningFormat(
DebugEx.Warning(
"Attach node {0} on {1} is attached to {2} - decouple callbacks will be impacted",
nodeName, part.name, attachNode.attachedPart.name);
nodeName, part, attachNode.attachedPart);
}
part.attachNodes.Remove(attachNode);
}
Expand Down
45 changes: 42 additions & 3 deletions Source/api_impl/JointUtilsImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,17 @@ public void SetupPrismaticJoint(ConfigurableJoint joint,
// Setup linear joint parameters.
joint.xDrive = new JointDrive() {
positionSpring = springForce,
positionDamper = springForce * springDamperRatio,
positionDamper = float.IsInfinity(springForce) ? 0 : springForce * springDamperRatio,
maximumForce = maxSpringForce
};
joint.linearLimit = new SoftJointLimit() {
limit = distanceLimit
};
joint.linearLimitSpring = new SoftJointLimitSpring() {
spring = distanceLimitForce,
damper = distanceLimitForce * distanceLimitDamperRatio
damper = float.IsInfinity(distanceLimitForce)
? 0
: distanceLimitForce * distanceLimitDamperRatio
};
// Optimize mode basing on the input parameters.
if (float.IsInfinity(springForce) || Mathf.Approximately(distanceLimit, 0)) {
Expand Down Expand Up @@ -137,7 +139,7 @@ public void SetupSphericalJoint(ConfigurableJoint joint,
joint.angularXMotion = ConfigurableJointMotion.Free;
joint.angularYZDrive = new JointDrive() {
positionSpring = springForce,
positionDamper = springForce * springDamperRatio,
positionDamper = float.IsInfinity(springForce) ? 0 : springForce * springDamperRatio,
maximumForce = maxSpringForce
};
joint.angularYZLimitSpring = new SoftJointLimitSpring() {
Expand Down Expand Up @@ -165,6 +167,43 @@ public void SetupSphericalJoint(ConfigurableJoint joint,
}
}

/// <inheritdoc/>
public void SetupDistanceJoint(ConfigurableJoint joint,
float springForce = 0,
float springDamper = 0,
float maxDistance = Mathf.Infinity) {
// Swap X&Z axes so that the joint's forward vector becomes a primary axis.
joint.axis = Vector3.forward;
joint.secondaryAxis = Vector3.right;
// Setup linear joint parameters.
joint.linearLimit = new SoftJointLimit() {
limit = maxDistance
};
joint.linearLimitSpring = new SoftJointLimitSpring() {
spring = springForce,
damper = springDamper
};
joint.xMotion = ConfigurableJointMotion.Limited;
joint.angularXMotion = ConfigurableJointMotion.Free;
joint.yMotion = ConfigurableJointMotion.Limited;
joint.angularYMotion = ConfigurableJointMotion.Free;
joint.zMotion = ConfigurableJointMotion.Limited;
joint.angularZMotion = ConfigurableJointMotion.Free;
}

/// <inheritdoc/>
public void SetupFixedJoint(ConfigurableJoint joint) {
// Swap X&Z axes so that the joint's forward vector becomes a primary axis.
joint.axis = Vector3.forward;
joint.secondaryAxis = Vector3.right;
joint.xMotion = ConfigurableJointMotion.Locked;
joint.angularXMotion = ConfigurableJointMotion.Locked;
joint.yMotion = ConfigurableJointMotion.Locked;
joint.angularYMotion = ConfigurableJointMotion.Locked;
joint.zMotion = ConfigurableJointMotion.Locked;
joint.angularZMotion = ConfigurableJointMotion.Locked;
}

StringBuilder DumpBaseJoint(Joint joint) {
var msg = new StringBuilder();
msg.Append("name: ").Append(joint.name).AppendLine();
Expand Down
Loading

0 comments on commit 2bec15c

Please sign in to comment.