Skip to content

Commit

Permalink
Update for KSP 1.1.3
Browse files Browse the repository at this point in the history
Remove KSP 1.1.2 work arounds.
Update travis and .version file for KSP 1.1.3
  • Loading branch information
hvacengi committed Jul 11, 2016
1 parent 24be1f3 commit 7cbf846
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 83 deletions.
14 changes: 1 addition & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ addons:

env:
global:
- KSP_VERSION="1.1.2"
- KSP_VERSION="1.1.3"

# Pre-shared token for pushing notifications to slack chat
notifications:
Expand All @@ -29,15 +29,3 @@ script:
# Cleanup the downloaded resources
after_script:
- chmod +x .ci/travis/after_script.sh && ./.ci/travis/after_script.sh

before_deploy:
- mkdir src/kOS/bin/dist
- tar -zcvf src/kOS/bin/dist/build_$TRAVIS_BUILD_NUMBER.tgz src/kOS/bin/Release/kOS*.dll

deploy:
provider: s3
access_key_id: "AKIAINHSGTBU5O3DKV2Q"
secret_access_key: "$S3_DEPLOY_SECRET"
bucket: "kos-artifacts"
skip_cleanup: true
local_dir: "src/kOS/bin/dist/"
4 changes: 2 additions & 2 deletions Resources/GameData/kOS/kOS.version
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 1,
"PATCH": 2
"PATCH": 3
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 1,
"PATCH": 2
"PATCH": 3
},
"KSP_VERSION_MAX": {
"MAJOR": 1,
Expand Down
59 changes: 1 addition & 58 deletions src/kOS/Control/SteeringManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,7 @@ public void UpdateStateVectors()
angularAcceleration = new Vector3d(angularAcceleration.x, angularAcceleration.z, angularAcceleration.y);
}

// TODO: This is a temporary fix for the Moment of Inertial This can be removed after the next KSP release.
//momentOfInertia = shared.Vessel.MOI;
momentOfInertia = FindMoI();
momentOfInertia = shared.Vessel.MOI;
adjustTorque = Vector3d.zero;
measuredTorque = Vector3d.Scale(momentOfInertia, angularAcceleration);

Expand Down Expand Up @@ -608,61 +606,6 @@ public void UpdateTorque()
if (controlTorque.z < minTorque) controlTorque.z = minTorque;
}

#region TEMPORARY MOI CALCULATION
// TODO: This is a temporary fix for the Moment of Inertial This can be removed after the next KSP release.
public Vector3 FindMoI()
{
var tensor = Matrix4x4.zero;
Matrix4x4 partTensor = Matrix4x4.identity;
Matrix4x4 inertiaMatrix = Matrix4x4.identity;
Matrix4x4 productMatrix = Matrix4x4.identity;
foreach (var part in Vessel.Parts)
{
if (part.rb != null)
{
KSPUtil.ToDiagonalMatrix2(part.rb.inertiaTensor, ref partTensor);

Quaternion rot = Quaternion.Inverse(vesselRotation) * part.transform.rotation * part.rb.inertiaTensorRotation;
Quaternion inv = Quaternion.Inverse(rot);

Matrix4x4 rotMatrix = Matrix4x4.TRS(Vector3.zero, rot, Vector3.one);
Matrix4x4 invMatrix = Matrix4x4.TRS(Vector3.zero, inv, Vector3.one);

// add the part inertiaTensor to the ship inertiaTensor
KSPUtil.Add(ref tensor, rotMatrix * partTensor * invMatrix);

Vector3 position = vesselTransform.InverseTransformDirection(part.rb.position - centerOfMass);

// add the part mass to the ship inertiaTensor
KSPUtil.ToDiagonalMatrix2(part.rb.mass * position.sqrMagnitude, ref inertiaMatrix);
KSPUtil.Add(ref tensor, inertiaMatrix);

// add the part distance offset to the ship inertiaTensor
OuterProduct2(position, -part.rb.mass * position, ref productMatrix);
KSPUtil.Add(ref tensor, productMatrix);
}
}
return KSPUtil.Diag(tensor);
}

/// <summary>
/// Construct the outer product of two 3-vectors as a 4x4 matrix
/// DOES NOT ZERO ANY THINGS WOT ARE ZERO OR IDENTITY INNIT
/// </summary>
public static void OuterProduct2(Vector3 left, Vector3 right, ref Matrix4x4 m)
{
m.m00 = left.x * right.x;
m.m01 = left.x * right.y;
m.m02 = left.x * right.z;
m.m10 = left.y * right.x;
m.m11 = left.y * right.y;
m.m12 = left.y * right.z;
m.m20 = left.z * right.x;
m.m21 = left.z * right.y;
m.m22 = left.z * right.z;
}
#endregion

public Transform FindParentTransform(Transform transform, string name, Transform topLevel)
{
if (transform.parent.name == name) return transform.parent;
Expand Down
10 changes: 0 additions & 10 deletions src/kOS/Module/kOSVesselModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,6 @@ private void HookEvents()
{
parentVessel.OnPreAutopilotUpdate += UpdateAutopilot;
}
GameEvents.onPartCouple.Add(OnDocking);
}

private void OnDocking(GameEvents.FromToAction<Part, Part> data)
{
if (data.from.vessel == parentVessel)
{
Destroy(this);
}
}

/// <summary>
Expand All @@ -240,7 +231,6 @@ private void UnHookEvents()
{
parentVessel.OnPreAutopilotUpdate -= UpdateAutopilot;
}
GameEvents.onPartCouple.Remove(OnDocking);
}

/// <summary>
Expand Down

0 comments on commit 7cbf846

Please sign in to comment.