public virtual void FixedUpdate() { if (!limitsSet && PFUtils.canCheckTech()) { limitsSet = true; float minSize = PFUtils.getTechMinValue("PROCFAIRINGS_MINDIAMETER", 0.25f); float maxSize = PFUtils.getTechMaxValue("PROCFAIRINGS_MAXDIAMETER", 30); PFUtils.setFieldRange(Fields["manualMaxSize"], minSize, maxSize * 2); ((UI_FloatEdit)Fields["manualMaxSize"].uiControlEditor).incrementLarge = diameterStepLarge; ((UI_FloatEdit)Fields["manualMaxSize"].uiControlEditor).incrementSmall = diameterStepSmall; ((UI_FloatEdit)Fields["manualCylStart"].uiControlEditor).incrementLarge = heightStepLarge; ((UI_FloatEdit)Fields["manualCylStart"].uiControlEditor).incrementSmall = heightStepSmall; ((UI_FloatEdit)Fields["manualCylEnd"].uiControlEditor).incrementLarge = heightStepLarge; ((UI_FloatEdit)Fields["manualCylEnd"].uiControlEditor).incrementSmall = heightStepSmall; } if (!part.packed && topBasePart != null) { var adapter = part.GetComponent <ProceduralFairingAdapter>(); if (adapter) { topBasePart = adapter.getTopPart(); if (topBasePart == null) { removeJoints(); } } } }
public virtual void FixedUpdate() { if (!limitsSet && PFUtils.canCheckTech()) { limitsSet = true; float minSize = PFUtils.getTechMinValue(minSizeName, 0.25f); float maxSize = PFUtils.getTechMaxValue(maxSizeName, 30); PFUtils.setFieldRange(Fields["size"], minSize, maxSize); ((UI_FloatEdit)Fields["size"].uiControlEditor).incrementLarge = diameterStepLarge; ((UI_FloatEdit)Fields["size"].uiControlEditor).incrementSmall = diameterStepSmall; } if (size != oldSize) { resizePart(size); } justLoaded = false; }
public override void FixedUpdate() { base.FixedUpdate(); if (!limitsSet && PFUtils.canCheckTech()) { limitsSet = true; float minSize = PFUtils.getTechMinValue("PROCFAIRINGS_MINDIAMETER", 0.25f); float maxSize = PFUtils.getTechMaxValue("PROCFAIRINGS_MAXDIAMETER", 30); PFUtils.setFieldRange(Fields["baseSize"], minSize, maxSize); PFUtils.setFieldRange(Fields["topSize"], minSize, maxSize); ((UI_FloatEdit)Fields["baseSize"].uiControlEditor).incrementLarge = diameterStepLarge; ((UI_FloatEdit)Fields["baseSize"].uiControlEditor).incrementSmall = diameterStepSmall; ((UI_FloatEdit)Fields["topSize"].uiControlEditor).incrementLarge = diameterStepLarge; ((UI_FloatEdit)Fields["topSize"].uiControlEditor).incrementSmall = diameterStepSmall; ((UI_FloatEdit)Fields["height"].uiControlEditor).incrementLarge = heightStepLarge; ((UI_FloatEdit)Fields["height"].uiControlEditor).incrementSmall = heightStepSmall; ((UI_FloatEdit)Fields["extraHeight"].uiControlEditor).incrementLarge = heightStepLarge; ((UI_FloatEdit)Fields["extraHeight"].uiControlEditor).incrementSmall = heightStepSmall; } if (isShipModified) { isShipModified = false; // Remove the engine fairing (if there is any) from topmost node. if (!engineFairingRemoved) { var node = part.FindAttachNode(topNodeName); if (node != null && node.attachedPart != null) { var tp = node.attachedPart; if (HighLogic.LoadedSceneIsEditor || !tp.packed) { var comps = tp.GetComponents <ModuleJettison>(); for (int i = 0; i < comps.Length; i++) { var mj = comps [i]; var jt = tp.FindModelTransform(mj.jettisonName); if (jt == null) { jt = mj.jettisonTransform; } if (jt != null) { jt.gameObject.SetActive(false); } mj.jettisonName = null; mj.jettisonTransform = null; } if (!HighLogic.LoadedSceneIsEditor) { engineFairingRemoved = true; } } } } if (!HighLogic.LoadedSceneIsEditor) { if (isTopNodePartPresent) { var tp = getTopPart(); if (tp == null) { isTopNodePartPresent = false; Events["UIToggleTopNodeDecouple"].guiActive = false; } else { if (topNodeDecouplesWhenFairingsGone && !CheckForFairingPresent()) { PartModule item = part.Modules["ModuleDecouple"]; if (item == null) { Debug.LogError("[PF]: Cannot decouple from top part!", this); } else { RemoveTopPartJoints(); ((ModuleDecouple)item).Decouple(); part.stackIcon.RemoveIcon(); StageManager.Instance.SortIcons(true); isFairingPresent = false; isTopNodePartPresent = false; Events["UIToggleTopNodeDecouple"].guiActive = false; } } } } if (isStaged) { isStaged = false; if (part != null) { if (stageNum == part.inverseStage) { part.stackIcon.RemoveIcon(); StageManager.Instance.SortIcons(true); Events["UIToggleTopNodeDecouple"].guiActive = false; } } } } } }
public override void FixedUpdate() { base.FixedUpdate(); if (!limitsSet && PFUtils.canCheckTech()) { limitsSet = true; float minSize = PFUtils.getTechMinValue("PROCFAIRINGS_MINDIAMETER", 0.25f); float maxSize = PFUtils.getTechMaxValue("PROCFAIRINGS_MAXDIAMETER", 30); PFUtils.setFieldRange(Fields["baseSize"], minSize, maxSize); PFUtils.setFieldRange(Fields["topSize"], minSize, maxSize); ((UI_FloatEdit)Fields["baseSize"].uiControlEditor).incrementLarge = diameterStepLarge; ((UI_FloatEdit)Fields["baseSize"].uiControlEditor).incrementSmall = diameterStepSmall; ((UI_FloatEdit)Fields["topSize"].uiControlEditor).incrementLarge = diameterStepLarge; ((UI_FloatEdit)Fields["topSize"].uiControlEditor).incrementSmall = diameterStepSmall; ((UI_FloatEdit)Fields["height"].uiControlEditor).incrementLarge = heightStepLarge; ((UI_FloatEdit)Fields["height"].uiControlEditor).incrementSmall = heightStepSmall; ((UI_FloatEdit)Fields["extraHeight"].uiControlEditor).incrementLarge = heightStepLarge; ((UI_FloatEdit)Fields["extraHeight"].uiControlEditor).incrementSmall = heightStepSmall; } if (!engineFairingRemoved) { var node = part.findAttachNode(topNodeName); if (node != null && node.attachedPart != null) { var tp = node.attachedPart; if (HighLogic.LoadedSceneIsEditor || !tp.packed) { foreach (var mj in tp.GetComponents <ModuleJettison>()) { // print("[ProceduralFairingAdapter] removing engine fairings "+mj); var jt = tp.FindModelTransform(mj.jettisonName); if (jt == null) { jt = mj.jettisonTransform; } if (jt != null) { // print("[ProceduralFairingAdapter] disabling engine fairing "+jt); jt.gameObject.SetActive(false); } mj.jettisonName = null; mj.jettisonTransform = null; // tp.RemoveModule(mj); } if (!HighLogic.LoadedSceneIsEditor) { engineFairingRemoved = true; } } } } if (!HighLogic.LoadedSceneIsEditor) { var node = part.findAttachNode(topNodeName); if (node != null && node.attachedPart != null) { var tp = node.attachedPart; foreach (var n in part.findAttachNodes("connect")) { if (n.attachedPart != null) { return; } } if (part.parent == tp) { part.decouple(0); } else if (tp.parent == part) { tp.decouple(0); } else { Debug.LogError("[ProceduralFairingAdapter] Can't decouple from top part", this); } } } }
public override void FixedUpdate() { base.FixedUpdate(); if (!limitsSet && PFUtils.canCheckTech()) { limitsSet = true; float minSize = PFUtils.getTechMinValue("PROCFAIRINGS_MINDIAMETER", 0.25f); float maxSize = PFUtils.getTechMaxValue("PROCFAIRINGS_MAXDIAMETER", 30); PFUtils.setFieldRange(Fields["baseSize"], minSize, maxSize); PFUtils.setFieldRange(Fields["topSize"], minSize, maxSize); ((UI_FloatEdit)Fields["baseSize"].uiControlEditor).incrementLarge = diameterStepLarge; ((UI_FloatEdit)Fields["baseSize"].uiControlEditor).incrementSmall = diameterStepSmall; ((UI_FloatEdit)Fields["topSize"].uiControlEditor).incrementLarge = diameterStepLarge; ((UI_FloatEdit)Fields["topSize"].uiControlEditor).incrementSmall = diameterStepSmall; ((UI_FloatEdit)Fields["height"].uiControlEditor).incrementLarge = heightStepLarge; ((UI_FloatEdit)Fields["height"].uiControlEditor).incrementSmall = heightStepSmall; ((UI_FloatEdit)Fields["extraHeight"].uiControlEditor).incrementLarge = heightStepLarge; ((UI_FloatEdit)Fields["extraHeight"].uiControlEditor).incrementSmall = heightStepSmall; } if (isShipModified) { isShipModified = false; // We used to remove the engine fairing (if there is any) from topmost node, but lately that's been causing NREs. // Since KSP gives us this option nativley, let's just use KSP to do that if we want. if (!HighLogic.LoadedSceneIsEditor) { if (isTopNodePartPresent) { var tp = getTopPart(); if (tp == null) { isTopNodePartPresent = false; Events["UIToggleTopNodeDecouple"].guiActive = false; } else { if (topNodeDecouplesWhenFairingsGone && !CheckForFairingPresent()) { PartModule item = part.Modules["ModuleDecouple"]; if (item == null) { Debug.LogError("[PF]: Cannot decouple from top part!", this); } else { RemoveTopPartJoints(); ((ModuleDecouple)item).Decouple(); part.stackIcon.RemoveIcon(); StageManager.Instance.SortIcons(true); isFairingPresent = false; isTopNodePartPresent = false; Events["UIToggleTopNodeDecouple"].guiActive = false; } } } } if (isStaged) { isStaged = false; if (part != null) { if (stageNum == part.inverseStage) { part.stackIcon.RemoveIcon(); StageManager.Instance.SortIcons(true); Events["UIToggleTopNodeDecouple"].guiActive = false; } } } } } }