private void DockingPortExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            log.debug(string.Format("Exploding Docking Port: {0}", part));

            var module = part.Module <ModuleDockingNode>();

            if (string.IsNullOrEmpty(module.referenceAttachNode))
            {
                return;
            }
            var an = part.FindAttachNode(module.referenceAttachNode);

            if (!an.attachedPart)
            {
                return;
            }
            var  distance = o.valueParam;
            Part partToBeMoved;

            if (an.attachedPart == part.parent)
            {
                distance     *= -1;
                partToBeMoved = part;
            }
            else
            {
                partToBeMoved = an.attachedPart;
            }
            partToBeMoved.transform.Translate(module.nodeTransform.forward * distance, Space.World);
        }
        private void ProcFairingHide(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            if (hasMod("ProceduralFairings"))
            {
                log.debug(string.Format("Hiding Procedural Fairing: {0}", part));
                var nct = part.FindModelTransform("nose_collider");
                if (!nct)
                {
                    return;
                }
                //var forward = EditorLogic.startPod.transform.forward;
                //var right = EditorLogic.startPod.transform.right;

                var forward   = EditorLogic.RootPart.transform.forward;
                var right     = EditorLogic.RootPart.transform.right;
                var compright = Vector3.Dot(nct.right, -(forward).normalized);
                log.debug(string.Format("Component of direction in root-part-forward: {0}", compright));
                if (compright > 0f)
                {
                    var renderer = part.GetComponentInChildren <Renderer>();
                    if (renderer)
                    {
                        renderer.enabled = false;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void StackDecouplerExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            MonoBehaviour.print("Exploding Stack Decoupler: " + part.ToString());
            var module = part.Module <ModuleDecouple>();

            if (module.isDecoupled)
            {
                return;
            }
            if (!part.parent)
            {
                return;
            }
            Vector3 dir;

            if (module.isOmniDecoupler)
            {
                foreach (var c in part.children)
                {
                    dir = Vector3.Normalize(c.transform.position - part.transform.position);
                    c.transform.Translate(dir * o.valueParam, Space.World);
                }
            }
            dir = Vector3.Normalize(part.transform.position - part.parent.transform.position);
            part.transform.Translate(dir * o.valueParam, Space.World);
        }
        private void KASConnectorPortExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
#if KAS
            if (hasMod("KAS"))
            {
                var module = part.Module <KAS.KASLinkTargetBase>();//this creates KAS Dependancy.
                if (string.IsNullOrEmpty(module.attachNodeName))
                {
                    return;
                }
                var an = part.FindAttachNode(module.attachNodeName);
                if (!an.attachedPart)
                {
                    return;
                }
                var  distance = o.valueParam;
                Part partToBeMoved;
                if (an.attachedPart == part.parent)
                {
                    distance     *= -1;
                    partToBeMoved = part;
                }
                else
                {
                    partToBeMoved = an.attachedPart;
                }
                Vector3 dir = Vector3.Normalize(an.attachedPart.transform.position - part.transform.position);
                partToBeMoved.transform.Translate(dir * distance, Space.World);
            }
#endif
        }
Ejemplo n.º 5
0
        private void RadialDecouplerExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            MonoBehaviour.print("Exploding Radial Decoupler: " + part.ToString());
            var module = part.Module <ModuleAnchoredDecoupler>();

            if (module.isDecoupled)
            {
                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;
            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 StackDecouplerExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            log.debug(string.Format("Exploding Stack Decoupler: {0}", part));

            var module = part.Module <ModuleDecouple>();

            if (module.isDecoupled)
            {
                return;
            }
            if (!module.stagingEnabled)
            {
                return;
            }
            if (!part.parent)
            {
                return;
            }
            Vector3 dir;

            if (module.isOmniDecoupler)
            {
                foreach (var c in part.children)
                {
                    dir = Vector3.Normalize(c.transform.position - part.transform.position);
                    c.transform.Translate(dir * o.valueParam, Space.World);
                }
            }
            dir = Vector3.Normalize(part.transform.position - part.parent.transform.position);
            part.transform.Translate(dir * o.valueParam, Space.World);
        }
Ejemplo n.º 7
0
 private void PartHideRecursive(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     foreach (var r in part.GetComponentsInChildren <Renderer>())
     {
         r.enabled = false;
     }
 }
Ejemplo n.º 8
0
 private void KASConnectorPortExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     if (hasMod("KAS"))
     {
         var module = part.Module <KAS.KASModulePort>();//this creates KAS Dependancy.
         if (string.IsNullOrEmpty(module.attachNode))
         {
             return;
         }
         var an = part.findAttachNode(module.attachNode);
         if (!an.attachedPart)
         {
             return;
         }
         var  distance = o.valueParam;
         Part partToBeMoved;
         if (an.attachedPart == part.parent)
         {
             distance     *= -1;
             partToBeMoved = part;
         }
         else
         {
             partToBeMoved = an.attachedPart;
         }
         partToBeMoved.transform.Translate(module.portNode.forward * distance, Space.World);
     }
 }
Ejemplo n.º 9
0
 private void PartHideRecursive(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     MonoBehaviour.print("Hiding Part " + part.ToString());
     foreach (var r in part.GetComponentsInChildren <Renderer>())
     {
         r.enabled = false;
     }
 }
        private void PartHideRecursive(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            log.debug(string.Format("Hiding Part {0}", part));

            foreach (var r in part.GetComponentsInChildren <Renderer>())
            {
                r.enabled = false;
            }
        }
        private void StockProcFairingHide(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            log.debug(string.Format("Hiding StockProcFairingHide Fairing: {0}", part));
            var module = part.Module <ModuleProceduralFairing>();

            foreach (var p in module.Panels)
            {
                p.go.SetActive(false);
            }
        }
Ejemplo n.º 12
0
        private void EngineFairingHide(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            var module = part.Module <ModuleJettison>();

            if (module.jettisonTransform)
            {
                foreach (var r in module.jettisonTransform.gameObject.GetComponentsInChildren <Renderer>())
                {
                    r.enabled = false;
                }
            }
        }
Ejemplo n.º 13
0
        private void EngineFairingExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            var module = part.Module <ModuleJettison>();

            if (!module.isJettisoned)
            {
                if (!module.isFairing)
                {
                    module.jettisonTransform.Translate(module.jettisonDirection * o.valueParam);
                }
            }
        }
