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: 79a99ef29d85
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0cbde7bbb4eb
Choose a head ref
  • 9 commits
  • 1 file changed
  • 2 contributors

Commits on Mar 9, 2017

  1. Copy the full SHA
    9851778 View commit details
  2. Copy the full SHA
    01e7ac0 View commit details

Commits on Mar 10, 2017

  1. derp

    eggrobin committed Mar 10, 2017
    Copy the full SHA
    8c24788 View commit details
  2. Now we can warp

    eggrobin committed Mar 10, 2017
    Copy the full SHA
    79ec9e2 View commit details
  3. revert most things

    eggrobin committed Mar 10, 2017
    Copy the full SHA
    fede313 View commit details
  4. unconditional

    eggrobin committed Mar 10, 2017
    Copy the full SHA
    313c941 View commit details
  5. fold

    eggrobin committed Mar 10, 2017
    Copy the full SHA
    9d156a9 View commit details
  6. missing word

    eggrobin committed Mar 10, 2017
    Copy the full SHA
    ec884a1 View commit details
  7. Merge pull request #1239 from eggrobin/allow-warp

    Allow warp
    pleroy authored Mar 10, 2017
    Copy the full SHA
    0cbde7b View commit details
Showing with 23 additions and 10 deletions.
  1. +23 −10 ksp_plugin_adapter/ksp_plugin_adapter.cs
33 changes: 23 additions & 10 deletions ksp_plugin_adapter/ksp_plugin_adapter.cs
Original file line number Diff line number Diff line change
@@ -344,6 +344,9 @@ public override void OnAwake() {

GameEvents.onShowUI.Add(ShowGUI);
GameEvents.onHideUI.Add(HideGUI);
// Timing0, -8008 on the script execution order page.
TimingManager.FixedUpdateAdd(TimingManager.TimingStage.ObscenelyEarly,
DisableVesselPrecalculate);
// TimingPre, -101 on the script execution order page.
TimingManager.FixedUpdateAdd(TimingManager.TimingStage.Precalc,
SetBodyFramesAndPrecalculateVessels);
@@ -705,6 +708,8 @@ private void OnDisable() {
toolbar_button_);
}
Cleanup();
TimingManager.FixedUpdateRemove(TimingManager.TimingStage.ObscenelyEarly,
DisableVesselPrecalculate);
TimingManager.FixedUpdateRemove(TimingManager.TimingStage.Precalc,
SetBodyFramesAndPrecalculateVessels);
TimingManager.FixedUpdateRemove(TimingManager.TimingStage.FashionablyLate,
@@ -844,22 +849,21 @@ Vessel vessel in FlightGlobals.Vessels.Where(is_on_rails_in_space)) {
}
}

private void DisableVesselPrecalculate() {
foreach (var vessel in FlightGlobals.Vessels) {
vessel.precalc.enabled = false;
}
}

private void SetBodyFramesAndPrecalculateVessels() {
SetBodyFrames();
// Unfortunately there is no way to get scheduled between Planetarium and
// VesselPrecalculate, so we get scheduled after VesselPrecalculate, set the
// body frames for our weird tilt, and run VesselPrecalculate again. Sob.
// body frames for our weird tilt, and run VesselPrecalculate manually.
// Sob.
foreach (var vessel in FlightGlobals.Vessels) {
vessel.precalc.enabled = true;
vessel.precalc.FixedUpdate();
// TODO(egg): either set the following from accelerations known to the
// plugin combined with measurements for accelerations due to interactions
// inside a PileUp, or set vessel.graviticAcceleration around the call
// to precalc.FixedUpdate above so that vessel.UpdateAcceleration sets
// them to the right thing.
// vessel.acceleration = ???;
// vessel.acceleration_immediate = ???;
// vessel.geeForce = ???;
// vessel.geeForce_immediate = ???;
}
}

@@ -868,6 +872,15 @@ private void ReportVesselsAndParts() {
// part.forces, part.force, and part.torque are cleared by the/
// FlightIntegrator's FixedUpdate (while we are yielding).
if (PluginRunning()) {
if (has_active_vessel_in_space() && FlightGlobals.ActiveVessel.packed) {
if (PhysicsGlobals.GraviticForceMultiplier != 0) { // sic.
Log.Info("Killing stock gravity");
PhysicsGlobals.GraviticForceMultiplier = 0;
}
} else {
Log.Info("Reinstating stock gravity");
PhysicsGlobals.GraviticForceMultiplier = 1;
}
foreach (Vessel vessel in FlightGlobals.Vessels.Where(is_in_space)) {
bool inserted;
plugin_.InsertOrKeepVessel(vessel.id.ToString(),