Exemplo n.º 1
0
 /// <summary>
 /// Updates part highlight renderer list, sends message to SSTUFlagDecal to update its renderer,
 ///  sends message to FAR to update voxels, or if createDefaultCube==true will re-render the 'default' stock drag cube for the part<para/>
 /// Should be called anytime the model geometry in a part is changed -- either models added/deleted, procedural meshes updated.  Other methods exist for pure drag-cube updating in SSTUStockInterop.
 /// </summary>
 /// <param name="part"></param>
 /// <param name="createDefaultCube"></param>
 public static void onPartGeometryUpdate(Part part, bool createDefaultCube)
 {
     if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight)
     {
         return;
     }                                                                                //noop on prefabs
     //MonoBehaviour.print(System.Environment.StackTrace);
     SSTUStockInterop.updatePartHighlighting(part);
     part.airlock = locateAirlock(part);
     partGeometryUpdate(part);
     if (isFARInstalled())
     {
         SSTUStockInterop.addFarUpdatePart(part);
         //FARdebug(part);
         //part.SendMessage("GeometryPartModuleRebuildMeshData");
     }
     else if (createDefaultCube && (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight))
     {
         SSTUStockInterop.addDragUpdatePart(part);
     }
     if (HighLogic.LoadedSceneIsEditor && part.parent == null && part != EditorLogic.RootPart) //likely the part under the cursor; this fixes problems with modular parts not wanting to attach to stuff
     {
         part.gameObject.SetLayerRecursive(1, 2097152);                                        //1<<21 = Part Triggers get skipped by the relayering (hatches, ladders, ??)
     }
 }