Ejemplo n.º 14
0
        private void EngineFairingExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            MonoBehaviour.print("Exploding Engine Fairing: " + part.ToString());
            var module = part.Module <ModuleJettison>();

            if (!module.isJettisoned)
            {
                if (!module.isFairing)
                {
                    module.jettisonTransform.Translate(module.jettisonDirection * o.valueParam);
                }
            }
        }
Ejemplo n.º 15
0
        private void ProcFairingExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            MonoBehaviour.print("Exploding Procedural Fairing: " + part.ToString());
            var nct = part.FindModelTransform("nose_collider");

            if (!nct)
            {
                return;
            }
            MeshFilter mf;
            Vector3    extents = (mf = part.gameObject.GetComponentInChildren <MeshFilter>()) ? mf.mesh.bounds.size : new Vector3(o.valueParam, o.valueParam, o.valueParam);

            part.transform.Translate(Vector3.Scale(nct.right, extents), Space.World);
        }
        private void RadialDecouplerExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            log.debug(string.Format("Exploding Radial Decoupler: {0}", part));

            var module = part.Module <ModuleAnchoredDecoupler>();

            if (module.isDecoupled)
            {
                return;
            }
            if (!module.stagingEnabled)
            {
                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;
            }
            if (part.name.StartsWith("kv") && part.name.EndsWith("Pod"))
            {
                partToBeMoved.transform.Translate(-1 * part.transform.up * distance, Space.World);
            }
            else
            {
                partToBeMoved.transform.Translate(part.transform.right * distance, Space.World);
            }
        }
