public void LateUpdate() { FARAeroUtil.ResetEditorParts(); FARBaseAerodynamics.GlobalCoLReady = false; if (EditorLogic.fetch) { if (editorGUI == null) { editorGUI = new FAREditorGUI(); //editorGUI.LoadGUIParameters(); editorGUI.RestartCtrlGUI(); } if (EditorLogic.startPod != null) { var editorShip = FARAeroUtil.AllEditorParts; if (FARAeroUtil.EditorAboutToAttach() && count++ >= 10) { EditorPartsChanged = true; count = 0; } if (part_count_all != editorShip.Count || part_count_ship != EditorLogic.SortedShipList.Count || EditorPartsChanged) { FindPartsWithoutFARModel(editorShip); foreach (Part p in editorShip) { foreach (PartModule m in p.Modules) { if (m is FARBaseAerodynamics) { (m as FARBaseAerodynamics).ClearShielding(); } } } foreach (Part p in editorShip) { foreach (PartModule m in p.Modules) { if (m is FARPartModule) { (m as FARPartModule).ForceOnVesselPartsChange(); } } } part_count_all = editorShip.Count; part_count_ship = EditorLogic.SortedShipList.Count; EditorPartsChanged = false; } } } }
public void LateUpdate() { if (!CompatibilityChecker.IsAllCompatible()) { return; } FARAeroUtil.ResetEditorParts(); FARBaseAerodynamics.GlobalCoLReady = false; if (EditorLogic.fetch) { if (editorGUI == null) { editorGUI = new FAREditorGUI(); //editorGUI.LoadGUIParameters(); editorGUI.RestartCtrlGUI(); GameEvents.onEditorUndo.Add(editorGUI.ResetAll); GameEvents.onEditorRedo.Add(editorGUI.ResetAll); } if (EditorLogic.RootPart != null) { editorShip = FARAeroUtil.AllEditorParts; if (buttonsNeedInitializing) { InitializeButtons(); } /*if (EditorLogic.RootPart != lastRootPart) * { * lastRootPart = EditorLogic.RootPart; * EditorPartsChanged = true; * }*/ if (FARAeroUtil.EditorAboutToAttach() && count++ >= 20) { EditorPartsChanged = true; count = 0; } if (part_count_all != editorShip.Count || part_count_ship != EditorLogic.SortedShipList.Count || EditorPartsChanged) { UpdateEditorShipModules(); } } else if (!buttonsNeedInitializing) { DestroyButtons(); } } }
private void UpdateCargoParts() { if (HighLogic.LoadedSceneIsEditor && FARAeroUtil.EditorAboutToAttach(false) && !FARAeroUtil.CurEditorParts.Contains(part)) { return; } if (bayAnim == null || !bayOpen || HighLogic.LoadedSceneIsEditor) { FindShieldedParts(); } }
private void UpdateCargoParts() { if (start == StartState.Editor && FARAeroUtil.EditorAboutToAttach(false) && !FARAeroUtil.CurEditorParts.Contains(part)) { return; } if (bayAnim == null || !bayOpen || start == StartState.Editor) { FindShieldedParts(); } }
public void LateUpdate() { if (!CompatibilityChecker.IsAllCompatible()) { return; } FARAeroUtil.ResetEditorParts(); FARBaseAerodynamics.GlobalCoLReady = false; if (EditorLogic.fetch) { if (editorGUI == null) { editorGUI = new FAREditorGUI(); //editorGUI.LoadGUIParameters(); editorGUI.RestartCtrlGUI(); } if (EditorLogic.startPod != null) { var editorShip = FARAeroUtil.AllEditorParts; if (FARAeroUtil.EditorAboutToAttach() && count++ >= 10) { EditorPartsChanged = true; count = 0; } if (part_count_all != editorShip.Count || part_count_ship != EditorLogic.SortedShipList.Count || EditorPartsChanged) { FindPartsWithoutFARModel(editorShip); for (int i = 0; i < editorShip.Count; i++) { Part p = editorShip[i]; for (int j = 0; j < p.Modules.Count; j++) { PartModule m = p.Modules[j]; if (m is FARBaseAerodynamics) { (m as FARBaseAerodynamics).ClearShielding(); } } } for (int i = 0; i < editorShip.Count; i++) { Part p = editorShip[i]; for (int j = 0; j < p.Modules.Count; j++) { PartModule m = p.Modules[j]; if (m is FARPartModule) { (m as FARPartModule).ForceOnVesselPartsChange(); } } } part_count_all = editorShip.Count; part_count_ship = EditorLogic.SortedShipList.Count; EditorPartsChanged = false; } } } }
private void FindShieldedParts() { if (start == StartState.Editor && FARAeroUtil.EditorAboutToAttach(false) && !FARAeroUtil.CurEditorParts.Contains(part)) { return; } if (minBounds.Count == 0) { CalculateFairingBounds(); } ClearShieldedParts(); UpdateShipPartsList(); foreach (Part p in VesselPartList) { if (FARShieldedParts.Contains(p) || p == null || p == part || part.symmetryCounterparts.Contains(p)) { continue; } FARBaseAerodynamics b = null; FARBasicDragModel d = null; FARWingAerodynamicModel w = null; Vector3 relPos = -this.part.transform.position; w = p.GetComponent <FARWingAerodynamicModel>(); if ((object)w == null) { d = p.GetComponent <FARBasicDragModel>(); } if ((object)w == null && (object)d == null) { continue; } //if (p.GetComponent<FARPayloadFairingModule>() != null) // continue; if (w) { b = w as FARBaseAerodynamics; relPos += w.AerodynamicCenter; } else { b = d as FARBaseAerodynamics; relPos += p.transform.TransformPoint(d.CenterOfDrag); //No attach node shifting with this } relPos = this.part.transform.worldToLocalMatrix.MultiplyVector(relPos); for (int i = 0; i < minBounds.Count; i++) { Vector3 minBoundVec, maxBoundVec; minBoundVec = minBounds[i]; maxBoundVec = maxBounds[i]; if (relPos.x < maxBoundVec.x && relPos.y < maxBoundVec.y && relPos.z < maxBoundVec.z && relPos.x > minBoundVec.x && relPos.y > minBoundVec.y && relPos.z > minBoundVec.z) { FARShieldedParts.Add(p); if (b) { b.isShielded = true; //print("Shielded: " + p.partInfo.title); } foreach (Part q in p.symmetryCounterparts) { if (q == null) { continue; } FARShieldedParts.Add(q); b = q.GetComponent <FARBaseAerodynamics>(); if (b) { b.isShielded = true; //print("Shielded: " + p.partInfo.title); } } break; } } } partsShielded = FARShieldedParts.Count; }