Exemplo n.º 1
0
 /// <summary>
 /// Internal method to update the persistent data state(s) from the current animation state.
 /// </summary>
 /// <param name="newState"></param>
 protected void onAnimationStateChange(ROLAnimState newState, bool updateExternal = false)
 {
     animationState = newState;
     persistentData = newState.ToString();
     if (updateDragCube)
     {
         ROLStockInterop.UpdatePartDragCube(part);
     }
     if (updateExternal && onAnimStateChangeCallback != null)
     {
         onAnimStateChangeCallback(newState);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Updates part highlight renderer list, sends message to ModuleROTFlagDecal 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 ROLStockInterop.
 /// </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
     ROLStockInterop.UpdatePartHighlighting(part);
     part.airlock = LocateAirlock(part);
     PartGeometryUpdate(part);
     if (createDefaultCube && (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight))
     {
         ROLStockInterop.UpdatePartDragCube(part);
     }
     if (IsFARInstalled())
     {
         part.SendMessage("GeometryPartModuleRebuildMeshData");
     }
     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, ??)
     }
 }