Ejemplo n.º 17
0
 private void ProcFairingExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     if (hasMod("ProceduralFairings"))
     {
         var nct = part.FindModelTransform("nose_collider");
         if (!nct)
         {
             return;
         }
         this.procFairingOffset = o.valueParam;
         Vector3 extents = new Vector3(o.valueParam, o.valueParam, o.valueParam);
         part.transform.Translate(Vector3.Scale(nct.right, extents), Space.World);
     }
 }
Ejemplo n.º 18
0
        private void ProcFairingExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            //MonoBehaviour.print("Exploding Procedural Fairing: " + part.ToString());
            var nct = part.FindModelTransform("nose_collider");

            //Debug.Log(string.Format("KVV: ProcFairingExplode {0}", nct.ToString()));
            if (!nct)
            {
                return;
            }
            this.procFairingOffset = o.valueParam; // steal the offset value. to be added to vessel width for rendering.
            Vector3 extents = new Vector3(o.valueParam, o.valueParam, o.valueParam);

            part.transform.Translate(Vector3.Scale(nct.right, extents), Space.World);
        }
        private void StockProcFairingExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            log.debug(string.Format("Exploding Procedural Fairing: {0}", part));
            fairingPanels = new List <ProceduralFairings.FairingPanel>();
            var module = part.Module <ModuleProceduralFairing>();

            fairingPanelValueParam = o.valueParam;
            foreach (var p in module.Panels)
            {
                fairingPanels.Add(p);
                p.SetExplodedView(VesselViewConfig.fairingPanelValueParam);
                //p.SetTgtExplodedView(VesselViewConfig.fairingPanelValueParam);
                p.SetOpacity(opacity);
                //p.SetTgtOpacity(0);
            }
        }
Ejemplo n.º 20
0
        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);
        }
