Repository navigation
Core: a core that stops being master disengages what was engaged on it, and its RCS balancer gives the thrusters back - #2818
Merged
Merged
Conversation
…t, and its RCS balancer gives the thrusters back The master core is the first running one in the vessel's part order. A core that stops being master (its ship docks to a station whose core comes first, or the player turns its MechJeb toggle off) gets no FixedUpdate or Drive any more, but nothing disengaged its modules: they stayed enabled with their users, frozen, and ran again when the core was master once more. After an undock, the ship's SmartASS, Translatron or rover hold turned the ship that the player had left beside the station, and the RCS balancer left the thrusters it had throttled at their last throttles for the rest of the session. The new master's balancer then took those throttled values as the originals. When a core finds it is no longer master, it now removes every user other than the module itself from its modules, so each engaged module goes through its own disable path, and calls OnControlLost on them. The balancer restores its thrusters there and wraps them again if the core becomes master again. After a change of parts the balancer wraps the thrusters on the next tick: after a dock the new master's balancer runs before the old master's in that tick, while the old one still has its thrusters throttled, and on the next tick it has given them back. The Utilities window's Autostage toggle is that window as a user of the staging controller, and the window saves it from that membership, so the release leaves that user in place: otherwise a core docked behind another one would save Autostage as off. The staging controller of a core that is not master does not run, so it does not stage meanwhile. The landing predictions toggle is not saved, so it is released with the rest.
…he master Only the master core wrote its MechJebLocalSettings node into the save. A ship docked behind a station's core, saved and loaded, came back with its core's local settings at the part's defaults: SmartASS mode and target, rover heading, thrust limits, docking distances and flight recorder marks were lost for good, and showed when the ship undocked and its core was master again. A core that is not master now still writes its local settings into the save. Only the master writes the global and vessel type files, as before.
Contributor
✅ Build Artifact 🚀MechJeb2-18c70f5.zip (built from 255d0aa) |
This was referenced Nov 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #2471 (audit epic, CORE); #2472 (audit epic, CTRL): HCORE-a2, HCTRL-a5 (Medium).
Summary
2 commits, 2 files changed.
Core: a core that stops being master disengages what was engaged on it, and its RCS balancer gives the thrusters back
The master core is the first running one in the vessel's part order. A core that stops being master (its ship docks to a station whose core comes first, or the player turns its MechJeb toggle off) gets no FixedUpdate or Drive any more, but nothing disengaged its modules: they stayed enabled with their users, frozen, and ran again when the core was master once more. After an undock, the ship's SmartASS, Translatron or rover hold turned the ship that the player had left beside the station, and the RCS balancer left the thrusters it had throttled at their last throttles for the rest of the session. The new master's balancer then took those throttled values as the originals.
When a core finds it is no longer master, it now removes every user other than the module itself from its modules, so each engaged module goes through its own disable path, and calls OnControlLost on them. The balancer restores its thrusters there and wraps them again if the core becomes master again. After a change of parts the balancer wraps the thrusters on the next tick: after a dock the new master's balancer runs before the old master's in that tick, while the old one still has its thrusters throttled, and it would take those throttles as the originals. On the next tick the old one has given them back.
The Utilities window's Autostage toggle is that window as a user of the staging controller, and the window saves it from that membership, so the release leaves that user in place: otherwise a core docked behind another one would save Autostage as off. The staging controller of a core that is not master does not run, so it does not stage meanwhile. The landing predictions toggle is not saved, so it is released with the rest.
Core: every core keeps its own local settings in the save, not only the master
Only the master core wrote its MechJebLocalSettings node into the save. A ship docked behind a station's core, saved and loaded, came back with its core's local settings at the part's defaults: SmartASS mode and target, rover heading, thrust limits, docking distances and flight recorder marks were lost for good, and showed when the ship undocked and its core was master again.
A core that is not master now still writes its local settings into the save. Only the master writes the global and vessel type files, as before.
Tested
MechJeb2_UI Spike 83 (KSP 1.12.5, 3.2x system, KSPCommunityFixes, MechJeb
-c Debug),devb85bdac againsttest/opus-medium, on the Mac: DockTug-light (two cores) docked to MJ Test Station, undocked, then the tug's master core switched off with the MechJeb toggle while its RCS balancer throttles.devThe flowMult check right at the couple was inconclusive (the balanced tug had nothing throttled then). The local-settings commit was not tested in game.
These runs were on an earlier version of the branch, before its rebase on dev 6959f7c and before the balancer's next-tick wrap; the current head is built (Debug, no new warnings, MechJebLibTest passes) but not flown.