private void RadialDecouplerExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part) { var module = part.Module <ModuleAnchoredDecoupler>(); if (module.isDecoupled) { return; } if (!module.staged) { return; } if (string.IsNullOrEmpty(module.explosiveNodeID)) { return; } var an = module.explosiveNodeID == "srf" ? part.srfAttachNode : part.FindAttachNode(module.explosiveNodeID); if ((an == null) || (an.attachedPart == null)) { return; } var distance = o.valueParam; if (part.name.Contains("FairingCone")) { distance *= -1; } Part partToBeMoved; if (an.attachedPart == part.parent) { distance *= -1; partToBeMoved = part; } else { partToBeMoved = an.attachedPart; } partToBeMoved.transform.Translate(part.transform.right * distance, Space.World); }
private void ProcFairingHide(VesselElementViewOptions ol, VesselElementViewOption o, Part part) { if (hasMod("ProceduralFairings")) { var nct = part.FindModelTransform("nose_collider"); if (!nct) { return; } var forward = EditorLogic.RootPart.transform.forward; var right = EditorLogic.RootPart.transform.right; if (Vector3.Dot(nct.right, -forward.normalized) > 0f) { var renderer = part.GetComponentInChildren <Renderer>(); if (renderer) { renderer.enabled = false; } } } }