Jump to content

[1.12.x] IndicatorLights Community Extensions v1.6.2: Compatibility patches for IndicatorLights


Snark

Recommended Posts

What it does

Updates IndicatorLights for compatibility with third-party mods that either add new parts or modify existing stock ones.

Note: These are community-supplied patches. In most cases, the IndicatorLights author (Snark) hasn't personally verified that they work. Each patch includes a comment giving credit to the original author.

Don't see the mod you want? Contributions (e.g. via pull request on github) are welcome!

Download from SpaceDock
License:  MIT
Source code

 

How to install

Unzip the contents of "GameData" to your GameData folder, same as with most mods.

Note, requires that IndicatorLights also be installed in order to work:

Supported mods

Thank you to the community members who have contributed the following compatibility patches:

Miscellaneous enhancements:

  • Docking port direction indicators-- which way is up?  (Contributor: @Tonka Crash)

FAQ

  • Q: Can you add support for {my favorite mod} included?
  • A: Nope! Don't have the time. But if you want to write a patch for it, send it to me and I'll happily include it! :-)
  • Q: Hey, the patch for {one of the supported mods} has a bug in it! Will you fix it?
  • A: Probably not, unless it's trivially quick and easy to do. I (Snark) didn't write these patches, and in most cases haven't even tested them myself. I'm basically just a curator. Suggestion: Bring it up here in this thread, and ping the contributor of the patch that's giving you problems (they're listed above)-- maybe they'll have a solution.
  • Q: Why is this a separate mod, instead of just including it as part of IndicatorLights itself?
  • A: Easier for me to maintain, this way. Clear separation between "stuff I wrote" and "stuff other people wrote". Can have a separate (very permissive) license for this extensions mod, regardless of how IndicatorLights itself is licensed.
  • Q:  Okay, I'm convinced!  I want to help.  How can I add support for {my favorite mod} myself?
  • A:  Thank you, you're a pillar of the community!  :D  I've tried to make it as easy as possible for you, by documenting all the config in the modder's guide wiki for IndicatorLights, including a handy controller reference.  Also you can look at the existing config within IndicatorLights; it's liberally supplied with comments.  When you get something that works, just PM me and I'll work to get it added to the mod.  Thank you for your service!
  • Q:  Hmmm... figuring out how to place the indicator is hard.  Do I have to use special modeling tools or something?
  • A:  Not necessarily-- you can do it with just a text editor.  However, I've found that some judicious use of Blender at the outset can save a lot of trial and error.  See below for a description of what the process looks like.

 

How to add indicators to a part

Spoiler

There are different ways you can do it, but here's what my own typical workflow looks like when I want to instrument some part with indicator lights:

  1. Import the part into Blender.
  2. Delete the colliders from the model, since they're just visual clutter and get in the way of seeing the shape of the model itself.
  3. Create a tiny dummy object (like a small sphere).
  4. Use the X,Y,Z translator keys to move the dummy around until I've got it placed exactly where I want it on the model.
  5. Take note of the X, Y, Z coordinates.  Bear in mind that Blender uses a different coordinate axis convention than KSP does.
    • Blender X = KSP X
    • Blender Y = KSP Z
    • Blender Z = KSP Y
    • The (X, Y, Z) coordinates in KSP are as follows:  X is the part's left/right.  Y is the part's :prograde: axis (positive = up, in the VAB).  Z is the dorsal/ventral axis.
  6. Go edit the MM config file where I'm adding the IL config to the part.  Add the model for the mesh.
    • Can easily create an initial version of the config by just copying some existing part's IL config.  Also, lots of documentation is available on the wiki links mentioned above in the FAQ.
    • Take a guess at the rotation and scale.
    • For the location, use the coords from Blender (with the Y and Z coords swapped appropriately).
  7. Go into the VAB and see how it looks.
  8. Note any errors in scale, rotation, and positioning.
  9. Go back and tweak the config file in the editor.
  10. Back in KSP, leave the VAB and go back to the KSC view.
  11. Press alt+F11 to bring up the ModuleManager config menu, and choose "Quick Reload Database".
    • This one was an absolute lifesaver once I discovered that it was a thing.
    • It means I can tweak a config and check the update in KSP, without having to quit and reload KSP each time.
    • Yes, it still takes a few seconds to run... but it's a lot faster than quitting and restarting KSP.
  12. Repeat steps 7 to 11 until it looks right.
  13. Profit!

