Exemplo n.º 1
0
        private void OnEditorShipModified(ShipConstruct vesselConstruct)
        {
            if (vesselConstruct.Parts.Count == _editorPartCount)
            {
                return;
            }
            //Debug.Log("Calling RebuildCLSVessel as the part count has changed in the editor");

            if (null != _vessel)
            {
                _vessel.Clear();
                _vessel = null;
            }

            if (null != EditorLogic.RootPart)
            {
                _vessel = new CLSVessel();
                _vessel.Populate(EditorLogic.RootPart);

                // TODO recoupler support
            }

            _editorPartCount = vesselConstruct.Parts.Count;
            // First unhighlight the space that was selected.
            if (-1 != WindowSelectedSpace && WindowSelectedSpace < _vessel.Spaces.Count)
            {
                _vessel.Spaces[WindowSelectedSpace].Highlight(true);
            }
        }
        private void UpdateShipConstruct()
        {
            if (null != _vessel)
            {
                _vessel.Clear();
                _vessel = null;
            }

            if (EditorLogic.RootPart == null)
            {
                return;
            }

            try
            {
                // Build new vessel information
                _vessel = new CLSVessel();
                _vessel.Populate(EditorLogic.RootPart);

                // Recoupler support
                for (int i = requestedConnections.Count - 1; i >= 0; i--)
                {
                    ConnectPair connectPair = requestedConnections[i];
                    if (connectPair.part1.vessel != connectPair.part2.vessel)
                    {
                        requestedConnections.Remove(connectPair);
                    }
                    _vessel.MergeSpaces(connectPair.part1, connectPair.part2);
                }
            }
            catch (Exception ex)
            {
                Log.error(ex, "rebuild Vessel Error");
            }
        }
        private void RebuildCLSVessel()
        {
            if (null != _clsVessel)
            {
                _clsVessel.Clear();
                _clsVessel = null;
            }

            if (vessel.rootPart == null)
            {
                return;
            }

            try
            {
                // Build new vessel information
                _clsVessel = new CLSVessel();
                _clsVessel.Populate(vessel.rootPart);

                // TODO recoupler support
            }
            catch (Exception ex)
            {
                Debug.Log($"CLS rebuild Vessel Error:  { ex}");
            }
        }
 // Git Issue #85.  sometimes spaces are not updating on a vessel.  Deleting a pod does not clear the current vessel.
 private void OnEditorPodPicked(Part part)
 {
     _vessel.Clear();
     _vessel = null;
     if (null != EditorLogic.RootPart)
     {
         _vessel = new CLSVessel();
         _vessel.Populate(EditorLogic.RootPart);
     }
     _editorPartCount = 1;
 }
Exemplo n.º 5
0
        private void RebuildCLSVessel()
        {
            dirty = false;

            if (null != _clsVessel)
            {
                _clsVessel.Clear();
                _clsVessel = null;
            }

            if (vessel.rootPart == null)
            {
                return;
            }

            try
            {
                // Build new vessel information
                _clsVessel = new CLSVessel();
                _clsVessel.Populate(vessel.rootPart);

                // Recoupler support
                for (int i = CLSAddon.Instance.requestedConnections.Count - 1; i >= 0; i--)
                {
                    CLSAddon.ConnectPair connectPair = CLSAddon.Instance.requestedConnections[i];
                    if (connectPair.part1.vessel != connectPair.part2.vessel)
                    {
                        CLSAddon.Instance.requestedConnections.Remove(connectPair);
                    }
                    _clsVessel.MergeSpaces(connectPair.part1, connectPair.part2);
                }
            }
            catch (Exception ex)
            {
                Debug.Log($"CLS rebuild Vessel Error:  { ex}");
            }
        }