Jump to content

Search the Community

Showing results for tags 'kspfield'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements
    • Welcome Aboard
  • Kerbal Space Program 1
    • KSP1 Discussion
    • KSP1 Suggestions & Development Discussion
    • KSP1 Challenges & Mission ideas
    • KSP1 The Spacecraft Exchange
    • KSP1 Mission Reports
    • KSP1 Gameplay and Technical Support
    • KSP1 Mods
    • KSP1 Expansions
  • Kerbal Space Program 2
    • KSP2 Dev Updates
    • KSP2 Discussion
    • KSP2 Suggestions and Development Discussion
    • Challenges & Mission Ideas
    • The KSP2 Spacecraft Exchange
    • Mission Reports
    • KSP2 Prelaunch Archive
  • Kerbal Space Program 2 Gameplay & Technical Support
    • KSP2 Gameplay Questions and Tutorials
    • KSP2 Technical Support (PC, unmodded installs)
    • KSP2 Technical Support (PC, modded installs)
  • Kerbal Space Program 2 Mods
    • KSP2 Mod Discussions
    • KSP2 Mod Releases
    • KSP2 Mod Development
  • Community
    • Science & Spaceflight
    • Kerbal Network
    • The Lounge
    • KSP Fan Works
  • International
    • International

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Skype


Twitter


About me


Location


Interests

Found 4 results

  1. As far as I can tell, it seems to be impossible to make two different instances of the same PartModule class end up having two different min/max ranges for the same UI slider on the right-click context menu. It's acting for all the world as if all instances of the PartModule must share the same min/max values and whichever instance happens to have altered them most recently, those values get used from then on by all the other instances too. (in other words, it's behaving exactly like static member fields on a class would). Here's an example of how I'm trying to dynamically change the min/max range values at runtime per-instance: It does this by reading the values from the part.cfg file (so instances of this PartModule for different parts can have different settings for the range allowed on the slider), and applying the value to the slider, like so: BaseField field; DebugMsg("LaserDist is trying to config GUI panel fields from settings:"); DebugMsg(String.Format("Part name = {0}, MaxBendX = {1}, MaxBendY = {2}", part.name, MaxBendX, MaxBendY)); field = Fields["BendX"]; ((UI_FloatRange)field.uiControlEditor).minValue = -MaxBendX; ((UI_FloatRange)field.uiControlEditor).maxValue = MaxBendX; if( MaxBendX == 0f ) { field.guiActive = false; field.guiActiveEditor = false; } else { field.guiActive = true; field.guiActiveEditor = true; } I verified that it is indeed seeing a different value for MaxBendX for two different parts, and is indeed running the code above two different times once for each part, and that it is indeed storing two different values for the *other* properties of the field "BendX" just fine - i.e. the guiActive and guiActiveEditor boolean flags *are* indeed behaving differently for the two different instances. If I set one of them to have a MaxBendX of 0 and the other to have a MaxBendX of 15, then it *does* hide the one with a value of 0 just like the above code shows it trying to do. But when I try to make them both have a nonzero value for MaxBendX, but a different nonzero value from each other, I just can't seem to force them to have different settings for max and min. If I set one partA's MaxBendX to 15 in the part.cfg file, and set partB's MaxBendX to 20 in its part.cfg file, then either *both* end up having ranges from -15 to +15 on their sliders, or *both* end up having ranges from -20 to +20 on their sliders. Which one I end up with seems to depend on which part KSP loads last. I proved this by changing the names of the parts to make them get sorted differently, and thus get KSP to load them in the opposite order. If partA loads last, then both partA and partB have a range of -15 to +15. If partB loads last, then both partA and PartB have a range of -20 to +20. I can't get partA to go from -15 to +15 and make partB go from -20 to +20. Is there a way for me to break out of this static-like behavior of the minValue and MaxValue so I can make them differ or am I just stuck?
  2. I have a PartModule that adds labels (KSPFields) to a part menu. Since computing the info to be displayed on that label is expensive, I would like to detect if the menu is actually open so I can skip computation. How do I detect if part menu is open?
  3. I have a KSPField with the UI_ChooseOption user interface attached. Now I would really like to make it so, that it was only available on EVA. However, it turns out the KSPField does not have that feature, but UI_ChooseOption cannot be used with KSPEvents since it will not accept a method.... What can be done. I considered simply hiding the UI in flight unless I was on EVA. However, I am not sure how to do that. Does anybody know a nice way to have the above, or something similar to be bound to EVA. Alternatively, can anybody advice on how to detect EVA? And which events to subscribe to to detect it.
  4. Is it possible to add arbitrary number of integer ksp fields at runtime in partmodule ? Closest example is at KSPAPIExtensions github page for a pre-defined chooser-type field, but i need one for int variable created at runtime. I did also find some examples in github sources of Infernal Robotics, but they also apply only to predefined variables. I did compile a variable with KSPField that has functions defined in its getter and setter, no errors were thrown. I don't know how to formulate my question but this is what i need : - variable is allocated at runtime as part of array or list - variable needs to be displayed to user in UI (this is where KSPAPiExt helps) Also, is KSP API Extensions at all capable of displaying values inside array or (preferably) List ?
×
×
  • Create New...