Bug #13622
allowRoot is not taken into account in flight
Status:
New
Severity:
Normal
Assignee:
-
Category:
Physics
Target version:
-
Start date:
01/19/2017
% Done:
0%
Language:
English (US)
Mod Related:
No
Votes:
Description
When the 8.th (allowRoot) paramter of the attachrules in a parts config is set to 0 it prevents this part from becoming the root of the vessel in the Editor.
This is not taken into account in flight however where it can become root. The same applies to physicsless parts which are also able to become root of the vessel in flight.
In both cases this is unfavorable because the main reasons for a part to not be root are in flight and not in the editor.
- Use any docking port of your choice and set the 8.th parameter of its attachrules to 0
- The docking port is now unable to become root in the editor
- Create a vessel where two docking ports are attached to each other.
- Launch the craft and decouble the docking port.
- The docking port that is further away from the original root of the vessel is now the root of the newly created vessel although it shouldn't be.
To see if a part is the root you can use this code for a partmodule:
class RootTest: PartModule
{
[KSPField(isPersistant = false, guiActive = true, guiActiveEditor = true, guiName = "Is Root:")]
public bool isRoot = false;
public void Update()
{
isRoot = (part.parent == null)
}
}
It is clear that when a vessel is destroyed and there is only one part left that this part must be the root. In any other case and especially the really common docking this can cause many problems.