Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d925509a32b9
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ea4a7bd0a793
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Jun 5, 2020

  1. Copy the full SHA
    a8e5aa7 View commit details
  2. Merge pull request #2600 from pleroy/2590

    Skip collisions with unready Kerbals
    pleroy authored Jun 5, 2020
    Copy the full SHA
    ea4a7bd View commit details
Showing with 22 additions and 6 deletions.
  1. +0 −2 ksp_plugin/pile_up.cpp
  2. +19 −3 ksp_plugin_adapter/ksp_plugin_adapter.cs
  3. +3 −1 serialization/journal.proto
2 changes: 0 additions & 2 deletions ksp_plugin/pile_up.cpp
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
#include <memory>
#include <utility>

#include "base/flags.hpp"
#include "base/map_util.hpp"
#include "geometry/identity.hpp"
#include "ksp_plugin/integrators.hpp"
@@ -21,7 +20,6 @@ namespace internal_pile_up {

using base::check_not_null;
using base::FindOrDie;
using base::Flags;
using base::make_not_null_unique;
using geometry::AngularVelocity;
using geometry::BarycentreCalculator;
22 changes: 19 additions & 3 deletions ksp_plugin_adapter/ksp_plugin_adapter.cs
Original file line number Diff line number Diff line change
@@ -495,6 +495,11 @@ private bool is_clambering(KerbalEVA kerbal) {
kerbal.fsm.CurrentState == kerbal.st_clamber_acquireP3;
}

// Æthelred Kerman.
private bool is_unready_kerbal(Vessel vessel) {
return vessel.isEVA && vessel.evaController?.Ready == false;
}

private bool is_manageable(Vessel vessel) {
return UnmanageabilityReasons(vessel) == null;
}
@@ -527,7 +532,7 @@ private string UnmanageabilityReasons(Vessel vessel) {
" m above ground with a vertical speed of " + vertical_speed +
" m/s");
}
if (vessel.isEVA && vessel.evaController?.Ready == false) {
if (is_unready_kerbal(vessel)) {
reasons.Add("vessel is an unready Kerbal");
}
if (vessel.loaded && hack_gravity?.toggle.isOn == true) {
@@ -1228,13 +1233,24 @@ private System.Collections.IEnumerator WaitedForFixedUpdate() {
continue;
}
if (vessel2 != null) {
if (is_manageable(vessel2)) {
if (is_unready_kerbal(vessel2)) {
// A Kerbal that just started an EVA and is not ready yet. If
// we let it collide with |vessel1|, it will cause that vessel
// to become unmanageable and be removed from the plugin. Of
// course, the vessel will come back once the Kerbal is ready,
// but at that point we'll have to trust the position given by
// KSP, and in practice that might cause the vessel to jump
// by hundreds of metres (#2590). The bottom line is: we
// better ignore the collision, the Kerbal will soon become
// ready anyway.
} else if (is_manageable(vessel2)) {
plugin_.ReportPartCollision(
closest_physical_parent(part1).flightID,
closest_physical_parent(part2).flightID);
} else {
Log.Info("Reporting collision with the unmanageable vessel " +
vessel2.vesselName);
vessel2.vesselName + " (reason: " +
UnmanageabilityReasons(vessel2) + ")");
plugin_.ReportGroundCollision(
closest_physical_parent(part1).flightID);
}
4 changes: 3 additions & 1 deletion serialization/journal.proto
Original file line number Diff line number Diff line change
@@ -1148,7 +1148,9 @@ message GetStderrLogging {
optional GetStderrLogging extension = 5007;
}
message Return {
required int32 result = 1;
// Omitting the return check here makes it possible to replay the journal
// with logging to stderr, which is useful for debugging.
required int32 result = 1 [(omit_check) = true];
}
optional Return return = 3;
}