Skip to content

Commit

Permalink
Force the landed status of vessels touching pads
Browse files Browse the repository at this point in the history
It seems that recent versions of KSP have a bug in their landed logic
that causes vessels landed on other (landed) vessels to sometimes not be
landed (particularly if things glitch during scene load, tossing the
upper vessel up and it landing again) but still suborbital. Copying the
landed and splashed flags seems to be sufficient fix it (at least when
several colliders are touching) as the vessel sets its situation
correctly the next frame.
  • Loading branch information
taniwha committed Sep 20, 2020
1 parent f14a780 commit 00bdede
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Source/Pad/Launchpad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,5 +334,20 @@ public void OnRename ()
{
ELBuildWindow.updateCurrentPads ();
}

void OnCollisionStay (Collision collision)
{
// force any vessels landed on the pad to share the same situation
// works around a bug in KSP that sometimes glitches the landed
// vessel to not-landed
Part p = FlightGlobals.GetPartUpwardsCached (collision.collider.gameObject);
if (p != null) {
if (vessel.LandedOrSplashed) {
p.vessel.Landed = vessel.Landed;
p.vessel.Splashed = vessel.Splashed;
p.vessel.SetLandedAt (vessel.landedAt, null, vessel.displaylandedAt);
}
}
}
}
}

0 comments on commit 00bdede

Please sign in to comment.