Skip to content

Commit

Permalink
Use stock method for finding launch clamps
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Mar 19, 2024
1 parent bc04c9f commit 17f708e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private void BreakAllInvalidJoints()

foreach (Part p in n.vessel.Parts)
{
if (p.Modules.Contains<LaunchClamp>())
if (p.isLaunchClamp())
continue;

ConfigurableJoint[] possibleConnections = p.GetComponents<ConfigurableJoint>();
Expand Down
10 changes: 5 additions & 5 deletions KerbalJointReinforcement/KerbalJointReinforcement/KJRManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private void OnVesselOffRails(Vessel v)
if (p.attachJoint)
p.attachJoint.SetUnbreakable(true, false);

if (p.Modules.Contains<LaunchClamp>())
if (p.isLaunchClamp())
{
vesselHasLaunchClamps = true;
Joint[] partJoints = p.GetComponents<Joint>();
Expand All @@ -196,7 +196,7 @@ private void OnVesselOffRails(Vessel v)
for (int i = 0; i < v.Parts.Count; ++i)
{
Part p = v.Parts[i];
if (p.Modules.Contains<LaunchClamp>())
if (p.isLaunchClamp())
{
vesselHasLaunchClamps = true;
break;
Expand Down Expand Up @@ -301,7 +301,7 @@ private void RunVesselJointUpdateFunction(Vessel v)
}

if ((KJRJointUtils.settings.reinforceLaunchClampsFurther || KJRJointUtils.settings.clampJointHasInfiniteStrength) &&
p.parent != null && p.Modules.Contains<LaunchClamp>())
p.parent != null && p.isLaunchClamp())
{
p.breakingForce = Mathf.Infinity;
p.breakingTorque = Mathf.Infinity;
Expand Down Expand Up @@ -405,7 +405,7 @@ private void UpdatePartJoint(Part p)
StringBuilder debugString = KJRJointUtils.settings.debug ? new StringBuilder() : null;

bool addAdditionalJointToParent = KJRJointUtils.settings.multiPartAttachNodeReinforcement;
//addAdditionalJointToParent &= !(p.Modules.Contains("LaunchClamp") || (p.parent.Modules.Contains("ModuleDecouple") || p.parent.Modules.Contains("ModuleAnchoredDecoupler")));
//addAdditionalJointToParent &= !(p.isLaunchClamp() || (p.parent.Modules.Contains("ModuleDecouple") || p.parent.Modules.Contains("ModuleAnchoredDecoupler")));
addAdditionalJointToParent &= !p.Modules.Contains<CModuleStrut>();

double partMass = p.physicsMass;
Expand Down Expand Up @@ -961,7 +961,7 @@ public void MultiPartJointTreeChildren(Vessel v)
{
Part p = v.Parts[i];
if (p.rb != null &&
p.children.Count == 0 && !p.Modules.Contains("LaunchClamp") &&
p.children.Count == 0 && !p.isLaunchClamp() &&
p.physicsMass > KJRJointUtils.settings.massForAdjustment)
{
childPartsToConnect.Add(p);
Expand Down

0 comments on commit 17f708e

Please sign in to comment.