If you really, really don't want to use Blender, you don't have to-- you can just skip steps 1 through 5 in the above description, and just go straight to the config, and just take a guess at the X,Y,Z coords to get the ball rolling.  However, I've found that the initial trial-and-error can be a pain to get right, and I find that I usually save myself quite a few minutes of futzing around if I just use Blender for the initial positioning.

 

Gallery

Ven Stock Revamp

Ven Stock Revamp

 

Impossible Innovations

Impossible Innovations

 

MK1CabinHatch

MK1CabinHatch.png

 

MKS
MKSConstructionPorts.png

 

MSP-3000 Material Science Pod
MSP-3000.png

 

K2 Command Pod
K2Pod.png

Link to comment
Share on other sites

8 minutes ago, Jiraiyah said:

Thanks for crediting me sir, I appreciate it, but honestly, I will go for more and more mods when I get time to do it and specially if I can find an easier way other than tweak/test/tweak :wink:

Great, keep 'em coming!  :)

Yah, the tweak/test/tweak process of getting the indicators placed just so on the models is tedious.  When I'm doing it myself, I've found I can take some of the guesswork out of the process by using Blender, namely:

  1. import the part model into Blender
  2. delete out all the bits I don't want (mainly colliders)
  3. import the IndicatorLights mesh I plan on using (e.g. nubbinLamp or squareLamp or whatever)
  4. Use the Blender tools (mouse moves, and/or typing into the rotate/translate transform boxes) to place the mesh where I think it looks good
  5. Write down the numbers from the XYZ transform
  6. Go into the KSP config where I'm adding the meshes
  7. Put those numbers in

That gives me a bit of a "head start" on the tweaking process, but it's still far from perfect-- I usually end up needing to fine-tune the position anyway, and/or various complications can cause me to screw up (e.g. I drop a ball when juggling the difference of XYZ conventions between KSP and Blender, or the part uses a mesh scale in its config, or something).

So I almost always end up needing to do a few cycles of tweak/test/tweak for each part anyway... but using Blender up front at least helps me to reduce the number of cycles needed.  :wink:

Link to comment
Share on other sites

