Jump to content

pydude

Members
  • Posts

    27
  • Joined

  • Last visited

Posts posted by pydude

  1. Okay, so I've made a little bit of progress. Using this code

    for (var i = 0; i < vessel.patchedConicRenderer.patchRenders.Count(); i++)
                    {
                        vessel.patchedConicRenderer.patchRenders[i].visible = false;
    
                    }

    , I have stopped the conics from rendering. However, there are some problems.

    First, the conics sometimes flicker in if you zoom in and out in the map view. They only show up for a split second, but for my intended use, this would be a problem. How do I stop this from happening?

    Second, the orbit lines are not rendering. I don't know how to draw the orbit, but not the encounters. How can do this?

  2. 5 minutes ago, HebaruSan said:

    That member is marked as private. That means that members of the Vessel class can use it, but no one else can. It's one of the ways object-oriented programmers protect internal functionality from external dependencies

    Oh. I'm such a noob at c#.

    6 minutes ago, HebaruSan said:

    What happens if you set vessel.patchedConicRenderer.renderEnabled = false

    Setting renderEnabled to false doesn't work. It seems to change back to true by itself every frame. I had actually already tried that before starting this thread. I'll have look at some of the other properties, though.

  3. @Benjamin Kerman Vessel.PatchedConicsUnlocked apparently doesn't exist :huh:. It's listed in the documentation, but doesn't seem to actually be there. 

    'Vessel' does not contain a definition for 'PatchedConicsUnlocked' and no extension method 'PatchedConicsUnlocked' accepting a first argument of type 'Vessel' could be found (are you missing a using directive or an assembly reference?)

    Seems odd. I tried patchedConicsUnlocked, too, with a lowercase p. Still no luck. 

  4. How can I disable rendering patched conics for a vessel? I want it to look like before you upgrade the tracking station, with just the grey orbit lines. Examples:

    (I got the images by taking a screenshot without/with the tracking station upgraded.)

    I need to be able to switch back and forth between the two modes, so nothing permanent. 

    How can I do this via code?

     

  5. @HebaruSan

    vessel.DiscoveryInfo.SetLevel(DiscoveryLevels.Owned);

    does not work for my purposes because that method does not allow changing individual properties.  

    vessel.DiscoveryInfo.trackingStatus.ItemLevel = DiscoveryLevels.Owned;

    just flat out doesn't work, saying 

    Error	CS1061	'KnowledgeItem<string>' does not contain a definition for 'ItemLevel' and no extension method 'ItemLevel' accepting a first argument of type 'KnowledgeItem<string>' could be found (are you missing a using directive or an assembly reference?)

    The whole reason I'm messing around with this is to try to disable patched conics for the vessel. I'm trying to make it like Tracking Station level 1, with just the grey orbit lines. Do you know of any other ways to do this? 

  6. Thanks @sarbian, at least I can compile now. But it still is not working. I have changed the code to look like this: 

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using UnityEngine;
    
    
    namespace SignalTracking
    {
        /// <summary>
        /// My first part!
        /// </summary>
        public class testMod : Part
        {
            protected Rect windowPos;
            bool g = true;
            private void WindowGUI(int windowID)
            {
                GUIStyle mySty = new GUIStyle(GUI.skin.button);
                mySty.normal.textColor = mySty.focused.textColor = Color.white;
                mySty.hover.textColor = mySty.active.textColor = Color.yellow;
                mySty.onNormal.textColor = mySty.onFocused.textColor = mySty.onHover.textColor = mySty.onActive.textColor = Color.green;
                mySty.padding = new RectOffset(8, 8, 8, 8);
    
                GUILayout.BeginVertical();
                if (GUILayout.Button("DESTROY", mySty, GUILayout.ExpandWidth(true)))//GUILayout.Button is "true" when clicked
                {
                    this.explode();
                    this.onPartDestroy();
                    this.Die();
                }
                GUILayout.EndVertical();
    
                //DragWindow makes the window draggable. The Rect specifies which part of the window it can by dragged by, and is 
                //clipped to the actual boundary of the window. You can also pass no argument at all and then the window can by
                //dragged by any part of it. Make sure the DragWindow command is AFTER all your other GUI input stuff, or else
                //it may "cover up" your controls and make them stop responding to the mouse.
                GUI.DragWindow(new Rect(0, 0, 10000, 20));
    
            }
            private void drawGUI()
            {
                GUI.skin = HighLogic.Skin;
                windowPos = GUILayout.Window(1, windowPos, WindowGUI, "Self Destruct", GUILayout.MinWidth(100));
            }
            private void OnGUI()
            {
                
                if (g) {
                    drawGUI(); // Your current on postDrawQueue code
                }
            }
            protected override void onPartStart()
            {
                if ((windowPos.x == 0) && (windowPos.y == 0))//windowPos is used to position the GUI window, lets set it in the center of the screen
                {
                    windowPos = new Rect(Screen.width / 2, Screen.height / 2, 10, 10);
                }
            }
            protected override void onPartDestroy()
            {
                g = false;
            }
    
        }
    }

    Also, I might be putting it in the cfg wrong. Do I just go 

    MODULE
    	{
    		name = testMod
        }

    , or is that the wrong way to do it?

  7. Warning: Absolute n00b here.

    So, I'm having the following error:

    Error    CS0103    The name 'RenderingManager' does not exist in the current context 

    I can't figure out why this error is happening, I've added UnityEngine and Assembly-CSharp as references. 

    How do I fix this?

    complete code, if needed:

    (This is taken from a sample plugin project)

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using UnityEngine;
    
    
    namespace SignalTracking
    {
        /// <summary>
        /// My first part!
        /// </summary>
        public class SelfDestruct : Part
        {
            protected Rect windowPos;
    
            private void WindowGUI(int windowID)
            {
                GUIStyle mySty = new GUIStyle(GUI.skin.button);
                mySty.normal.textColor = mySty.focused.textColor = Color.white;
                mySty.hover.textColor = mySty.active.textColor = Color.yellow;
                mySty.onNormal.textColor = mySty.onFocused.textColor = mySty.onHover.textColor = mySty.onActive.textColor = Color.green;
                mySty.padding = new RectOffset(8, 8, 8, 8);
    
                GUILayout.BeginVertical();
                if (GUILayout.Button("DESTROY", mySty, GUILayout.ExpandWidth(true)))//GUILayout.Button is "true" when clicked
                {
                    this.explode();
                    this.onPartDestroy();
                    this.Die();
                }
                GUILayout.EndVertical();
    
                //DragWindow makes the window draggable. The Rect specifies which part of the window it can by dragged by, and is 
                //clipped to the actual boundary of the window. You can also pass no argument at all and then the window can by
                //dragged by any part of it. Make sure the DragWindow command is AFTER all your other GUI input stuff, or else
                //it may "cover up" your controls and make them stop responding to the mouse.
                GUI.DragWindow(new Rect(0, 0, 10000, 20));
    
            }
            private void drawGUI()
            {
                GUI.skin = HighLogic.Skin;
                windowPos = GUILayout.Window(1, windowPos, WindowGUI, "Self Destruct", GUILayout.MinWidth(100));
            }
            protected override void onFlightStart()  //Called when vessel is placed on the launchpad
            {
                RenderingManager.AddToPostDrawQueue(3, new Callback(drawGUI));//start the GUI
            }
            protected override void onPartStart()
            {
                if ((windowPos.x == 0) && (windowPos.y == 0))//windowPos is used to position the GUI window, lets set it in the center of the screen
                {
                    windowPos = new Rect(Screen.width / 2, Screen.height / 2, 10, 10);
                }
            }
            protected override void onPartDestroy()
            {
                RenderingManager.RemoveFromPostDrawQueue(3, new Callback(drawGUI)); //close the GUI
            }
    
        }
    }

     

  8. I have a problem with this mod. It causes my maneuver nodes to function incorrectly. When I create a maneuver node, the delta-v requirements slowly go up. This topic shows what I am talking about. To reproduce:

    Start a new save. Turn on Lossless Physics in the settings of this mod. Make a vessel for orbiting. Sometime during ascent through the atmosphere, use physics warp for a while. Finish establishing an orbit. Create a maneuver node. Watch as its delta-v requirements go up. 

×
×
  • Create New...