Ejemplo n.º 21
0
        private void ProcFairingHide(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
        {
            MonoBehaviour.print("Hiding Procedural Fairing: " + part.ToString());
            var nct = part.FindModelTransform("nose_collider");

            if (!nct)
            {
                return;
            }
            var forward = EditorLogic.startPod.transform.forward;
            var right   = EditorLogic.startPod.transform.right;

            if (Vector3.Dot(nct.right, -(forward + right).normalized) > 0f)
            {
                var renderer = part.GetComponentInChildren <Renderer>();
                if (renderer)
                {
                    renderer.enabled = false;
                }
            }
        }
Ejemplo n.º 22
0
        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;
                    }
                }
            }
        }
 private void ProcFairingExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     if (hasMod("ProceduralFairings"))
     {
         var nct = part.FindModelTransform("nose_collider");
         if (!nct) return;
         this.procFairingOffset = o.valueParam;
         Vector3 extents = new Vector3(o.valueParam, o.valueParam, o.valueParam);
         part.transform.Translate(Vector3.Scale(nct.right, extents), Space.World);
     }
 }
 private void StockProcFairingSetOpacity(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     opacity = o.valueParam;
 }
 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 PartHideRecursive(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     foreach (var r in part.GetComponentsInChildren<Renderer>())
     {
         r.enabled = false;
     }
 }
 private void KASConnectorPortExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     if (hasMod("KAS"))
     {
         var module = part.Module<KAS.KASModulePort>();//this creates KAS Dependancy.  
         if (string.IsNullOrEmpty(module.attachNode)) return;
         var an = part.findAttachNode(module.attachNode);
         if (!an.attachedPart) return;
         var distance = o.valueParam;
         Part partToBeMoved;
         if (an.attachedPart == part.parent)
         {
             distance *= -1;
             partToBeMoved = part;
         }
         else
         {
             partToBeMoved = an.attachedPart;
         }
         partToBeMoved.transform.Translate(module.portNode.forward * distance, Space.World);
     }
 }
 private void EngineFairingExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     var module = part.Module<ModuleJettison>();
     if (!module.isJettisoned)
     {
         if (!module.isFairing)
         {
             module.jettisonTransform.Translate(module.jettisonDirection * o.valueParam);
         }
     }
 }
 private void ProcFairingExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     MonoBehaviour.print("Exploding Procedural Fairing: " + part.ToString());
     var nct = part.FindModelTransform("nose_collider");
     if (!nct) return;
     MeshFilter mf;
     Vector3 extents = (mf = part.gameObject.GetComponentInChildren<MeshFilter>()) ? mf.mesh.bounds.size : new Vector3(o.valueParam, o.valueParam, o.valueParam);
     part.transform.Translate(Vector3.Scale(nct.right, extents), Space.World);
 }
 private void EngineFairingHide(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     MonoBehaviour.print("Hiding Engine Fairing: " + part.ToString());
     var module = part.Module<ModuleJettison>();
     if (module.jettisonTransform)
     {
         foreach (var r in module.jettisonTransform.gameObject.GetComponentsInChildren<Renderer>())
         {
             r.enabled = false;
         }
     }
 }
        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;
                }
            }
        }
 private void PartHideRecursive(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     MonoBehaviour.print("Hiding Part " + part.ToString());
     foreach (var r in part.GetComponentsInChildren<Renderer>())
     {
         r.enabled = false;
     }
 }
 private void StackDecouplerExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     MonoBehaviour.print("Exploding Stack Decoupler: " + part.ToString());
     var module = part.Module<ModuleDecouple>();
     if (module.isDecoupled) return;
     if (!part.parent) return;
     Vector3 dir;
     if (module.isOmniDecoupler)
     {
         foreach (var c in part.children)
         {
             dir = Vector3.Normalize(c.transform.position - part.transform.position);
             c.transform.Translate(dir * o.valueParam, Space.World);
         }
     }
     dir = Vector3.Normalize(part.transform.position - part.parent.transform.position);
     part.transform.Translate(dir * o.valueParam, Space.World);
 }
 private void RadialDecouplerExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     MonoBehaviour.print("Exploding Radial Decoupler: " + part.ToString());
     var module = part.Module<ModuleAnchoredDecoupler>();
     if (module.isDecoupled) 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;
     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)
 {
     MonoBehaviour.print("Hiding Procedural Fairing: " + part.ToString());
     var nct = part.FindModelTransform("nose_collider");
     if (!nct) return;
     var forward = EditorLogic.startPod.transform.forward;
     var right = EditorLogic.startPod.transform.right;
     if (Vector3.Dot(nct.right, -(forward + right).normalized) > 0f)
     {
         var renderer = part.GetComponentInChildren<Renderer>();
         if (renderer) renderer.enabled = false;
     }
 }
 private void EngineFairingExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     MonoBehaviour.print("Exploding Engine Fairing: " + part.ToString());
     var module = part.Module<ModuleJettison>();
     if (!module.isJettisoned)
     {
         if (!module.isFairing)
         {
             module.jettisonTransform.Translate(module.jettisonDirection * o.valueParam);
         }
     }
 }
 private void DockingPortExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
 {
     MonoBehaviour.print("Exploding Docking Port: " + part.ToString());
     var module = part.Module<ModuleDockingNode>();
     if (string.IsNullOrEmpty(module.referenceAttachNode)) return;
     var an = part.findAttachNode(module.referenceAttachNode);
     if (!an.attachedPart) return;
     var distance = o.valueParam;
     Part partToBeMoved;
     if (an.attachedPart == part.parent)
     {
         distance *= -1;
         partToBeMoved = part;
     }
     else
     {
         partToBeMoved = an.attachedPart;
     }
     partToBeMoved.transform.Translate(module.nodeTransform.forward * distance, Space.World);
 }