you know what would be nice? a way to tweak the config while ksp is running, and inside ksp somehow reloading that config to see the result :(

I know this is possible for the part config itself, but now that we are using module manager, well, that is out of the window, i wish module manager had a reload or something like that inside ksp

Edited by Jiraiyah
Link to comment
Share on other sites

3 hours ago, Jiraiyah said:

you know what would be nice? a way to tweak the config while ksp is running, and inside ksp somehow reloading that config to see the result :(

I know this is possible for the part config itself, but now that we are using module manager, well, that is out of the window, i wish module manager had a reload or something like that inside ksp

Yes, I've often wished the same thing myself.

FWIW, among the features I'm adding in the imminent next release of IndicatorLights is a new debug console command, /il, which should take some of the sting out of debugging IndicatorLights config (e.g. "why doesn't this work").  It's not comprehensive yet, but it already has enough stuff in it to be useful, and I'll be adding additional functionality to it as I go along.  (My algorithm thus far has been: whenever I stub my toe on something I need to diagnose, and /il doesn't have enough info in it, add stuff to /il until it is informative enough to diagnose the current problem.  Repeat as needed.  Once I've released it, then I can continue to do the same with problems that other folks run into.)

Alas, one thing that I'd really like to be able to do, that I haven't been able to find any way of doing, is to allow the command to adjust the positions of meshes on the part.  i.e. allow the command to do something like /il part 3 mesh squareLamp:0 x+0.01.  Not sure if it's actually impossible, or if it's simply the case that I haven't been able to discover the necessary secret incantations yet.

Link to comment
Share on other sites

hmm something just popped up in my brain, how about this, a separate mod with two place holder models, a window that does something like what ksp gave us (move/rotate/scale) then a button to calculate those params related to parent? that should give us a good head start to tweak numbers for original patches and the players won't need to install this mod at all !!

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for adding this! @Kerbas_ad_astra really glad Ven's is getting some love. It looks like Ven's versions of the 4 small experiments (therm, gravioli, etc) still have Snark's default indicator lights. Are you going to be fixing those too?

thanks again to both of you!

Link to comment
Share on other sites

On 10/10/2016 at 10:11 AM, Jiraiyah said:

you know what would be nice? a way to tweak the config while ksp is running, and inside ksp somehow reloading that config to see the result :(

Hi Jiraiyah,

Just wanted to point out that I've just added this feature to IndicatorLights in v1.2.2, which I just posted several hours ago.  It's now possible to use the IndicatorLights debug console UI to manually edit the color-source syntax of a light, "live", either in the vehicle editor or in flight, and instantly see the result on the ship.  Some caveats:

  • I haven't written the wiki docs for it yet, so thank you for your patience.  But it tries to be somewhat self-documenting, so if you just type /il help in the debug console and follow the prompts from there, it's reasonably straightforward.  I'll explain it better in the docs when I write them, but the process looks something like this:  (yeah, I know, not gonna win any awards for elegance, but it gets the job done)
    1. /il parts to list the IndicatorLights-enabled parts on the current ship, with a number next to each one
    2. choose the part you're interested in and note its number
    3. /il part <number> to show info for that part
    4. /il part <number> controllers to show a numbered list of all the IndicatorLights controllers on that part
    5. choose the controller you're interested in and note its number
    6. /il part <number> controller <number> to show info about that controller, including a list of all its IndicatorLights syntax fields
    7. /il part <number> controller <number> set <field_name> <color_source_syntax> to specify new syntax for that field
  • It's only a temporary override and will not persist with the ship or get saved to any .cfg files.  Any changes you make will get blown away the next time the ship is loaded.  So it's only a tool for experimenting with the syntax-- once you find a formula that you like, you'll need to copy it so you can then paste into whatever .cfg files are appropriate.
On 10/10/2016 at 10:11 AM, Jiraiyah said:

i wish module manager had a reload or something like that inside ksp

Turns out that it does!  :D Just recently found out about this:  you can press Alt+F11 when in the space center view.  It pops up a little debug UI dialog with a button on it that tells ModuleManager to re-load all the .cfg files.  It's not instant-- takes a while to load everything.  But it's still way faster than restarting KSP.

Link to comment
Share on other sites

18 hours ago, Snark said:

Hi Jiraiyah,

Just wanted to point out that I've just added this feature to IndicatorLights in v1.2.2, which I just posted several hours ago.  It's now possible to use the IndicatorLights debug console UI to manually edit the color-source syntax of a light, "live", either in the vehicle editor or in flight, and instantly see the result on the ship.  Some caveats:

  • I haven't written the wiki docs for it yet, so thank you for your patience.  But it tries to be somewhat self-documenting, so if you just type /il help in the debug console and follow the prompts from there, it's reasonably straightforward.  I'll explain it better in the docs when I write them, but the process looks something like this:  (yeah, I know, not gonna win any awards for elegance, but it gets the job done)
    1. /il parts to list the IndicatorLights-enabled parts on the current ship, with a number next to each one
    2. choose the part you're interested in and note its number
    3. /il part <number> to show info for that part
    4. /il part <number> controllers to show a numbered list of all the IndicatorLights controllers on that part
    5. choose the controller you're interested in and note its number
    6. /il part <number> controller <number> to show info about that controller, including a list of all its IndicatorLights syntax fields
    7. /il part <number> controller <number> set <field_name> <color_source_syntax> to specify new syntax for that field
  • It's only a temporary override and will not persist with the ship or get saved to any .cfg files.  Any changes you make will get blown away the next time the ship is loaded.  So it's only a tool for experimenting with the syntax-- once you find a formula that you like, you'll need to copy it so you can then paste into whatever .cfg files are appropriate.

Turns out that it does!  :D Just recently found out about this:  you can press Alt+F11 when in the space center view.  It pops up a little debug UI dialog with a button on it that tells ModuleManager to re-load all the .cfg files.  It's not instant-- takes a while to load everything.  But it's still way faster than restarting KSP.

You know sir, i still am behind my words, putting a little time for in editor window to tweak stuff and then push the final numbers into memory or what ever can be more fruitful in long run, trust me, then you would see people start giving patches for your mod one after another

Link to comment
Share on other sites

2 hours ago, Jiraiyah said:

You know sir, i still am behind my words, putting a little time for in editor window to tweak stuff

I'm sure that having a tool would indeed be useful... but it would be putting a lot of time in, not "a little", at least for me.  If someone else were to produce such a tool, I'm sure it would be handy, but there's no way that I'll ever be doing it myself.  I simply don't have the time or the inclination to go there.

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...
  • 2 months later...

Hey guys I've been putting in some work for this mod over the past few days. I use hundreds (literally) of mods and practically never use stock pods, but I love the crew indicators so I figured I might as well put 'em on what I use most and go from there. Snark's quick tutorial above regarding importing into blender and writing down the translation numbers was very helpful, but I feel like I've learned a few things to improve ont that method even further. Like I said, I use hundreds of mods, so the "tweak, reload, tweak, reload" process takes so long it is just unacceptable for more than once or twice, especially considering I plan to put these LEDs on just about every crewable part I touch. So here is the full, streamlined process including a few extra tips I've learned from trial and error, to help expedite the process and make it way more precise the first time you set the coordinates for the light meshes:

Spoiler

 

Step 1: Download Blender here: https://www.blender.org/download/

This is an open source, totally free 3D modeling and animation program.

Step 2: Download and install @taniwha's .mu importer for Blender from this thread: 

And install via the instructions there.

Step 3: Find the object you wish to add lights to in the GameData folder, and import via Blender.

Step 4: Delete all clutter surrounding the actual mesh of the object you want, such as colliders and center of lift meshes and the like. Right clicking on each should give you the name of that mesh in the bottom left corner of the workspace, or you can go through the scene tab in the top right. The delete key is of course the shortcut for delete. An important note, do not delete the position object directly parenting the object mesh (normally named the same thing with an extension and has the icon of the three pointed star. In the image below's case, it is j_4m_crew.001). 

You can control the camera through different orthogonal and perspective views easily by using the numpad keys while the cursor is over the main workspace window. Take note of where the origin is for the final remaining mesh you wish to add lights to. This will be the small dot at the center of your mesh's control point (pretty much never in the actual center of the mesh). This point is what the .cfg file will use as the origin for coordinates when you append the additional meshes to it. Meaning that if your light's position is 0,0,0, it will be at that origin point, not the 0,0,0 of the blender workspace. These two points in space should be equal if you delete the top coordinate layer of the .mu you imported:

Spoiler

leTVJmJ.jpg

 

If done correctly, you should be able check the position coordinates all say 0 as shown in this .gif:

http://i.imgur.com/egKPR08.gifv

Step 5: Import your light mesh of choice from @Snark's collection.

Step 6: Translate, rotate, and resize as appropriate from here, copying down the final coordinates from the pop-out toolbar, as seen in the .gif linked to in step 4. (Note, you will need to change the rotation display to XYZ Euler from it's drop down menu).

Step 7: Transpose your offset coordinates into KSP's axes:

  • Switch the Y and Z axes (In KSP, the Y axis is vertical (in the VAB) and Z is horizontal, Blender does the opposite.)
  • This is true for rotation and scale as well.
  • All rotation axes are negative compared to KSP's. To account for this, invert all rotations (e.g. 45 becomes -45)

Please see the following image for a graphic summary of the differences, featuring an amazingly accurate mk2 cockpit drawn by yours truly:

Spoiler

eLfaEHu.jpg

 

Step 8: Enter these final values into your .cfg file in the standard format (this should be straightforward, using the other .cfgs as a reference) and load into KSP to check. Some details might be off of course as there's a little room for error. It may not be perfect, but should give you an enormous head start and ensure you don't need to tweak and reload more than once or twice at the most.

Please note I am not a Blender guru. Everything I knew of modeling was for Lightwave 3D 8 about 10 years ago. If you have a link to a better guide please let me know and I will replace this block here with a link to it. I was not able to find one of these though that was succinct, when I looked myself, so I wrote this here. If you know more than I do on the subject and have found one of my steps to be wrong or suboptimal, by all means please correct me.

 

R4mxYsl.jpg

^ Salamander Command Pod from @RoverDude's Modular Kolonization Systems mod.

Edited by smokytehbear
Link to comment
Share on other sites

Alright I made some major adjustments to the post above after discovering several of my points were less efficient than possible, or just plain incorrect. Hopefully I have not led anyone astray with the errors.

For progress on this actual mod:

Finishing up integration of lights for OPT's crewable parts. The few reaction wheels and SAS in that mod likely to be configured soon.

MKS Crew classes now identifiable thanks to Snark's infrastructure update with the main mod, will be given default colors (nearly) matching the color scheme used by DMagic's portrait stats mod so that they are identifiable by Crew LEDs. Specific colors to be tweaked on this part.

Barring any serious bugs, should see these soon available. Planned next step is to incorporate custom-colorable LEDs into the EVA handrails mod so Kerbonauts can find their grip and footing in the dark.

Link to comment
Share on other sites

  • 2 months later...

Continued from the main IndicatorLights thread:

9 hours ago, DStaal said:

Quick question: I was thinking about making indicator light configs for USI's 'construction ports' and wanted to know where you wanted them.  The parts themselves are a retexture of the stock docking ports, so the configs should be just 'copy the docking ports config and change the part name'. :wink:   (Which could obviously be done by adding it to the stock ports configs as well...)

Well, I've never used the "construction ports" you mention, so I don't know what they do or how they work or what they look like.  So, "use your best judgment" is about all I can say.  You use the mod and I don't, so you'd have a better idea about what looks best, anyway.  :wink:

Out of curiosity, what functionality would the lights have?  Is this something that's already covered by one of the emissive-controller modules already implemented in IL?

Link to comment
Share on other sites

The parts are literally a retexture - same models as the stock docking ports, slightly desaturated texture so that they're visually distinguishable.  Why I think it'd be easy to do them.  :wink:

As for functionality - same as other docking ports: Some orientation indication, and docking state.  I may play around and see if I can cue a boolean indicator off of whether it's in angle-snap mode or not.  (They can be set to angle-snap into any angle, if desired.  It would be nice to know the state, as both docking ports must be in the same state to dock.)

Their main unique function - the ability to be 'compressed' out of existence, permanently joining the two vessels - isn't really something an indicator light would touch.

Link to comment
Share on other sites

6 hours ago, DStaal said:

The parts are literally a retexture - same models as the stock docking ports, slightly desaturated texture so that they're visually distinguishable.  Why I think it'd be easy to do them.  :wink:

As for functionality - same as other docking ports: Some orientation indication, and docking state.  I may play around and see if I can cue a boolean indicator off of whether it's in angle-snap mode or not.  (They can be set to angle-snap into any angle, if desired.  It would be nice to know the state, as both docking ports must be in the same state to dock.)

Ah, okay.  So they actually do function as docking ports, using the same functionality as the stock docking ports?  e.g. they either use the stock PartModule for docking ports, or some custom module derived therefrom?

In that case, my suggestion would be to copy the indicators from the stock docking ports, as I added them.  Not only will that save you some work, it'll also give a consistent visual experience (e.g. if a player is used to the indicators on the stock docking ports, they won't have a visual "learning curve" to deal with these ones).

Perhaps you'll have some slightly changed "wiring" for the actual indicator behavior, but the physical placement seems like it might as well be the same.

Sounds like the "extra" thing that they add (other than the compress-out-of-existence thing) is that they have some sort of "angle-snap" mode.  Could you elaborate on that?  What does it do, exactly?  Got a link to the source code for whatever part module implements this?

Link to comment
Share on other sites

1 minute ago, Snark said:

Ah, okay.  So they actually do function as docking ports, using the same functionality as the stock docking ports?  e.g. they either use the stock PartModule for docking ports, or some custom module derived therefrom?

In that case, my suggestion would be to copy the indicators from the stock docking ports, as I added them.  Not only will that save you some work, it'll also give a consistent visual experience (e.g. if a player is used to the indicators on the stock docking ports, they won't have a visual "learning curve" to deal with these ones).

Perhaps you'll have some slightly changed "wiring" for the actual indicator behavior, but the physical placement seems like it might as well be the same.

Sounds like the "extra" thing that they add (other than the compress-out-of-existence thing) is that they have some sort of "angle-snap" mode.  Could you elaborate on that?  What does it do, exactly?  Got a link to the source code for whatever part module implements this?

A quick test says that copying over the stock docking ports works - I had to change the line for the model replacement as well, but other than that no problem.  And yeah, what I wanted was a consistent visual experience - why I noticed it in the first place.  :wink:

The angle-snap is fairly straightforward - they offer a slider in the right-click menu that allows you to choose an angle for angle-snap docking (where they can only dock if at specific angles to each other) and a button to turn angle-snap docking on or off.  The slider is irrelevant as far as Indicator Lights go (well, if someone wanted a *really* complex implementation which lit up which angles are allowed, that might be fun - but that's more work than I think necessary), the only thing really relevant is the button to turn it on/off:  If it's off on both ports, they can dock at any angle to each other.  If it's on on both ports, they can dock at the specific angles selected.  If it's on on one, and off on the other, then they can't dock.

The part module is here: https://github.com/BobPalmer/Konstruction/blob/master/Source/Konstruction/Konstruction/ModuleWeldablePort.cs  - I'm assuming it's all in lines 82+83.

Link to comment
Share on other sites

On 5/30/2017 at 0:39 PM, DStaal said:

The part module is here

Hm.  Alas, he's not inheriting from ModuleDockingNode; he's just implementing his own, completely unrelated PartModule that just happens to own a DockingNode.

That means that none of the IndicatorLights PartModules for working with docking ports are going to be functional with this.

Not sure how you're going to get it to show any meaningful state, really.  :(

Link to comment
Share on other sites

10 minutes ago, Snark said:

Hm.  Alas, he's not inheriting from ModuleDockingNode; he's just implementing his own, completely unrelated PartModule that just happens to own a DockingNode.

That means that none of the IndicatorLights PartModules for working with docking ports are going to be functional with this.

Not sure how you're going to get it to show any meaningful state, really.  :(

The parts' configs do also have a ModuleDockingNode.  I'll have to try them out to see if my patch actually indicates state.

(I haven't been trying much at the moment - I still don't have access to 1.3, so I haven't wanted to be playing around with known-outdated stuff.)

Link to comment
Share on other sites

33 minutes ago, DStaal said:

The parts' configs do also have a ModuleDockingNode.

...Ah, okay.  Now I see what he's doing.

So, yes, this should work just fine.  You should be able to copy across the stock ports' config and they should work just fine as-is.

I don't see any way for you to interop with the angle snap status, though, since that's a custom attribute on the Konstruction module, which IndicatorLights doesn't know anything about.

Link to comment
Share on other sites

14 minutes ago, Snark said:

I don't see any way for you to interop with the angle snap status, though, since that's a custom attribute on the Konstruction module, which IndicatorLights doesn't know anything about.

Most of the UI parameters in Konstruction's ModuleWeldablePort manipulate existing parameters on stock ModuleDockingNode. In the case of the angle snap on/off button it's the ModuleDockingNode.snapRotation field, so if IndicatorLights was aware of this value (which is also used by other modded docking ports that force alignment) then it would work with Konstruction's ports too.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...